
.startup-progress {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: rgba(10, 28, 52, 0.78);
  color: #f8fbfc;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.startup-progress.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Security setup uses the shared app dialog before startup has completed. */
#appDialog {
  z-index: 3100;
}

.startup-progress-card {
  display: grid;
  grid-template-columns: 56px minmax(320px, 520px);
  gap: 18px;
  width: min(640px, calc(100vw - 48px));
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md, 8px);
  background: #132b4c;
  box-shadow: 0 24px 80px rgba(3, 20, 40, 0.38);
}

.startup-progress-card .brand-mark {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

.startup-progress-copy h1,
.startup-progress-copy p {
  margin: 0;
}

.startup-progress-copy h1 {
  font-size: 24px;
  line-height: 1.2;
}

.startup-progress-copy p {
  color: #cbd6dc;
  font-size: 15px;
}

.startup-progress-track {
  height: 14px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.startup-progress-bar {
  height: 100%;
  width: 8%;
  border-radius: inherit;
  background: var(--accent, #2468b5);
  transition: width 180ms ease;
}

.startup-progress-percent {
  margin-top: 8px !important;
  color: #e7f0fc !important;
  font-weight: 800;
  text-align: right;
}

.startup-progress-actions {
  grid-column: 2;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 4px;
}

.startup-progress-actions .ghost,
.startup-progress-actions .secondary {
  min-height: 40px;
  border-color: rgba(255, 255, 255, 0.26);
}

.startup-progress-actions .primary {
  border-color: #7eb0e6;
  background: var(--accent, #2468b5);
}

.startup-progress-card.is-error {
  border-color: rgba(214, 108, 118, 0.78);
}

.startup-progress-card.is-error .brand-mark {
  background: #8f2933;
}

.startup-progress-recovery {
  margin-top: 12px !important;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: #dce8f7 !important;
  font-size: 13px !important;
  line-height: 1.45;
}
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f9fbfc;
  --ink: #172027;
  --muted: #66727c;
  --line: #d9e1e7;
  --line-strong: #bdc9d3;
  --accent: #2468b5;
  --accent-dark: #174f91;
  --blue: #2468b5;
  --amber: #a66608;
  --red: #b12e34;
  --green: #157347;
  --sidebar: #18242c;
  --sidebar-soft: #24323b;
  --shadow: 0 10px 28px rgba(20, 30, 38, 0.09);
  --text-primary: var(--ink);
  --text-secondary: var(--muted);
  --surface: var(--panel);
  --surface-subtle: var(--panel-soft);
  --focus-ring: rgba(36, 104, 181, 0.18);
  --radius-sm: 6px;
  --radius-md: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --control-height: 36px;
  --table-row-height: 42px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

body.register-mode .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.register-mode .sidebar,
body.register-mode .topbar {
  display: none;
}

body.register-mode .main {
  display: grid;
  place-items: center;
  padding: 0;
  background: #101820;
}

body.register-mode .view {
  padding: 0;
}

body.register-mode #checkout.view.active {
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--sidebar);
  color: #eef4f5;
  padding: 20px 14px;
  min-height: 0;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p {
  color: #b8c4ca;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #c9d4d9;
  padding: 11px 12px;
  border-radius: 7px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #244e7d;
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  color: #c6d1d7;
  font-size: 13px;
  padding: 10px 8px;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-cache-progress {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(208, 231, 235, 0.22);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-cache-progress.hidden {
  display: none;
}

.sidebar-cache-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #dce9ed;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.sidebar-cache-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-cache-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #5a93d3);
  transition: width 180ms ease;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #39c17b;
}

.app-version {
  color: #91a0a7;
  font-size: 12px;
  font-weight: 800;
}

.main {
  min-width: 0;
  min-height: 0;
  padding: 22px 24px 36px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-pill,
.tag,
.status,
.flag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e8eef2;
  color: #34434d;
  font-size: 12px;
  white-space: nowrap;
}

.status.warn,
.flag.warn {
  background: #fff2d7;
  color: var(--amber);
}

.status.good,
.flag.good {
  background: #dbf5e7;
  color: var(--green);
}

.status.bad,
.flag.bad {
  background: #fde3e5;
  color: var(--red);
}

.view {
  display: none;
}

.view.active {
  display: block;
  height: calc(100vh - 106px);
  min-height: 0;
  overflow: hidden;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.45fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3,
.metric h3 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 16px;
  min-height: 0;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar-left,
.toolbar-right,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search {
  min-width: 260px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink);
  border-radius: 7px;
  padding: 9px 10px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-all {
  grid-column: 1 / -1;
}

.span-two {
  grid-column: span 2;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  max-height: min(58vh, 620px);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 13px;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: #edf3fa;
  color: #38454d;
  font-size: 12px;
  z-index: 1;
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  font-size: inherit;
  font-weight: 800;
}

.table-sort:hover {
  color: var(--accent);
}

tr:hover td {
  background: #f7fafb;
}

tr.selected-row td {
  background: #e8f1fb;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.primary,
.secondary,
.danger,
.ghost {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  min-height: 36px;
  font-weight: 650;
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.primary:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.secondary {
  background: #eaf0f3;
  color: #27343d;
}

.ghost {
  background: #ffffff;
  border-color: var(--line-strong);
  color: #27343d;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  text-align: left;
  font-weight: 800;
  text-decoration: underline;
}

.danger {
  background: #fde6e8;
  color: var(--red);
}

button:focus-visible,
.link-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.list {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 620px);
  overflow: auto;
  padding-right: 2px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.list-item strong {
  display: block;
  margin-bottom: 2px;
}

.split-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 14px;
}

.detail-box {
  display: grid;
  gap: 10px;
}
