:root {
  --bg: oklch(1 0 0);
  --surface: oklch(0.972 0.004 230);
  --surface-strong: oklch(0.94 0.009 230);
  --ink: oklch(0.205 0.018 230);
  --muted: oklch(0.48 0.02 230);
  --line: oklch(0.89 0.008 230);
  --primary: oklch(0.55 0.105 230);
  --primary-hover: oklch(0.48 0.115 230);
  --primary-pale: oklch(0.94 0.025 230);
  --success: oklch(0.56 0.13 155);
  --success-pale: oklch(0.95 0.035 155);
  --warning: oklch(0.7 0.15 75);
  --warning-pale: oklch(0.96 0.04 75);
  --danger: oklch(0.54 0.18 25);
  --danger-pale: oklch(0.95 0.035 25);
  --focus: oklch(0.7 0.12 230);
  --radius: 10px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 14px/1.5 var(--font); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid color-mix(in oklch, var(--focus), white 25%); outline-offset: 2px; }
.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; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand > span:last-child { display: grid; line-height: 1.2; }
.brand small { color: var(--muted); margin-top: 3px; }
.brand-mark { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--primary); color: white; font-weight: 750; letter-spacing: -.02em; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 9px; font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions form { margin: 0; }
.workspace { width: min(1220px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.page-heading h1 { margin: 3px 0 4px; font-size: 25px; letter-spacing: -.025em; }
.page-heading p { margin: 0; color: var(--muted); }
.breadcrumb { font-size: 13px; }
.button { min-height: 38px; border: 0; border-radius: 8px; padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; cursor: pointer; font-weight: 650; transition: background 180ms ease-out, color 180ms ease-out, border-color 180ms ease-out; }
.button:disabled { cursor: not-allowed; opacity: .52; }
.button-primary { background: var(--primary); color: white; }
.button-primary:hover:not(:disabled) { background: var(--primary-hover); }
.button-secondary { background: var(--bg); color: var(--primary-hover); border: 1px solid color-mix(in oklch, var(--primary), white 48%); }
.button-secondary:hover { background: var(--primary-pale); }
.button-quiet { background: transparent; color: var(--muted); border: 1px solid transparent; }
.button-quiet:hover { color: var(--ink); background: var(--surface); }
.connection-strip { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.connection-strip > div { display: grid; grid-template-columns: 10px auto; align-items: center; column-gap: 10px; }
.connection-strip p { grid-column: 2; margin: 1px 0 0; color: var(--muted); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warning); }
.is-connected .status-dot { background: var(--success); }
.summary { display: flex; align-items: stretch; margin: 22px 0; background: var(--bg); border-block: 1px solid var(--line); }
.summary > div { flex: 1; min-width: 0; padding: 18px 22px; border-right: 1px solid var(--line); }
.summary > div:last-child { border-right: 0; }
.summary span { display: block; color: var(--muted); font-size: 13px; }
.summary strong { display: inline-block; margin-top: 5px; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.summary small { margin-left: 5px; color: var(--muted); }
.table-section, .audit-section { background: var(--bg); border-radius: 12px; overflow: hidden; }
.audit-section { margin-top: 22px; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px 14px; }
.section-bar h2 { margin: 0; font-size: 16px; }
.section-bar p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); font-size: 12px; text-align: left; font-weight: 650; background: var(--surface); }
th, td { padding: 13px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: color-mix(in oklch, var(--surface), white 45%); }
.account-cell { display: flex; align-items: center; gap: 11px; min-width: 260px; }
.avatar { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-pale); color: var(--primary-hover); font-weight: 750; }
.account-cell strong, .account-cell small { display: block; }
.account-cell small { color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-pale); color: oklch(0.4 0.11 155); }
.badge-muted { background: var(--surface-strong); color: var(--muted); }
.badge-warning { background: var(--warning-pale); color: oklch(0.43 0.12 75); }
.row-actions { text-align: right; }
.row-actions .button { min-height: 32px; padding: 5px 10px; }
.skeleton-row { height: 40px; border-radius: 8px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-strong) 42%, var(--surface) 60%); background-size: 300% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -120% 0; } }
.audit-list { border-top: 1px solid var(--line); }
.audit-item { display: grid; grid-template-columns: 170px 150px 1fr; gap: 16px; padding: 11px 22px; border-bottom: 1px solid var(--line); }
.audit-item time, .audit-item span { color: var(--muted); font-size: 13px; }
.empty-copy { margin: 0; padding: 22px; color: var(--muted); }
.notice { margin-bottom: 16px; padding: 11px 14px; border-radius: 8px; }
.notice-error { background: var(--danger-pale); color: oklch(0.39 0.15 25); }
.notice-success { background: var(--success-pale); color: oklch(0.38 0.1 155); }
.dialog-panel { width: min(560px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 14px; color: var(--ink); background: var(--bg); }
.dialog-panel::backdrop { background: oklch(0.12 0.01 230 / .52); }
.dialog-panel.compact { width: min(500px, calc(100% - 28px)); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 19px; }
.dialog-head p { margin: 3px 0 0; color: var(--muted); }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 20px; }
.dialog-form, .form-stack { display: grid; gap: 16px; padding: 22px 24px 24px; }
.dialog-form label, .form-stack label { display: grid; gap: 6px; font-weight: 650; }
input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--bg); }
input::placeholder { color: color-mix(in oklch, var(--muted), var(--ink) 12%); }
input:focus { border-color: var(--primary); outline: 3px solid color-mix(in oklch, var(--primary-pale), transparent 10%); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.password-field { display: flex; gap: 8px; }
.password-field input { flex: 1; }
.check-row { display: flex !important; align-items: center; gap: 9px !important; font-weight: 500 !important; }
.check-row input { width: 17px; min-height: 17px; accent-color: var(--primary); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.action-grid { display: grid; gap: 12px; }
.action-grid .button { width: 100%; justify-content: space-between; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.action-grid .button:hover { background: var(--surface); }
.action-grid .danger-soft { color: var(--danger); }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 50; display: grid; gap: 8px; }
.toast { min-width: 280px; max-width: 420px; padding: 12px 14px; border-radius: 9px; background: var(--ink); color: white; animation: toast-in 180ms ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: var(--surface); }
.login-panel { width: min(420px, 100%); padding: 34px; background: var(--bg); border-radius: 14px; }
.login-panel .brand-name { margin: 12px 0 26px; color: var(--muted); font-weight: 650; }
.login-panel h1 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.login-intro { margin: 6px 0 6px; color: var(--muted); }
.login-panel .form-stack { padding: 18px 0 0; }
.login-footnote { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .topbar-actions .button:first-child { display: none; }
  .workspace { width: min(100% - 24px, 1220px); padding-top: 24px; }
  .page-heading { align-items: flex-start; }
  .summary { flex-wrap: wrap; }
  .summary > div { flex: 1 1 50%; border-bottom: 1px solid var(--line); }
  .summary > div:nth-child(2) { border-right: 0; }
  .summary > div:nth-last-child(-n+2) { border-bottom: 0; }
  thead { display: none; }
  table, tbody, tr, td { display: block; }
  tbody tr { padding: 12px 16px; border-top: 1px solid var(--line); }
  td { padding: 7px 0; border: 0; }
  td::before { content: attr(data-label); display: inline-block; width: 112px; color: var(--muted); font-size: 12px; }
  td:first-child::before, td:last-child::before { display: none; }
  .row-actions { text-align: left; }
  .audit-item { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 520px) {
  .page-heading { display: grid; }
  .page-heading .button { width: 100%; }
  .connection-strip { align-items: flex-start; flex-direction: column; }
  .connection-strip .button { width: 100%; }
  .summary > div { flex-basis: 100%; border-right: 0; border-bottom: 1px solid var(--line) !important; }
  .summary > div:last-child { border-bottom: 0 !important; }
  .two-col { grid-template-columns: 1fr; }
  .login-panel { padding: 26px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
