/* Shared workspace appearance. admin.css supplies the component layouts. */
.catalog-notice, .health-freshness-warning {
  color: #75490c;
  background: #fff4d9;
  border: 1px solid #f0d79b;
  border-radius: 9px;
  font-size: 13px;
  padding: 9px 12px;
  margin: 0 0 12px;
}
.catalog-notice { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.catalog-notice[hidden], .health-freshness-warning[hidden], #create-node-options[hidden] { display:none; }
#create-node-count { color:var(--muted); font-size:12px; }
#view-health[data-freshness="stale"] :is(.health-metrics,.cluster-routes-panel,.certificate-list) { filter:grayscale(1); }
:root {
  --canvas: #f3f6fa;
  --surface: #fff;
  --surface-soft: #f5f7fb;
  --ink: #16233a;
  --muted: #536279;
  --line: #d7dfe9;
  --line-soft: #e7ecf3;
  --accent: #2256b6;
  --accent-soft: #eaf1ff;
  --blue: var(--accent);
  --blue-dark: #194590;
  --download-series: #2977c7;
  --upload-series: #087e76;
  --success: #166a47;
  --warning: #895500;
  --danger: #af383f;
  --control-radius: 9px;
  --card-radius: 16px;
  --card-shadow: 0 1px 3px rgb(27 45 77 / 4%);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-family: var(--sans);
}
html, body { min-width: 0; background: var(--canvas); color: var(--ink); }
body, button, input, select, textarea { font-family: var(--sans); }
button, .button-secondary, select, input:not([type="checkbox"]):not([type="radio"]) {
  border-width: 1px;
  border-radius: var(--control-radius);
  box-shadow: none;
}
button { transition: background-color 130ms, border-color 130ms, color 130ms; }
button:hover, button:active { transform: none; box-shadow: none; }
.button-secondary { color: #374a66; border-color: var(--line); background: var(--surface); }
.button-secondary:hover { background: var(--surface-soft); border-color: #aebed4; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button:disabled { cursor: not-allowed; }
input:focus, select:focus { border-color: var(--accent); outline-color: #a7c3f3; }
#show-create, #login-submit, .form-actions > button[type="submit"]:not(.button-danger) {
  background: var(--accent);
  border-color: var(--accent);
}
#show-create:hover, #login-submit:hover, .form-actions > button[type="submit"]:not(.button-danger):hover {
  background: var(--blue-dark);
}

/* The masthead and the task tabs occupy distinct levels. The tabs can stay
   in reach while long account lists and charts scroll beneath them. */
.topbar {
  position: static;
  border: 0;
  min-height: 62px;
  padding: 10px max(clamp(16px, 3vw, 40px), calc((100vw - 1420px) / 2));
  color: #f4f7ff;
  background: #162942;
  gap: 10px;
}
.topbar .brand { flex: 1; display: flex; flex-direction: row; align-items: center; gap: 10px; }
.topbar .brand::before {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(to top, #fff, #fff) 6px 12px / 3px 8px no-repeat,
              linear-gradient(to top, #fff, #fff) 12px 7px / 3px 13px no-repeat,
              linear-gradient(to top, #fff, #fff) 18px 10px / 3px 10px no-repeat, #4777cc;
}
.topbar .brand h1 { color: #fff; font: 750 24px/1 var(--sans); letter-spacing: -.05em; }
.topbar .brand .brand-context {
  border-left: 1px solid #53687f;
  padding-left: 10px;
  color: #cfdaeb;
  font: 500 13px/1.35 var(--sans);
  letter-spacing: .035em;
}
.topbar .button-secondary {
  min-height: 34px;
  padding: 6px 12px;
  color: #e5edfc;
  background: #263c57;
  border-color: #455a74;
}
.topbar .button-secondary:hover { background: #324c6a; }
.topbar button:focus-visible { outline-color: #b3d2ff; }
.page-shell { width: min(calc(100% - clamp(24px, 6vw, 80px)), 1420px); padding: 0 0 48px; }
.workspace-bar {
  z-index: 15;
  top: 0;
  gap: 12px;
  padding: 12px 0;
  margin: 0 0 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: rgb(243 246 250 / 96%);
}
.workspace-bar .toolbar { flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 0; box-shadow: none; }
.workspace-bar .toolbar button { min-height: 34px; padding: 6px 13px; }
.status { color: var(--muted); font: 500 12px/1.5 var(--sans); }
.status::before { border-radius: 50%; box-shadow: none; }
.section-nav { display: flex; gap: 3px; flex: none; }
.section-nav button {
  min-height: 40px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--control-radius);
  color: var(--muted);
  font: 650 14px/1.3 var(--sans);
}
.section-nav button:hover { background: #e5ecf5; color: var(--ink); }
.section-nav button.active { background: #203853; color: white; }
.workspace-help[aria-pressed="true"], .workspace-help[aria-expanded="true"] { background: var(--accent-soft); border-color: #91aede; color: var(--accent); }
.help-navigation, .insights-nav { margin-bottom: 16px; }

.panel, .framed, .summary-grid, .metric-strip,
dialog.editor-dialog, dialog.subscription-dialog, dialog.confirm-dialog, dialog.qr-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  backdrop-filter: none;
}
.panel { padding: clamp(16px, 2vw, 28px); margin-top: 16px; }
.view-pane > .panel:first-child { margin-top: 0; }
.section-heading h2, .breakdown-heading h2 { line-height: 1.3; }
.chart-heading h2, .account-section-head h2 { margin: 0; font: 720 clamp(21px, 2vw, 28px)/1.25 var(--sans); letter-spacing: -.035em; }
.compact-heading h2, .breakdown-heading h2 { font-size: 19px; }
.login-shell { min-height: calc(100dvh - 62px); }
.login-shell .login-card { width: min(400px, 100%); border-radius: 20px; padding: 30px; }
.login-card label, .login-card > small, .dialog-description, .tutorial-grid p { font: 400 13px/1.6 var(--sans); }
.login-card h2 { font-size: 26px; margin: 0; }

.account-section-head { margin-bottom: 20px; }
.account-section-head p { font-size: 12px; margin-top: 5px; }
.account-section-head h2 span {
  display: inline-block;
  margin-inline-start: 4px;
  padding: 2px 9px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font: 650 14px/1.5 var(--sans);
  vertical-align: middle;
}
.account-actions { justify-content: flex-end; gap: 7px; }
.account-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 210px) minmax(110px, 158px);
  align-items: end;
  gap: 12px;
  margin-bottom: 13px;
}
.account-toolbar .account-filter-list { grid-column: 1; grid-row: 1; }
.account-toolbar .search-field { grid-column: 2; grid-row: 1; }
.account-toolbar .account-sort { grid-column: 3; grid-row: 1; }
.account-toolbar label { min-width: 0; font: 550 12px/1.4 var(--sans); color: var(--muted); }
.account-toolbar input, .account-toolbar select { min-width: 0; min-height: 36px; }
.account-filter-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}
.account-filter-list button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 9px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.account-filter-list button:hover { background: var(--surface-soft); color: var(--ink); }
.account-filter-list button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.account-filter-list [data-filter-count] { font: 650 11px/1.5 var(--mono); font-variant-numeric: tabular-nums; }
.table-scroll { scrollbar-color: #b7c6d8 transparent; }
.account-table { min-width: 920px; }
.account-table td, .account-table th { border-color: var(--line-soft); }
.account-table td { height: 68px; padding: 12px 10px; font-size: 13px; }
.account-table th, .tokyo-table th {
  padding: 10px;
  color: var(--muted);
  background: var(--surface-soft);
  font: 650 12px/1.4 var(--sans);
  letter-spacing: 0;
}
.account-table th:first-child, .tokyo-table th:first-child { border-radius: 8px 0 0 8px; }
.account-table th:last-child, .tokyo-table th:last-child { border-radius: 0 8px 8px 0; }
body tbody tr:hover { background: #f7faff; }
.account-name-cell > strong { font: 670 15px/1.35 var(--sans); overflow-wrap: anywhere; }
.account-table .last-used-cell, .account-table td:nth-child(4) { font: 500 12px/1.45 var(--sans); font-variant-numeric: tabular-nums; }
.account-usage-values { gap: 4px 12px; flex-wrap: wrap; margin-bottom: 6px; }
.value-pair dt { font-size: 10px; }
.value-pair dd { font-size: 12px; }
.usage-bar, .usage-rank-bar, .probe-budget-track { border-radius: 8px; background: #e8edf5; }
.usage-bar i, .usage-rank-bar i, .probe-budget-track i { border-radius: inherit; }
.badge, .cluster-state-badge { border-radius: 999px; letter-spacing: 0; padding: 3px 8px; font: 650 11px/1.45 var(--sans); }
.badge { border: 0; background: #eaf0f6; color: #435572; }
.badge-active { color: #155c43; background: #def4e9; }
.badge-node-sync-pending, .badge-deletion-pending { color: #805203; background: #fff1cd; }
.badge-expired, .badge-quota_exceeded, .badge-deletion-error { color: #96363d; background: #ffeaeb; }
.account-routes summary, .account-inline-actions .account-pill, .account-inline-actions .action-menu summary {
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: #394c68;
  min-height: 32px;
  padding: 5px 9px;
  font: 570 12px/1.4 var(--sans);
}
.account-routes summary { min-height: 25px; margin: 4px 0 0; border: 0; color: var(--accent); background: var(--accent-soft); }
.account-routes summary::after {
  content: "";
  width: 5px;
  height: 5px;
  margin: -2px 1px 0 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.account-routes[open] summary { margin-bottom: 6px; }
.account-routes[open] summary::after { margin-top: 3px; transform: rotate(225deg); }
.account-routes > label { grid-template-columns: auto minmax(0, 1fr); padding: 3px 0; }
.account-routes small { grid-column: 2; margin: -6px 0 1px; color: var(--muted); }
.account-routes small[hidden] { display: none; }
.account-routes summary:hover, .account-inline-actions .account-pill:hover, .account-inline-actions .action-menu summary:hover { background: var(--accent-soft); }
.action-menu-popover { border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 4px 15px rgb(27 45 77 / 8%); }
.action-menu-popover button { border: 0; }
.account-inline-actions { align-items: center; }
.account-routes summary:focus-visible, .account-inline-actions :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input.setting-switch[type="checkbox"] {
  appearance: none;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  width: 40px;
  min-width: 40px;
  height: 24px;
  min-height: 24px;
  border: 1px solid #77869b;
  border-radius: 24px;
  background: #77869b;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: background-color 150ms, border-color 150ms;
}
input.setting-switch::after {
  content: "";
  position: absolute;
  inset: 2px auto auto 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(18 35 61 / 22%);
  transition: transform 150ms;
}
input.setting-switch:checked::after { transform: translateX(16px); }
input.setting-switch:checked { background: #198451; border-color: #198451; }
input.setting-switch[data-phase="pending"] { background: #9b660e; border-color: #9b660e; }
input.setting-switch[data-phase="unknown"], input.setting-switch[data-phase="unavailable"] { background: #78869a; border-color: #78869a; }
input.setting-switch[data-phase="draft"]:checked { background: var(--accent); border-color: var(--accent); }
input.setting-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input.setting-switch:disabled { cursor: not-allowed; }
.operation-status {
  position: fixed;
  z-index: 1100;
  inset-block-start: max(12px, env(safe-area-inset-top));
  inset-inline-end: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(84vw, 420px);
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 5px 18px rgb(24 43 73 / 14%);
  font-size: 13px;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.operation-status[hidden] { display: none; }
.operation-status::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--success); }
.operation-status[data-phase="busy"]::before { background: var(--accent); animation: getsub-pulse 1s ease-in-out infinite alternate; }
.operation-status[data-phase="error"]::before { background: var(--danger); }
@keyframes getsub-pulse { to { opacity: .4; } }

.segmented-control, .tokyo-view-toggle {
  gap: 3px;
  border: 0;
  border-radius: 10px;
  background: #eaf0f6;
  padding: 3px;
}
.segmented-control button, .tokyo-view-toggle button {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 570 12px/1.35 var(--sans);
}
.segmented-control button.active, .tokyo-view-toggle button.active { background: white; color: var(--accent); box-shadow: 0 1px 3px rgb(30 54 88 / 12%); }
.segmented-control button:hover:not(.active), .tokyo-view-toggle button:hover:not(.active) { background: #e0e8f2; }
.insights-nav.segmented-control { background: transparent; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; gap: 16px; }
.insights-nav.segmented-control button { border: 0; border-radius: 0; border-bottom: 2px solid transparent; min-height: 40px; font-size: 14px; padding: 7px 2px; }
.insights-nav.segmented-control button.active { border-color: var(--accent); color: var(--accent); background: transparent; box-shadow: none; }
.tokyo-view-toggle { width: fit-content; max-width: 100%; }
.tokyo-table-wrap { padding: 9px; }
.tokyo-table td { font-size: 13px; border-color: var(--line-soft); }
.pane-actions { margin-bottom: 12px; }
.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}
.metric-strip article, .metric-strip article + article {
  min-width: 0;
  padding: clamp(14px, 1.7vw, 22px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}
.metric-strip span, .metric-strip small { font: 550 12px/1.4 var(--sans); color: var(--muted); letter-spacing: 0; }
.metric-strip strong {
  margin: 6px 0 3px;
  font: 700 clamp(22px, 2.2vw, 34px)/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
}
.traffic-summary article:first-child { color: white; background: #213c60; border-color: #213c60; }
.traffic-summary article:first-child :is(strong,span) { color: #fff; }
.traffic-summary article:nth-child(2) strong { color: var(--download-series); }
.traffic-summary article:nth-child(3) strong { color: var(--upload-series); }
.direction-share { display: block; height: 4px; max-width: 150px; margin: 8px 0 3px; border-radius: 4px; background: #e4ebf5; overflow: hidden; }
.direction-share i { display: block; height: 100%; border-radius: inherit; background: var(--download-series); }
.direction-detail[data-direction="upload"] .direction-share i { background: var(--upload-series); }
.chart-panel .chart-wrap, .chart-wrap { background: var(--surface); border-radius: 9px; }
.chart-legend-item, .chart-tooltip, .chart-legend { font: 500 12px/1.45 var(--sans); }
.chart-legend-item { border-radius: 7px; }
.chart-legend-item:hover { border-color: var(--line); background: var(--surface-soft); }
.chart-tooltip { border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 7px 20px rgb(25 44 76 / 13%); }
.usage-rank-row { border-radius: 6px; }
.usage-rank-row.usage-selected { background: var(--accent-soft); }
.usage-detail { background: #f4f8ff; border-radius: 6px; }
.usage-trend { border-top: 1px solid var(--line-soft); margin-top: 16px; }
.usage-trend h4 { font-size: 14px; }
.cluster-route-card { border-radius: 12px; background: var(--surface-soft); }
.cluster-route-card h3 { margin: 12px 0; }
.cluster-route-card dl { font-size: 12px; }
.cluster-route-card p, .freshness-note, .cluster-empty { font: 500 12px/1.5 var(--sans); }
.cluster-event i { border-radius: 50%; }
.tutorial-grid p, .certificate-row span { font: 400 13px/1.6 var(--sans); }
.software-panel .software-download-link { background: var(--accent); color: white; border: 0; border-radius: 9px; box-shadow: none; }
dialog::backdrop { background: rgb(21 36 58 / 40%); }
.editor-dialog .account-form, .confirm-dialog form { background: var(--surface); }
.editor-dialog .account-form > label, .node-access-fieldset legend, .confirm-dialog label { font: 550 13px/1.5 var(--sans); }
.node-access-fieldset, .node-access-grid label, .subscription-dialog code { border: 1px solid var(--line); border-radius: 9px; }
.subscription-dialog code { background: var(--surface-soft); }
.dialog-head strong { font-size: 20px; }

/* Mobile actions follow each account, keeping authorizations, dates and
   destructive confirmations accessible without sideways table scrolling. */
@media (max-width: 1000px) {
  .account-toolbar { grid-template-columns: minmax(130px, 1fr) minmax(130px, 200px); }
  .account-toolbar .account-filter-list { grid-column: 1/-1; grid-row: 1; }
  .account-toolbar .search-field { grid-column: 1; grid-row: 2; }
  .account-toolbar .account-sort { grid-column: 2; grid-row: 2; }
}
@media (max-width: 820px) {
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-table { width: 100%; min-width: 0; }
  .account-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .account-table tbody { display: grid; gap: 10px; }
  .account-table tr {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    grid-template-areas: "name status" "usage usage" "recent expiry" "actions actions";
    gap: 9px 12px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px;
  }
  .account-table td { min-width: 0; width: auto; height: auto; white-space: normal; border: 0; padding: 0; }
  .account-table td:first-child { grid-area: name; }
  .account-table td:nth-child(2) { grid-area: usage; }
  .account-table td:nth-child(3) { grid-area: recent; }
  .account-table td:nth-child(4) { grid-area: expiry; }
  .account-table td:nth-child(5) { grid-area: status; justify-self: end; text-align: end; }
  .account-table td:nth-child(6) { grid-area: actions; border-top: 1px solid var(--line-soft); padding-top: 9px; }
  .account-table td:nth-child(3)::before, .account-table td:nth-child(4)::before { display: block; color: var(--muted); font-size: 10px; }
  .account-table td:nth-child(3)::before { content: "最近使用"; }
  .account-table td:nth-child(4)::before { content: "到期"; }
  .account-table td[colspan] { grid-column: 1/-1; grid-row: 1; }
  .account-table tr:has(td[colspan]) { display: block; }
  .account-table tr:has(.account-routes[open]) { grid-template-areas: "status status" "name name" "usage usage" "recent expiry" "actions actions"; }
  .account-table .account-inline-actions .account-pill,
  .account-table .account-inline-actions .action-menu summary,
  .account-routes summary { min-height: 36px; }
  .account-routes > label { min-height: 40px; }
  .account-usage-values { overflow: visible; }
  .account-section-head { align-items: flex-start; }
}
@media (max-width: 680px) {
  .topbar { padding: 10px 14px; min-height: 54px; }
  .page-shell { width: calc(100% - 20px); }
  .workspace-bar { position: static; flex-direction: column; align-items: stretch; gap: 7px; padding: 9px 0; margin-bottom: 12px; }
  .section-nav { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .section-nav button { width: 100%; min-width: 0; min-height: 42px; padding-inline: 4px; }
  .workspace-bar .toolbar { justify-content: flex-end; }
  .workspace-bar .toolbar .status { flex: 1; }
  .panel { padding: 15px; margin-top: 12px; }
  .account-section-head { gap: 10px; margin-bottom: 12px; }
  .account-actions { justify-content: flex-start; }
  .account-toolbar { gap: 9px; grid-template-columns: 1fr 1fr; }
  .account-filter-list { gap: 3px; }
  .account-filter-list button { gap: 3px; padding: 5px 7px; }
  .account-actions button { min-height: 36px; padding: 7px 9px; font-size: 12px; }
  .chart-heading { gap: 10px; }
  .chart-heading h2 { font-size: 23px; }
  .chart-legend-item, .segmented-control button { min-height: 36px; }
  .metric-strip { gap: 7px; }
  .metric-strip strong { font-size: 22px; }
  .tokyo-controls, .tokyo-controls label, .tokyo-controls select { min-width: 0; }
  .tokyo-controls { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .tokyo-table-wrap { padding: 6px; }
  .tokyo-pagination { flex-wrap: wrap; gap: 6px; }
}
@media (max-width: 620px) {
  html.pwa-standalone body { background: var(--canvas); }
  html.pwa-standalone .topbar { color: var(--ink); background: #162942; }
  html.pwa-standalone .brand h1 { color: white; font-size: 22px; }
  html.pwa-standalone .brand { gap: 7px; flex-direction: row; align-items: center; }
  html.pwa-standalone .topbar > #logout { color: var(--ink); }
  html.pwa-standalone .section-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html.pwa-standalone .section-nav button.active,
  html.pwa-standalone .section-nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
  html.pwa-standalone .chart-heading h2 { font-size: 24px; }
  html.pwa-standalone .workspace-bar .toolbar { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .operation-status::before, input.setting-switch, input.setting-switch::after { animation: none; transition: none; }
}
