:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #06223f;
  --muted: #456078;
  --subtle: #98a2b3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --accent: #117ad1;
  --accent-strong: #0b5ea8;
  --accent-soft: #e8f3fc;
  --success: #157f3b;
  --success-soft: #eaf7ef;
  --warning: #c9681d;
  --warning-soft: #fdefe3;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 10px 30px rgb(16 24 40 / 7%);
  --sidebar-width: 15.25rem;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 13.5px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: var(--sidebar-width); flex-direction: column; border-right: 1px solid var(--border); background: var(--surface); }
.brand-block { display: flex; align-items: center; gap: 10px; min-height: 72px; padding: 16px; border-bottom: 1px solid var(--border); }
.brand-mark, .profile-mark { display: grid; place-items: center; flex: 0 0 auto; background: var(--accent); color: #fff; }
.brand-mark { width: 31px; height: 31px; border-radius: 7px; }
.brand-block strong { display: block; font-size: 13px; }
.brand-block span { display: block; color: var(--subtle); font-size: 11px; }
.sidebar-close, .menu-button { display: none; }
.workspace-label { overflow: hidden; padding: 16px 17px 7px; color: var(--subtle); font-size: 11px; font-weight: 700; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.sidebar-nav { display: grid; gap: 2px; padding: 6px 10px; }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 37px; padding: 8px 10px; border-radius: 7px; color: var(--muted); font-weight: 600; }
.nav-link:hover { background: var(--surface-soft); color: var(--text); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-strong); }
.sidebar-footer { display: grid; gap: 6px; margin-top: auto; padding: 15px 17px; border-top: 1px solid var(--border); color: var(--subtle); font-size: 11px; }
.local-badge { width: max-content; padding: 2px 7px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: 10px; font-weight: 700; }
.app-main { min-width: 0; margin-left: var(--sidebar-width); }
.app-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; min-height: 60px; padding: 0 27px; border-bottom: 1px solid var(--border); background: rgb(255 255 255 / 96%); }
.header-context { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); }
.icon-button:hover { border-color: var(--border); background: var(--surface-soft); color: var(--text); }
.profile-mark { width: 29px; height: 29px; border-radius: 50%; font-size: 12px; font-weight: 700; }
.page-wrap { width: min(1320px, 100%); margin: 0 auto; padding: 27px 28px 60px; }

.page-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.page-title h1 { font-size: 23px; line-height: 1.25; }
.page-title p { max-width: 620px; margin-top: 5px; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; white-space: nowrap; }
.button:hover:not(:disabled) { background: var(--surface-soft); }
.button-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button-primary:hover:not(:disabled) { border-color: var(--accent-strong); background: var(--accent-strong); }
.button:disabled { cursor: not-allowed; opacity: .55; }

.panel, .metric, .empty-panel, .billing-notice, .plan-card { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgb(16 24 40 / 3%); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric { min-height: 130px; padding: 16px; }
.metric > span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.metric strong { display: block; margin: 8px 0 3px; font-size: 23px; font-variant-numeric: tabular-nums; }
.metric small { color: var(--subtle); font-size: 12px; }
.metric small.is-warning { color: var(--warning); }
.two-column { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 14px; }
.panel { padding: 17px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h2, .plan-card h2 { font-size: 15px; }
.panel-head p, .billing-panel p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.text-link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-strong); font-size: 12px; font-weight: 700; }
.empty-panel { display: grid; justify-items: center; padding: 58px 22px; text-align: center; }
.empty-panel svg { color: var(--accent); }
.empty-panel h2 { margin-top: 12px; font-size: 16px; }
.empty-panel p { max-width: 390px; margin: 6px 0 17px; color: var(--muted); }
.empty-copy { padding: 12px 0 4px; color: var(--muted); }
.attention-list { display: grid; }
.attention-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); color: var(--warning); }
.attention-row:last-child { border-bottom: 0; }
.attention-row span { display: grid; min-width: 0; gap: 1px; flex: 1; color: var(--text); }
.attention-row small { color: var(--muted); }

