@charset "UTF-8";

:root {
  --ink: oklch(24% 0.018 165);
  --muted: oklch(47% 0.018 165);
  --subtle: oklch(64% 0.015 165);
  --paper: oklch(98.5% 0.005 145);
  --surface: oklch(99.5% 0.003 145);
  --line: oklch(90% 0.009 155);
  --accent: oklch(43% 0.075 165);
  --accent-hover: oklch(36% 0.072 165);
  --accent-soft: oklch(95% 0.025 160);
  --danger: oklch(48% 0.15 27);
  --danger-soft: oklch(95% 0.028 27);
  --success: oklch(43% 0.075 165);
  --radius: 10px;
  --shadow: 0 18px 50px oklch(20% 0.02 165 / 0.14);
  font-family: "MiSans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100dvh; font-size: 16px; line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, select, input[type="checkbox"], input[type="radio"] { cursor: pointer; }
button:disabled, select:disabled, input:disabled, textarea:disabled { cursor: not-allowed; opacity: .48; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid oklch(65% 0.11 165 / .48);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(24px, 3vw, 30px); line-height: 1.25; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 22px; line-height: 1.3; }
h3 { font-size: 15px; }
p { margin-bottom: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 20; left: 16px; top: 8px; padding: 8px 12px; color: var(--surface); background: var(--accent); border-radius: 6px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.muted { color: var(--muted); font-size: 13px; }

.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 28px 16px 20px; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 32px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--accent); border-radius: 10px; transform: rotate(45deg); }
.brand-mark span { width: 12px; height: 12px; background: var(--accent); border-radius: 3px; }
.brand > div { display: flex; flex-direction: column; }
.brand strong { font-size: 17px; letter-spacing: .02em; }
.brand div span { color: var(--muted); font-size: 12px; }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tab { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 9px 12px; color: var(--muted); background: transparent; border: 0; border-radius: 8px; text-align: left; transition: color 160ms ease-out, background-color 160ms ease-out; }
.tab:hover { color: var(--ink); background: var(--paper); }
.tab[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.tab-count { min-width: 24px; padding: 0 6px; border-radius: 10px; background: var(--surface); font-size: 12px; text-align: center; }
.sidebar-foot { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding: 16px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.connection { display: flex; align-items: center; gap: 7px; }
.connection > span { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.version { color: var(--subtle); }

.main-column { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 88px; padding: 18px clamp(20px, 4vw, 48px); border-bottom: 1px solid var(--line); background: var(--paper); }
.topbar-title { font-size: 14px; font-weight: 650; }
.topbar-subtitle { color: var(--muted); font-size: 12px; }
.session-actions { display: flex; align-items: center; gap: 12px; }
.admin-identity { display: flex; align-items: center; gap: 8px; max-width: 320px; color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.admin-identity span:last-child { overflow: hidden; text-overflow: ellipsis; }
.status-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.content { width: min(100%, 1440px); margin: 0 auto; padding: 36px clamp(20px, 4vw, 48px) 56px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 280px; color: var(--muted); }
.loading-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: breathe 1.2s ease-in-out infinite alternate; }
@keyframes breathe { to { opacity: .25; transform: scale(.75); } }
.notice { margin-bottom: 20px; padding: 12px 16px; color: var(--danger); background: var(--danger-soft); border: 1px solid oklch(86% 0.05 27); border-radius: 8px; }

.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.panel-heading p { max-width: 68ch; color: var(--muted); font-size: 14px; }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.toolbar-note { max-width: 70ch; color: var(--muted); font-size: 13px; }
.compact-field { min-width: 156px; }
.table-wrap { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { padding: 12px 12px; color: var(--muted); font-size: 12px; font-weight: 550; text-align: left; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; text-align: right; }
td { padding: 16px 12px; border-top: 1px solid var(--line); font-size: 14px; vertical-align: middle; overflow-wrap: anywhere; }
tbody tr:first-child td { border-top: 0; }
tbody tr { transition: background-color 140ms ease-out; }
tbody tr:hover { background: oklch(96.5% 0.008 155); }
.cell-primary { display: block; font-weight: 600; }
.cell-secondary { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.cell-code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.cell-list { display: flex; flex-wrap: wrap; gap: 4px; }
.uri-list { display: block; max-height: 72px; overflow: auto; color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.uri-list > span { display: block; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 12px; color: var(--muted); background: oklch(94% 0.008 155); font-size: 12px; white-space: nowrap; }
.badge-success { color: var(--success); background: var(--accent-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.row-actions .button { min-height: 34px; padding: 5px 8px; font-size: 12px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 56px 16px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }
.empty-state span { font-size: 14px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; color: var(--muted); font-size: 13px; }
.pagination > div { display: flex; gap: 8px; }

.button { min-height: 40px; padding: 8px 14px; border: 1px solid transparent; border-radius: 7px; font-size: 14px; font-weight: 550; transition: background-color 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out, transform 150ms ease-out; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button-primary { color: var(--surface); background: var(--accent); border-color: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.button-quiet { color: var(--muted); background: transparent; border-color: var(--line); }
.button-quiet:hover:not(:disabled) { color: var(--ink); background: var(--surface); border-color: var(--subtle); }
.button-danger { color: var(--surface); background: var(--danger); border-color: var(--danger); }
.button-danger:hover:not(:disabled) { background: oklch(41% 0.14 27); }
.button-danger-quiet { color: var(--danger); background: transparent; border-color: transparent; }
.button-danger-quiet:hover:not(:disabled) { background: var(--danger-soft); }
.icon-button { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 50%; font-size: 25px; line-height: 1; }
.icon-button:hover { color: var(--ink); background: var(--paper); }

.field { display: flex; flex-direction: column; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 550; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 9px 11px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; font-size: 14px; font-weight: 400; transition: border-color 150ms ease-out, box-shadow 150ms ease-out; }
.field textarea { resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--subtle); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px oklch(70% 0.07 165 / .15); }
.field-help { color: var(--muted); font-size: 12px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.check-row { display: flex; flex-wrap: wrap; gap: 24px; font-size: 14px; }
.check-row label, .checkbox-group label { display: flex; align-items: center; gap: 7px; min-height: 36px; font-weight: 400; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; accent-color: var(--accent); }
.checkbox-group { margin: 0; padding: 0; border: 0; }
.checkbox-group legend { margin-bottom: 4px; }

.policy-layout { display: grid; grid-template-columns: minmax(240px, .85fr) minmax(300px, 1.15fr); gap: clamp(32px, 6vw, 72px); max-width: 1040px; }
.policy-options { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; border: 0; }
.policy-options legend { margin-bottom: 14px; font-size: 14px; font-weight: 650; }
.radio-card { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color 150ms ease-out, background-color 150ms ease-out; }
.radio-card:hover { border-color: var(--subtle); background: var(--surface); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { flex: 0 0 auto; margin-top: 5px; }
.radio-card span { display: flex; flex-direction: column; }
.radio-card small { color: var(--muted); font-size: 12px; }
.policy-details { display: flex; flex-direction: column; gap: 12px; }
.policy-warning { margin-top: 8px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.policy-warning strong { font-size: 14px; }
.policy-warning p { color: var(--muted); font-size: 13px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }

.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.filter-actions { display: flex; align-items: flex-end; gap: 8px; }

.login-view { max-width: 540px; margin: 8vh auto 0; text-align: center; }
.login-symbol { display: inline-block; width: 44px; height: 44px; margin-bottom: 24px; border: 2px solid var(--accent); border-radius: 14px; transform: rotate(45deg); }
.section-kicker { margin-bottom: 8px; color: var(--accent); font-size: 12px; font-weight: 650; letter-spacing: .12em; }
.login-view h1 { margin-bottom: 16px; }
.login-view > p:not(.section-kicker):not(.login-error) { margin-bottom: 28px; color: var(--muted); }
.login-error { margin-top: 20px; color: var(--danger); }

.dialog { width: min(calc(100% - 32px), 520px); max-height: min(88dvh, 860px); padding: 28px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow-y: auto; }
.dialog-wide { width: min(calc(100% - 32px), 680px); }
.dialog::backdrop { background: oklch(18% 0.015 165 / .44); backdrop-filter: blur(3px); }
.dialog[open] { animation: dialog-in 180ms ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
.dialog form { display: flex; flex-direction: column; gap: 18px; }
.dialog > p { margin: 18px 0; color: var(--muted); font-size: 14px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.dialog form .dialog-heading { margin-bottom: 2px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.dialog form .dialog-actions { margin-top: 2px; }
.secret-value { display: block; padding: 12px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 7px; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; user-select: all; }
.audit-meta { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; margin: 0 0 24px; font-size: 13px; }
.audit-meta dt { color: var(--muted); }
.audit-meta dd { margin: 0; overflow-wrap: anywhere; }
pre { max-height: 320px; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: min(420px, calc(100% - 32px)); padding: 12px 18px; color: var(--surface); background: var(--ink); border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; animation: toast-in 180ms ease-out; }
.toast-error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 1600px) {
  .app-shell { grid-template-columns: 248px minmax(0, 1fr); }
  .content { padding-top: 48px; }
}

@media (max-width: 1023px) {
  .app-shell { display: block; }
  .sidebar { position: static; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; width: 100%; height: auto; padding: 14px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
  .brand-mark span { width: 10px; height: 10px; }
  .tabs { flex-direction: row; justify-content: flex-end; overflow-x: auto; }
  .tab { flex: 0 0 auto; min-height: 44px; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .topbar { min-height: 76px; }
  .filter-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .policy-layout { gap: 32px; }
}

@media (max-width: 767px) {
  body { font-size: 16px; }
  .sidebar { grid-template-columns: 1fr; gap: 12px; padding: 14px 16px 10px; }
  .brand { padding-left: 4px; }
  .brand > div { flex-direction: row; align-items: baseline; gap: 8px; }
  .tabs { justify-content: flex-start; margin: 0 -4px; }
  .tab { padding: 8px 12px; }
  .topbar { padding: 14px 16px; }
  .topbar-subtitle, .admin-identity { display: none; }
  .content { padding: 24px 16px 40px; }
  .panel-heading { align-items: stretch; flex-direction: column; gap: 16px; margin-bottom: 22px; }
  .panel-heading .button { align-self: flex-start; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
  .compact-field { width: 100%; }
  .button, .icon-button { min-height: 44px; }
  .row-actions .button { min-height: 44px; padding: 8px 10px; }
  table, tbody { display: block; }
  thead { display: none; }
  tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
  tbody tr:first-child { border-top: 0; }
  td { display: block; padding: 0; border: 0; }
  td::before { display: block; margin-bottom: 3px; color: var(--muted); content: attr(data-label); font-size: 11px; }
  td:first-child { grid-column: 1 / -1; padding: 0; }
  td:last-child { grid-column: 1 / -1; padding: 0; text-align: left; }
  td:last-child::before { display: none; }
  .row-actions { justify-content: flex-start; }
  .pagination { align-items: flex-start; }
  .policy-layout { grid-template-columns: 1fr; gap: 28px; }
  .filter-grid, .form-grid { grid-template-columns: 1fr; }
  .filter-actions { align-items: center; }
  .dialog { padding: 22px 20px; }
  .dialog-actions { flex-wrap: wrap; }
  .audit-meta { grid-template-columns: 92px 1fr; }
  .toast { right: 16px; bottom: 16px; }
}

.option-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; max-height: 220px; overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.option-list label { display: flex; align-items: flex-start; gap: 7px; overflow-wrap: anywhere; }
.option-list input { flex: 0 0 auto; margin-top: 3px; }
.invite-qr { display: flex; justify-content: center; padding: 16px; }
.invite-qr img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }

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