:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(10, 26, 46, .94);
  --panel-solid: #0c1b30;
  --soft: #132640;
  --soft-2: rgba(17, 39, 65, .72);
  --line: rgba(153, 190, 224, .22);
  --line-strong: rgba(126, 205, 229, .38);
  --text: #edf7ff;
  --muted: #9cb1ca;
  --cyan: #66d7ef;
  --mint: #6ce3b7;
  --warning: #ffd479;
  --danger: #ff8ba3;
  --shadow: 0 20px 60px rgba(0, 0, 0, .24);
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0, rgba(62, 188, 210, .16), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(104, 87, 220, .16), transparent 30%),
    linear-gradient(180deg, rgba(7, 17, 31, .2), rgba(4, 11, 21, .5)),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.shell { width: min(1420px, calc(100% - 30px)); margin: 0 auto; padding: 16px 0 72px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #06131c; font-weight: 950; background: linear-gradient(135deg, var(--cyan), var(--mint)); box-shadow: 0 8px 26px rgba(86, 216, 211, .2); }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: .1em; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 12px; }
.top-actions a { padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; transition: border-color .18s, color .18s, background .18s; }
.top-actions a:hover { color: var(--text); border-color: var(--line-strong); background: rgba(102, 215, 239, .07); }
.access-badge { padding: 6px 9px; border: 1px solid rgba(108, 227, 183, .25); border-radius: 999px; color: var(--mint); background: rgba(29, 116, 90, .18); font-size: 10px; font-weight: 900; }

.panel { margin-top: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.gate { max-width: 540px; margin: 14vh auto 0; }
.gate h1 { margin: 0 0 10px; }
.gate > p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
.gate-actions { display: flex; justify-content: center; gap: 9px; margin-top: 18px; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 42px 0 22px; }
.hero-copy { max-width: 680px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(32px, 4vw, 52px); letter-spacing: -.04em; }
.hero-copy > p:last-child { margin: 0; color: var(--muted); line-height: 1.8; }
.eyebrow { margin: 0 0 7px !important; color: var(--cyan) !important; font-size: 10px; font-weight: 950; letter-spacing: .16em; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(104px, 1fr)); gap: 9px; }
.metrics div { min-width: 104px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(17, 35, 59, .76); }
.metrics strong, .metrics span { display: block; }
.metrics strong { font-size: 22px; }
.metrics span { margin-top: 4px; color: var(--muted); font-size: 10px; }

.alert { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(102, 215, 239, .34); border-radius: 12px; color: #c9f7ff; background: rgba(19, 96, 119, .28); }
.alert.success { color: #c9ffe9; border-color: rgba(108, 227, 183, .36); background: rgba(22, 106, 76, .28); }
.alert.warning { color: #fff0bd; border-color: rgba(255, 212, 121, .35); background: rgba(118, 78, 17, .28); }
.alert.error { color: #ffd7df; border-color: rgba(255, 112, 143, .4); background: rgba(105, 27, 50, .34); }

.tabs { display: flex; gap: 8px; margin-top: 10px; }
.tabs button { min-height: 40px; padding: 0 16px; color: var(--muted); border: 1px solid var(--line); border-radius: 12px; background: rgba(14, 31, 52, .8); cursor: pointer; }
.tabs button.active { color: #05131b; border-color: transparent; background: linear-gradient(120deg, var(--cyan), var(--mint)); font-weight: 950; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin: 0 0 5px; }
.section-heading p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.6; }

.primary, .secondary, .ghost, .danger { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-radius: 11px; cursor: pointer; font-weight: 850; text-decoration: none; white-space: nowrap; transition: opacity .18s, transform .18s, border-color .18s, background .18s; }
.primary { color: #06131c; border: 0; background: linear-gradient(120deg, var(--cyan), var(--mint)); }
.secondary { color: var(--text); border: 1px solid var(--line); background: var(--soft); }
.ghost { color: var(--muted); border: 1px solid transparent; background: transparent; }
.danger { color: #ffdce5; border: 1px solid rgba(255, 111, 143, .38); background: rgba(91, 24, 47, .45); }
.primary:hover, .secondary:hover, .ghost:hover, .danger:hover { transform: translateY(-1px); }
.secondary:hover, .ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(38, 72, 105, .55); }
.danger:hover { border-color: rgba(255, 139, 163, .7); background: rgba(113, 31, 57, .6); }
.compact { min-height: 32px; padding: 0 10px; font-size: 11px; }
button:disabled { opacity: .52; cursor: wait; transform: none !important; }

input, select, textarea { width: 100%; min-height: 40px; padding: 0 11px; color: var(--text); border: 1px solid var(--line); border-radius: 10px; outline: none; background: rgba(4, 13, 25, .72); }
textarea { min-height: 92px; padding-top: 10px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(102, 215, 239, .12); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
label small { justify-self: end; font-weight: 500; }

.filters { display: grid; grid-template-columns: 150px 150px 150px minmax(200px, 1fr) auto auto; gap: 9px; align-items: end; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.plan-list { display: grid; gap: 10px; }
.plan-card { display: grid; grid-template-columns: 136px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--soft-2); transition: border-color .18s, background .18s; }
.plan-card:hover { border-color: rgba(102, 215, 239, .34); background: rgba(19, 45, 74, .86); }
.plan-time { padding-right: 15px; border-right: 1px solid var(--line); }
.plan-time strong, .plan-time span { display: block; }
.plan-time strong { font-size: 15px; }
.plan-time span { margin-top: 5px; color: var(--cyan); font-size: 11px; font-weight: 900; }
.plan-content { min-width: 0; }
.plan-title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-title { margin: 0; overflow-wrap: anywhere; font-size: 16px; }
.plan-note { margin: 7px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.55; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.plan-meta { display: flex; gap: 8px 14px; flex-wrap: wrap; margin-top: 9px; color: var(--muted); font-size: 10px; }
.plan-meta strong { color: #cfe9f5; }
.plan-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; max-width: 300px; }
.status { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 9px; font-weight: 950; }
.status.published { color: #84efc6; background: rgba(27, 136, 103, .22); }
.status.hidden { color: #ffe29b; background: rgba(150, 108, 32, .24); }
.status.removed { color: #ffafbf; background: rgba(150, 40, 69, .23); }
.status.unshared { color: #b8c5d6; background: rgba(92, 106, 125, .24); }
.source-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: 9px; }

.empty-state { display: grid; place-items: center; padding: 60px 20px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 15px; color: var(--cyan); background: rgba(102, 215, 239, .08); font-size: 22px; }
.empty-state h3 { margin: 13px 0 5px; }
.empty-state p, .empty-copy { margin: 0; color: var(--muted); font-size: 11px; }
.compact-empty { padding: 36px 20px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 11px 9px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 9px; letter-spacing: .07em; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); }
.audit-detail { max-width: 340px; overflow-wrap: anywhere; color: var(--muted); }

.permission-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; }
.admin-list, .user-results { display: grid; gap: 9px; }
.admin-entry, .user-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--soft-2); }
.identity-copy { min-width: 0; }
.identity-copy strong, .identity-copy small { display: block; overflow-wrap: anywhere; }
.identity-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.user-search { display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: end; margin-bottom: 14px; }

.editor-dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 0; color: var(--text); border: 1px solid var(--line-strong); border-radius: 20px; background: var(--panel-solid); box-shadow: 0 32px 90px rgba(0, 0, 0, .58); }
.editor-dialog::backdrop { background: rgba(0, 8, 18, .74); backdrop-filter: blur(5px); }
.dialog-card { display: grid; gap: 14px; padding: 22px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { margin: 0; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; background: var(--soft); cursor: pointer; font-size: 22px; }
.datetime-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-hint { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }

@media (max-width: 1080px) {
  .topbar, .hero { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; flex-wrap: wrap; }
  .metrics { width: 100%; }
  .filters { grid-template-columns: repeat(3, 1fr); }
  .search-field { grid-column: span 2; }
  .permission-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { width: calc(100% - 18px); }
  .hero { padding-top: 30px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .plan-card { grid-template-columns: 92px minmax(0, 1fr); }
  .plan-time { padding-right: 10px; }
  .plan-actions { grid-column: 1 / -1; justify-content: flex-start; max-width: none; padding-top: 4px; }
}

@media (max-width: 520px) {
  .panel { padding: 14px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading .primary { width: 100%; }
  .tabs { overflow-x: auto; padding-bottom: 3px; }
  .tabs button { flex: 0 0 auto; }
  .filters, .datetime-grid, .user-search { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .filters button { width: 100%; }
  .plan-card { grid-template-columns: 1fr; gap: 10px; }
  .plan-time { display: flex; align-items: baseline; gap: 10px; padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .plan-time span { margin-top: 0; }
  .admin-entry, .user-entry { align-items: flex-start; flex-direction: column; }
  .admin-entry button, .user-entry button { width: 100%; }
  .dialog-card { padding: 17px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
