:root {
  color-scheme: light;
  --bg: #fff;
  --panel: #fff;
  --side: #f3f4f6;
  --text: #242a32;
  --muted: #626b77;
  --line: #d7dce2;
  --accent: #24558a;
  --accent-text: #fff;
  --soft: #edf3fa;
  --danger: #a32929;
  --danger-bg: #fff3f3;
  --warn: #805719;
  --warn-bg: #fff9eb;
  font: 14px/1.45 Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--accent); text-underline-offset: 2px; }
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.3; font-weight: 600; }
h2 { font-size: 16px; line-height: 1.35; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
strong { font-weight: 600; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 18px; }
.stack-sm { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow-wrap: anywhere; }
.skip-link {
  position: absolute; top: -100px; left: 12px;
  padding: 10px; background: #fff; z-index: 100;
}
.skip-link:focus { top: 8px; }
.initial { padding: 60px 24px; text-align: center; }
.initial p { margin-top: 12px; color: var(--muted); }
.brand { font-size: 17px; font-weight: 700; color: #263b53; }
.shell { min-height: 100dvh; display: grid; grid-template-columns: 202px minmax(0, 1fr); }
.sidebar {
  display: flex; flex-direction: column; gap: 18px;
  background: var(--side); border-right: 1px solid var(--line);
}
.sidebar-head {
  min-height: 58px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; border-bottom: 1px solid var(--line);
}
.nav { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; }
.nav button {
  text-align: left; color: #394554; background: transparent;
  border: 0; border-left: 3px solid transparent; border-radius: 0;
  padding: 8px 10px; font-size: 13px; line-height: 1.4;
}
.nav button:hover { background: #e9edf1; }
.nav button[aria-current="page"] {
  color: #194a7d; background: #e2eaf3; border-left-color: var(--accent); font-weight: 700;
}
.nav-label { padding: 20px 13px 6px; font-size: 11px; font-weight: 700; color: #697382; }
.nav-toggle { display: none !important; }
.sidebar-footer {
  margin-top: auto; border-top: 1px solid var(--line);
  padding: 14px 18px; font-size: 11px; color: var(--muted);
}
.main-shell { min-width: 0; }
.topbar {
  min-height: 58px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding: 9px 24px; border-bottom: 1px solid var(--line);
  background: #fafbfc;
}
.topbar .field { display: flex; align-items: center; gap: 9px; margin: 0; }
.topbar .field > span { white-space: nowrap; }
.topbar select { min-width: 170px; max-width: 300px; padding: 5px 28px 5px 8px; }
.identity { font-size: 11px; max-width: 270px; color: var(--muted); overflow-wrap: anywhere; }
.content { width: 100%; padding: 24px; display: grid; gap: 18px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-header p { margin-top: 5px; font-size: 13px; color: var(--muted); max-width: 780px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 11px; min-height: 32px; border: 1px solid #b8c0ca; border-radius: 3px;
  background: #f7f8fa; text-decoration: none; font-size: 13px; font-weight: 400; white-space: nowrap;
}
.btn:hover:enabled { background: #e9edf2; border-color: #8e9bac; }
.btn.primary { background: var(--accent); border-color: #204c7c; color: #fff; }
.btn.primary:hover:enabled { background: #1b4775; border-color: #193e66; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.small { font-size: 12px; min-height: 28px; padding: 4px 8px; }
.panel { min-width: 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 2px; }
.panel > h2, .panel > h3 {
  margin: -16px -16px 16px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: #f5f6f8;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.summary-bar {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: #f5f6f8; font-size: 12px; color: var(--muted);
}
.summary-bar strong { color: var(--text); font-variant-numeric: tabular-nums; }
.data-panel { padding: 0; }
.data-panel > .empty { padding: 24px 16px; }
.data-panel .table-wrap { border: 0; border-radius: 0; }
.data-panel .panel-footer { padding: 10px 14px; border-top: 1px solid var(--line); background: #fafbfc; }
.panel-footer .hint { max-width: 620px; }
.empty { display: grid; gap: 6px; padding: 18px 0; font-size: 13px; color: var(--muted); }
.empty h2, .empty h3 { color: var(--text); }
.notice, .error, .success {
  padding: 10px 12px; border: 1px solid #e1d6b7; border-left: 3px solid #aa852d;
  border-radius: 2px; background: var(--warn-bg); color: #685024;
  font-size: 13px; overflow-wrap: anywhere;
}
.error { background: var(--danger-bg); color: var(--danger); border-color: #e7bebe; border-left-color: var(--danger); }
.success { background: #f1f7f1; color: #315d3a; border-color: #c5d9c8; border-left-color: #4e7b56; }
.status {
  display: inline-block; padding: 2px 5px; border: 1px solid #d9cba9; border-radius: 2px;
  font-size: 11px; line-height: 1.4; font-weight: 400; white-space: nowrap;
  color: var(--warn); background: var(--warn-bg);
}
.status.good { color: #326342; background: #f1f7f2; border-color: #c5d7ca; }
.status.bad { color: var(--danger); background: var(--danger-bg); border-color: #e0c0c0; }
.status.neutral { color: #5e6875; background: #f3f4f6; border-color: #d6dbe1; }
.field { display: grid; gap: 5px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea, input.control, select.control {
  width: 100%; min-height: 34px; padding: 6px 8px;
  border: 1px solid #b8c0ca; border-radius: 2px; background: #fff;
}
.field textarea { min-height: 86px; resize: vertical; }
.hint, .field .hint { font-size: 12px; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field-grid .full { grid-column: 1/-1; }
.check { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
form { display: grid; gap: 14px; }
.required { color: var(--muted); font-weight: 400; }
.table-wrap { min-width: 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 2px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 11px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { font-size: 12px; font-weight: 600; color: #495361; background: #f4f5f7; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:hover { background: #f0f4f8; }
td .small { display: block; margin-top: 3px; }
td.actions { width: 1%; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.connections-table { min-width: 720px; }
.connections-table .account-cell { min-width: 180px; max-width: 280px; overflow-wrap: anywhere; }
.connections-table .date-cell { min-width: 155px; }
.connections-table .source-cell { min-width: 120px; }
.connections-table td { height: 57px; }
.connections-table td.actions .row { flex-wrap: nowrap; }
.mobile-table-hint { display: none; }
.list { display: grid; }
.list-item { padding: 11px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.list-item:last-child { border-bottom: 0; }
.list-item .actions { margin-left: auto; }
.detail-grid { display: grid; grid-template-columns: 140px minmax(0,1fr); gap: 8px 14px; font-size: 13px; margin: 0; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-top: 12px; }
code, pre { font-family: Consolas, "Liberation Mono", monospace; font-size: 12px; }
pre { margin: 0; padding: 12px; background: #f5f6f8; border: 1px solid var(--line); border-radius: 2px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.secret { padding: 12px; background: #f5f6f8; border: 1px solid var(--line); border-radius: 2px; word-break: break-all; font-family: Consolas, monospace; user-select: all; }
.auth-wrap { min-height: 100dvh; background: #f3f4f6; }
.auth-intro {
  height: 64px; padding: 0 28px; display: flex; align-items: center; gap: 20px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.auth-intro p { padding-left: 20px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.auth-card-wrap { padding: 58px 20px 24px; }
.auth-card { width: 100%; max-width: 420px; margin: 0 auto; padding: 24px; display: grid; gap: 18px; border: 1px solid #cbd1d9; border-radius: 2px; background: #fff; }
.auth-card header { display: grid; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.auth-card header h1 { font-size: 20px; }
.auth-card header p { color: var(--muted); font-size: 13px; }
.auth-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.auth-links button { padding: 0; min-height: 28px; background: transparent; border: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.auth-footer { padding: 0 20px 24px; text-align: center; font-size: 12px; color: var(--muted); }
.loading { display: flex; align-items: center; gap: 10px; padding: 22px 0; color: var(--muted); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.divider { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 6px 0; }
.dialog-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: #17212c66; z-index: 30; }
.dialog { width: min(100%,590px); max-height: calc(100dvh - 48px); padding: 20px; overflow: auto; background: #fff; border: 1px solid #8e9aa8; border-radius: 3px; box-shadow: 0 5px 18px #17212c2b; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -20px -20px 18px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #f3f4f6; }
.banner-group { display: grid; gap: 8px; }
.inset { padding-top: 12px; }
.kbd { font: 12px Consolas, monospace; border: 1px solid var(--line); border-radius: 2px; padding: 1px 4px; }
.tab-strip { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.tab-strip .btn[aria-pressed="true"] { color: var(--accent); background: var(--soft); border-color: #a1b7d0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
@media (max-width: 980px) {
  .shell { grid-template-columns: 186px minmax(0,1fr); }
  .sidebar-head { padding: 0 13px; }
  .content { padding: 20px; }
  .topbar { padding: 9px 20px; }
  .grid { grid-template-columns: 1fr; }
  .topbar .identity { max-width: 180px; }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { gap: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-head { min-height: 52px; padding: 8px 14px; border-bottom: 0; }
  .nav-toggle { display: inline-flex !important; }
  .nav { display: none; padding: 4px 8px 12px; border-top: 1px solid var(--line); }
  .nav[data-open="true"] { display: flex; }
  .nav button { min-height: 38px; }
  .nav-label { padding-top: 14px; }
  .sidebar-footer { display: none; }
  .topbar { display: grid; grid-template-columns: minmax(0,1fr); gap: 9px; padding: 10px 14px; }
  .topbar .field { display: grid; grid-template-columns: 88px minmax(0,1fr); gap: 8px; }
  .topbar select { width: 100%; min-width: 0; max-width: none; }
  .topbar > .row { justify-content: space-between; }
  .topbar .identity { flex: 1; min-width: 0; max-width: none; }
  .identity br { display: none; }
  .identity .identity-email { display: none; }
  .content { padding: 18px 14px; gap: 16px; }
  h1 { font-size: 21px; }
  .page-header { align-items: flex-start; }
  .page-header p { font-size: 12px; }
  .panel { padding: 14px; }
  .panel > h2, .panel > h3 { margin: -14px -14px 14px; padding: 9px 14px; }
  .data-panel { padding: 0; }
  .summary-bar { gap: 6px 16px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .full { grid-column: auto; }
  .detail-grid { grid-template-columns: 1fr; gap: 4px; }
  .detail-grid dd { margin-bottom: 6px; }
  .auth-intro { padding: 0 18px; height: 58px; }
  .auth-intro p { display: none; }
  .auth-card-wrap { padding: 28px 16px 20px; }
  .auth-card { padding: 20px; }
  .dialog-backdrop { padding: 12px; }
  .dialog { padding: 16px; max-height: calc(100dvh - 24px); }
  .dialog-header { margin: -16px -16px 16px; padding: 9px 12px; }
  th, td { padding: 9px 10px; }
  .mobile-table-hint { display: block; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
}
@media (pointer: coarse) {
  .btn, .nav button, .auth-links button { min-height: 44px; }
  input, textarea, select { font-size: 16px; }
}