.data-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 0 10px 9px; border-bottom: 1px solid var(--border-strong); color: var(--muted); font-size: 11px; text-align: left; text-transform: uppercase; }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-soft); }
.cell-strong { font-weight: 700; }
.muted { color: var(--muted); }
.table-sub { display: block; margin-top: 2px; color: var(--subtle); font-size: 11px; font-weight: 400; }
.table-action { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-strong); font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-badge { display: inline-flex; align-items: center; width: max-content; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-badge.is-success { background: var(--success-soft); color: var(--success); }
.status-badge.is-warning { background: var(--warning-soft); color: var(--warning); }
.status-badge.is-danger { background: var(--danger-soft); color: var(--danger); }
.status-badge.is-accent { background: var(--accent-soft); color: var(--accent-strong); }
.status-badge.is-neutral { background: #eef1f5; color: var(--muted); }

.dialog-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgb(16 24 40 / 48%); }
.dialog { width: min(540px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.dialog > header, .dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.dialog header h2 { font-size: 16px; }
.dialog header p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.dialog footer { justify-content: flex-end; border-top: 1px solid var(--border); border-bottom: 0; }
.dialog-body { padding: 18px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 12px; font-weight: 700; }
.field em { color: var(--subtle); font-size: 11px; font-style: normal; font-weight: 400; }
.field small { color: var(--subtle); font-size: 11px; line-height: 1.4; }
input, select, textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 7px; padding: 9px 10px; background: var(--surface); color: var(--text); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.form-error { margin: 0; padding: 10px; border: 1px solid #fecaca; border-radius: 7px; background: var(--danger-soft); color: var(--danger); font-size: 12px; }
.check-field { display: flex; align-items: flex-start; gap: 9px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.check-field:last-child { border-bottom: 0; }
.check-field input { width: auto; margin-top: 3px; }
.check-field span { display: grid; gap: 2px; }
.check-field strong { font-size: 13px; }
.check-field small { color: var(--muted); font-size: 11px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.billing-notice { display: flex; gap: 11px; margin-bottom: 14px; padding: 14px 16px; border-color: #cfe0ff; background: var(--accent-soft); color: var(--accent-strong); }
.billing-notice div { display: grid; gap: 2px; }
.billing-notice span { color: #3a5f99; font-size: 12px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.plan-card { display: flex; min-height: 280px; flex-direction: column; justify-content: space-between; gap: 17px; padding: 17px; }
.plan-card p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.plan-card > strong { font-size: 15px; }
.plan-card ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; }
.plan-card li { display: flex; align-items: center; gap: 7px; }
.plan-card li svg { color: var(--success); }
.plan-state { color: var(--subtle); font-size: 11px; }
.billing-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; }
.settings-form { display: grid; gap: 14px; max-width: 740px; }
.form-panel { padding: 18px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.site-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .9fr); gap: 14px; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list div { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1.4fr); gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); }
.detail-list dt { color: var(--muted); font-size: 12px; }
.detail-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.mono-value { font-family: Consolas, "Courier New", monospace; font-size: 12px; font-weight: 400 !important; }
.action-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.action-stack .button { width: 100%; }
.button-danger { border-color: #fecaca; color: var(--danger); }
.button-danger:hover:not(:disabled) { background: var(--danger-soft); }
.note-panel { display: flex; align-items: flex-start; gap: 11px; margin-top: 14px; }
.note-panel > svg { flex: 0 0 auto; color: var(--accent); }
.note-panel h2 { font-size: 14px; }
.note-panel p { margin-top: 3px; color: var(--muted); font-size: 12px; }

.auth-error { margin: -4px 0 16px; padding: 9px 11px; border: 1px solid var(--danger); border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 12px; }

@media (max-width: 1000px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .two-column, .site-summary { grid-template-columns: 1fr; } .plan-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .sidebar { transform: translateX(-100%); transition: transform .18s ease; } .sidebar.is-open { transform: translateX(0); } .sidebar-scrim { position: fixed; inset: 0; z-index: 19; display: none; border: 0; background: rgb(16 24 40 / 36%); } .sidebar-scrim.is-open { display: block; } .sidebar-close, .menu-button { display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); } .sidebar-close { margin-left: auto; } .app-main { margin-left: 0; } .app-header { padding: 0 16px; } .page-wrap { padding: 20px 16px 45px; } .page-title { align-items: flex-start; flex-direction: column; } .billing-panel { align-items: flex-start; flex-direction: column; } }
@media (max-width: 500px) { .metric-grid, .action-stack { grid-template-columns: 1fr; } .page-title h1 { font-size: 21px; } .dialog-backdrop { padding: 10px; } .dialog > header, .dialog footer, .dialog-body { padding: 14px; } th, td { padding-right: 8px; padding-left: 8px; } .detail-list div { grid-template-columns: 1fr; gap: 2px; } }
