:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: #202326;
  background: #f3f5f6;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f5f6; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #17191b; }
.login-panel { width: min(100%, 420px); padding: 34px; border-top: 3px solid #e73b31; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.26); }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 auto; background: #e73b31; color: #fff; font-size: 17px; font-weight: 800; }
.brand-mark.small { width: 34px; height: 34px; font-size: 13px; }
.eyebrow { margin: 0 0 5px; color: #6c7378; font-size: 11px; font-weight: 750; letter-spacing: 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 25px; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 23px; letter-spacing: 0; }
h3 { margin-bottom: 0; font-size: 16px; letter-spacing: 0; }
.muted { color: #757c80; font-size: 14px; }
.stack-form, .dialog-form { display: grid; gap: 16px; }
.stack-form { margin-top: 26px; }
label { display: grid; gap: 7px; color: #454b4f; font-size: 13px; font-weight: 650; }
.checkbox-control { width: fit-content; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.checkbox-control input { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: #202326; }
input, select, textarea { min-width: 0; width: 100%; border: 1px solid #cfd4d7; border-radius: 4px; background: #fff; color: #202326; outline: none; }
input, select { height: 40px; padding: 0 11px; }
textarea { padding: 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #353a3d; box-shadow: 0 0 0 3px rgba(32,35,38,.08); }
.form-error { min-height: 18px; margin: -4px 0 0; color: #bd271f; font-size: 13px; }
.button { min-height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #292d30; font-weight: 650; }
.button.primary { background: #202326; color: #fff; }
.button.primary:hover { background: #000; }
.button.quiet { border-color: #cfd4d7; background: #fff; }
.button.quiet:hover { border-color: #878e92; }
.button.danger-quiet { color: #b12720; }
.button.danger-quiet:hover { background: #fff0ef; }
.button:disabled { cursor: not-allowed; opacity: .55; }

.app-shell { min-height: 100vh; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 28px; border-bottom: 1px solid #dce0e2; background: #fff; }
.topbar-brand, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.admin-name { color: #666d71; font-size: 13px; }
.workspace { width: min(1440px, 100%); margin: 0 auto; padding: 26px 30px 48px; }
.tabs { display: flex; gap: 2px; margin-bottom: 28px; border-bottom: 1px solid #d6dadd; }
.tab { min-height: 43px; padding: 0 19px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #656c70; font-weight: 700; }
.tab.active { border-bottom-color: #e73b31; color: #17191b; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat { min-height: 116px; display: flex; flex-direction: column; justify-content: space-between; padding: 18px; border: 1px solid #dde1e3; border-radius: 6px; background: #fff; }
.stat span { color: #70777b; font-size: 13px; }
.stat strong { font-size: 31px; line-height: 1; }
.stat.accent { border-top: 3px solid #e73b31; }
.content-block { margin-top: 20px; border: 1px solid #dde1e3; border-radius: 6px; background: #fff; }
.block-title { padding: 16px 18px; border-bottom: 1px solid #e6e9ea; }
.activity-list { min-height: 150px; }
.activity { display: grid; grid-template-columns: 170px minmax(120px, 1fr) 2fr; gap: 16px; padding: 13px 18px; border-bottom: 1px solid #eef0f1; font-size: 13px; }
.activity:last-child { border-bottom: 0; }
.activity time, .activity .secondary { color: #72797d; }
.filterbar { display: grid; grid-template-columns: minmax(220px, 1fr) 150px 150px auto; gap: 10px; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid #dce0e2; border-radius: 6px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 13px; border-bottom: 1px solid #e8ebec; text-align: left; white-space: nowrap; vertical-align: middle; }
th { background: #f7f8f8; color: #62696d; font-size: 12px; font-weight: 750; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfb; }
.actions-column { min-width: 265px; }
.secret-cell { display: flex; align-items: center; gap: 8px; }
.secret-cell code, .secret-preview { font-family: Consolas, monospace; font-size: 12px; }
.secret-preview { display: block; padding: 11px; border: 1px solid #e0e4e6; border-radius: 4px; background: #f6f7f7; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 3px; font-size: 11px; font-weight: 750; }
.badge.ok { background: #e8f5ed; color: #15723b; }
.badge.bad { background: #fce9e7; color: #a82620; }
.badge.neutral { background: #eceff0; color: #555c60; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.row-button { min-height: 29px; padding: 0 8px; border: 1px solid #d8dcde; border-radius: 3px; background: #fff; color: #3c4245; font-size: 12px; }
.row-button:hover { border-color: #8f969a; }
.row-button.danger { color: #b12720; }
.empty { margin: 0; padding: 42px; color: #7a8185; text-align: center; }

dialog { width: min(94vw, 590px); padding: 0; border: 0; border-radius: 7px; box-shadow: 0 24px 80px rgba(0,0,0,.32); }
dialog::backdrop { background: rgba(14,16,17,.62); }
.dialog-form { padding: 24px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 4px; background: #eef0f1; color: #42474a; font-size: 23px; line-height: 1; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 5px; background: #eceff0; }
.segment { min-height: 36px; border: 0; border-radius: 3px; background: transparent; color: #60676b; font-weight: 700; }
.segment.active { background: #fff; color: #1e2224; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(380px, calc(100vw - 48px)); padding: 11px 15px; border-radius: 4px; background: #202326; color: #fff; font-size: 13px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filterbar { grid-template-columns: 1fr 1fr; }
  .activity { grid-template-columns: 145px 1fr; }
  .activity .secondary { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .login-panel { padding: 25px 21px; }
  .topbar { height: auto; align-items: flex-start; padding: 14px 16px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .admin-name { width: 100%; text-align: right; }
  .workspace { padding: 20px 14px 36px; }
  .tabs { overflow-x: auto; }
  .tab { padding: 0 13px; white-space: nowrap; }
  .section-head { align-items: center; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat { min-height: 100px; }
  .filterbar, .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .activity { grid-template-columns: 1fr; gap: 5px; }
  .activity .secondary { grid-column: auto; }
  dialog { width: calc(100vw - 24px); }
}
