/* Towly Console v3 - warm admin theme. No horizontal overflow by design. */
:root {
  --bg: #1B1713;
  --bg-soft: #26211B;
  --bg-raised: #2E2820;
  --bg-hover: #38302a;
  --border: #3D362B;
  --border-soft: #332D23;
  --text: #F4EEE3;
  --text-dim: #B3A893;
  --text-faint: #7E7668;
  --accent: #FF5A1F;
  --accent-soft: rgba(255, 90, 31, 0.12);
  --accent-text: #ff9a5c;
  --onacc: #1B1713;
  --green: #7fb069;
  --green-soft: rgba(127, 176, 105, 0.14);
  --red: #d9685c;
  --red-soft: rgba(217, 104, 92, 0.13);
  --blue: #7aa5d2;
  --blue-soft: rgba(122, 165, 210, 0.14);
  --amber: #FF5A1F;
  --amber-soft: rgba(255, 90, 31, 0.12);
  --sidebar: #14100c;
  --sidebar-active: #2E2820;
  --radius: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --font: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-d: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-m: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
[data-theme="light"] {
  --bg: #FAF7F1;
  --bg-soft: #F4EFE6;
  --bg-raised: #FFFFFF;
  --bg-hover: #EDE6D6;
  --border: #E8E0D2;
  --border-soft: #F0E9DA;
  --text: #211D19;
  --text-dim: #7A7268;
  --text-faint: #A79E90;
  --accent: #FF4D00;
  --accent-soft: rgba(255, 77, 0, 0.08);
  --accent-text: #c2410c;
  --onacc: #FFFFFF;
  --green: #4a7c3a;
  --green-soft: rgba(74, 124, 58, 0.12);
  --red: #b04336;
  --red-soft: rgba(176, 67, 54, 0.1);
  --blue: #2f6db3;
  --blue-soft: rgba(47, 109, 179, 0.1);
  --amber: #FF4D00;
  --amber-soft: rgba(255, 77, 0, 0.08);
  --sidebar: #FFFFFF;
  --sidebar-active: #F4EFE6;
  --shadow: 0 8px 28px rgba(60, 45, 20, 0.12);
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== shell layout ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px;
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
  color: var(--text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px; color: var(--text); font-weight: 700; font-size: 17px;
  font-family: var(--font-d); letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
  background: var(--accent); color: var(--onacc);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px;
}
.nav-section { padding: 10px 12px 4px; }
.nav-label {
  font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-faint); padding: 8px 10px 4px; font-weight: 700;
  font-family: var(--font-m);
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-dim); font-size: 13.5px; font-weight: 500;
  margin: 1px 0;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: var(--text); }
.nav-item .ico { width: 18px; flex: 0 0 18px; display: grid; place-items: center; opacity: 0.85; }
.nav-item .ico svg { width: 15px; height: 15px; display: block; }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--accent); color: var(--onacc);
  border-radius: 20px; padding: 1px 8px;
}
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--border); }
.stack-tag { margin-top: 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); text-align: center; font-family: var(--font-m); }
.tenant-pill {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-hover); border-radius: 8px; padding: 8px 10px;
  color: var(--text); font-size: 13px; cursor: pointer; border: 0; width: 100%; text-align: left;
}
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 26px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
  position: sticky; top: 0; z-index: 30;
}
.topbar .crumb { color: var(--text-faint); font-size: 13px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-raised); color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
#theme-toggle svg { width: 16px; height: 16px; display: block; }
#theme-toggle .ico-moon { display: none; }
[data-theme="light"] #theme-toggle .ico-moon { display: block; }
[data-theme="light"] #theme-toggle .ico-sun { display: none; }
.user-chip {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-raised);
  border-radius: 20px; padding: 4px 12px 4px 4px; color: var(--text);
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px;
  background: var(--accent-soft); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; flex-basis: 40px; }
.content { padding: 26px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ===== page head ===== */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; font-family: var(--font-d); }
.page-head .sub { color: var(--text-dim); margin: 4px 0 0; font-size: 13.5px; max-width: 640px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--text);
  border-radius: 8px; padding: 8px 15px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--onacc); }
.btn.primary:hover { filter: brightness(1.07); color: var(--onacc); }
.btn.danger { background: var(--red-soft); border-color: transparent; color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { color: var(--text); background: var(--bg-hover); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== cards / panels ===== */
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Dashboard two-column panel layout: stacks on narrow screens. */
.dash-panels { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 940px) { .dash-panels { grid-template-columns: minmax(0, 1fr); } }
.card {
  background: var(--bg-raised); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 18px;
}
.card h3 { margin: 0 0 6px; font-size: 14px; }
.stat-num { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.stat-delta { font-size: 12px; margin-top: 6px; }
.up { color: var(--green); } .down { color: var(--red); }
.panel { background: var(--bg-raised); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }

/* ===== tables ===== */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-faint); font-weight: 700; padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft); white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl .rowlink { cursor: pointer; }
.empty { padding: 38px 20px; text-align: center; color: var(--text-faint); }
.empty .big { margin-bottom: 8px; display: grid; place-items: center; }
.empty .big svg { width: 30px; height: 30px; }

/* ===== badges / pills ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; border-radius: 20px; padding: 2px 10px;
  white-space: nowrap;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.dark { background: var(--text); color: var(--bg); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.gray { background: var(--bg-hover); color: var(--text-dim); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ===== tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; color: var(--text-dim); font-weight: 600; font-size: 13.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* ===== forms ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-dim); }
.input, .select, textarea.input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 9px 12px; font-size: 13.5px;
  font-family: inherit;
}
.input:focus, .select:focus, textarea.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea.input { min-height: 90px; resize: vertical; }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.search { position: relative; }
.search .input { padding-left: 34px; }
.search .s-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); display: grid; place-items: center; }
.search .s-ico svg { width: 14px; height: 14px; display: block; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 220px; max-width: 340px; }

/* ===== modal / drawer ===== */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px; overflow-y: auto;
}
.modal {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 14px; width: 100%;
  max-width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal.wide { max-width: min(760px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.modal-head h2 { margin: 0; font-size: 16px; font-family: var(--font-d); }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border-soft); }

/* ===== toasts ===== */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, 90vw); }
.toast .t-ico { display: grid; place-items: center; }
.toast .t-ico svg { width: 15px; height: 15px; }
.toast {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 15px; box-shadow: var(--shadow); font-size: 13.5px;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }

/* ===== detail layout ===== */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-faint); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 24px; font-size: 13px; }
.timeline li::before {
  content: ""; position: absolute; left: 6px; top: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent);
}
.timeline li::after {
  content: ""; position: absolute; left: 9px; top: 18px; bottom: -2px; width: 2px;
  background: var(--border);
}
.timeline li:last-child::after { display: none; }
.timeline .t { color: var(--text-faint); font-size: 12px; }
code.mono, .mono { font-family: var(--font-m); font-size: 12.5px; }
pre.code {
  background: var(--bg); border: 1px solid var(--border-soft); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; font-size: 12.5px; margin: 0;
}
.progress { height: 8px; border-radius: 6px; background: var(--bg-hover); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.conf-bar { display: flex; align-items: center; gap: 10px; }
.conf-bar .progress { flex: 1; }

/* ===== skeletons ===== */
.skel { background: var(--bg-hover); border-radius: 6px; animation: skelpulse 1.3s ease-in-out infinite; }
@keyframes skelpulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; opacity: .7; } }

/* ===== responsive ===== */
.menu-toggle { display: none; }
.menu-toggle svg { width: 17px; height: 17px; }
.t-check { display: inline-grid; place-items: center; vertical-align: -2px; color: var(--accent); }
.t-check svg { width: 13px; height: 13px; }
@media (max-width: 1020px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .menu-toggle { display: inline-flex; }
  .content { padding: 16px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .page-head .actions { margin-left: 0; }
  .topbar { padding: 10px 14px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { margin-top: 8px; }
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
}
.scrim { display: none; }
@media (max-width: 760px) {
  .scrim.on { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 35; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== redesign polish: warm enterprise details ===== */
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tbl-wrap::-webkit-scrollbar, .tabs::-webkit-scrollbar { height: 8px; }
.tbl-wrap::-webkit-scrollbar-thumb, .tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.panel-head h2 { letter-spacing: -0.005em; }
.page-head h1 { font-size: 23px; }
.stat-grid .card { position: relative; overflow: hidden; }
.stat-grid .card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--accent), transparent); opacity: 0.7;
}
.badge { letter-spacing: 0.01em; }
.modal-head h2 { letter-spacing: -0.01em; }
.kv dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }

.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 720px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== shared logo library: brand marks in the applications table ===== */
.app-logo { width: 22px; height: 22px; vertical-align: -6px; margin-right: 8px; border-radius: 4px; background: #fff; }

/* ===== device trust banner: dismissible, no horizontal overflow ===== */
.trust-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--amber-soft); border: 1px solid var(--amber);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px;
  max-width: 100%;
}
.trust-banner .tb-ico svg { width: 24px; height: 24px; color: var(--amber); display: block; }
.trust-banner .tb-text { flex: 1 1 220px; font-size: 14px; min-width: 0; }
.trust-banner .tb-sub { display: block; font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.trust-banner .tb-actions { display: flex; gap: 8px; align-items: center; }

/* ===== one-time key reveal in modals ===== */
.key-reveal { display: flex; gap: 8px; align-items: flex-start; }
.key-reveal pre.code { flex: 1 1 auto; min-width: 0; white-space: pre-wrap; word-break: break-all; }

/* ============================================================
   Towly Console design system v4: component library on warm tokens.
   Buttons, inputs, badges, cards, tables, modals, toasts,
   dropdowns, tabs, breadcrumbs, pagination, tooltips, skeletons,
   empty states, stat widgets, steppers, checklists, feeds.
   ============================================================ */

/* ----- buttons: variants and sizes ----- */
.btn.xs { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn.lg { padding: 12px 22px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; justify-content: center; }
.btn.subtle { background: var(--bg-hover); border-color: transparent; }
.btn.subtle:hover { background: var(--border); }
.btn svg { width: 15px; height: 15px; flex: 0 0 15px; }
.btn .spin, .spin {
  width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.loading { pointer-events: none; opacity: 0.75; }

/* ----- inputs: sizes, groups, validation ----- */
.input.sm, .select.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 7px; }
.input.lg, .select.lg { padding: 12px 14px; font-size: 15px; border-radius: 10px; }
.input::placeholder, textarea.input::placeholder { color: var(--text-faint); }
.input:disabled, .select:disabled, textarea.input:disabled { opacity: 0.55; cursor: not-allowed; }
.field.err .input, .field.err .select, .field.err textarea.input { border-color: var(--red); }
.field .err-msg { display: none; font-size: 12px; color: var(--red); margin-top: 5px; }
.field.err .err-msg { display: block; }
.check, .radio { accent-color: var(--accent); width: 16px; height: 16px; vertical-align: -3px; }
.input-group { display: flex; }
.input-group .input { border-radius: 0; }
.input-group .input:first-child { border-radius: 8px 0 0 8px; }
.input-group .input:last-child { border-radius: 0 8px 8px 0; }
.input-group .btn { border-radius: 0; }
.input-group .btn:last-child { border-radius: 0 8px 8px 0; }
.input-group .btn:first-child { border-radius: 8px 0 0 8px; }
.input-group .ig-add {
  display: inline-flex; align-items: center; padding: 0 12px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-dim);
  font-size: 13px; white-space: nowrap;
}
.input-group .ig-add:first-child { border-radius: 8px 0 0 8px; border-right: 0; }
.input-group .ig-add:last-child { border-radius: 0 8px 8px 0; border-left: 0; }

/* toggle switch */
.switch { position: relative; display: inline-flex; width: 40px; height: 23px; flex: 0 0 40px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border-radius: 20px; background: var(--bg-hover);
  border: 1px solid var(--border); transition: background 0.18s ease, border-color 0.18s ease;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.18s ease;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* segmented control */
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--text-dim); font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 7px; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--bg-raised); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.18); }

/* ----- cards ----- */
.card.hover { transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }
a.card.hover:hover, .card.hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border); text-decoration: none; color: inherit; }
.card-pad { padding: 22px; }
.card-title { font-size: 14px; font-weight: 700; margin: 0 0 4px; font-family: var(--font-d); }
.card-sub { font-size: 12.5px; color: var(--text-dim); margin: 0; }

/* ----- stat widgets / KPI cards ----- */
.kpi { display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; }
a.kpi:hover { text-decoration: none; color: inherit; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.kpi-ico {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 32px;
  background: var(--accent-soft); color: var(--accent-text);
  display: grid; place-items: center;
}
.kpi-ico svg { width: 17px; height: 17px; }
.kpi-ico.green { background: var(--green-soft); color: var(--green); }
.kpi-ico.blue { background: var(--blue-soft); color: var(--blue); }
.kpi-ico.red { background: var(--red-soft); color: var(--red); }
.kpi-num { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-family: var(--font-d); line-height: 1.1; }
.kpi-label { color: var(--text-dim); font-size: 12.5px; font-weight: 600; }
.kpi-sub { color: var(--text-faint); font-size: 12px; }
.kpi-delta { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.kpi-delta svg { width: 12px; height: 12px; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.spark { margin-top: 10px; display: block; width: 100%; height: auto; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark .area { fill: var(--accent-soft); stroke: none; }

/* ----- tables: sticky header, sortable ----- */
.tbl-sticky { max-height: 480px; overflow: auto; }
.tbl-sticky thead th { position: sticky; top: 0; background: var(--bg-raised); z-index: 2; box-shadow: 0 1px 0 var(--border-soft); }
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--text); }
.th-sort .arr { display: inline-block; margin-left: 4px; font-size: 10px; color: var(--accent-text); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ----- dropdown menus ----- */
.dd-menu {
  position: absolute; min-width: 200px; max-width: calc(100vw - 24px);
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; z-index: 130;
  animation: pop 0.15s ease-out;
}
.dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border: 0; background: transparent; color: var(--text);
  font-size: 13.5px; font-weight: 500; border-radius: 7px; cursor: pointer; font-family: inherit;
}
.dd-item:hover { background: var(--bg-hover); }
.dd-item.danger { color: var(--red); }
.dd-item.danger:hover { background: var(--red-soft); }
.dd-item svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: 0.8; }
.dd-sep { height: 1px; background: var(--border-soft); margin: 5px 4px; }

/* ----- pagination ----- */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pg-info { color: var(--text-dim); font-size: 12.5px; margin-right: auto; }
.pg-btn {
  min-width: 32px; height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.pg-btn:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.pg-btn.on { background: var(--accent); border-color: var(--accent); color: var(--onacc); }
.pg-btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

/* ----- tooltips ----- */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); background: var(--text); color: var(--bg);
  font-size: 12px; font-weight: 500; padding: 6px 10px; border-radius: 7px;
  white-space: nowrap; z-index: 160; pointer-events: none; max-width: 280px;
  white-space: normal; width: max-content;
}
[data-tip]:hover::before {
  content: ""; position: absolute; bottom: calc(100% + 3px); left: 50%;
  transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--text);
  z-index: 160; pointer-events: none;
}
@media (hover: none) { [data-tip]:hover::after, [data-tip]:hover::before { display: none; } }

/* ----- breadcrumbs ----- */
.crumb { font-size: 13px; color: var(--text-faint); margin-bottom: 4px; }
.crumb a { color: var(--text-dim); }
.crumb a:hover { color: var(--accent-text); text-decoration: none; }
.topbar .crumb { margin-bottom: 0; }

/* ----- skeletons: shimmer ----- */
.skel { position: relative; overflow: hidden; background: var(--bg-hover); border-radius: 6px; animation: none; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.09), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-line { height: 13px; margin: 9px 2px; }
.skel-num { height: 30px; width: 44%; margin: 10px 2px; }
.skel-title { height: 18px; width: 60%; margin: 6px 2px 12px; }
.skel-circle { width: 40px; height: 40px; border-radius: 50%; }
.skel-btn { height: 34px; width: 130px; border-radius: 8px; }
.skel-row { display: flex; gap: 12px; align-items: center; padding: 12px 2px; }
.skel-grid { display: grid; gap: 14px; }

/* ----- empty states ----- */
.empty { padding: 44px 20px; text-align: center; color: var(--text-faint); }
.empty-ill {
  width: 54px; height: 54px; border-radius: 16px; background: var(--bg-hover);
  display: grid; place-items: center; margin: 0 auto 14px; color: var(--text-faint);
}
.empty-ill svg { width: 26px; height: 26px; }
.empty-title { font-weight: 700; font-size: 15px; margin-bottom: 5px; color: var(--text); font-family: var(--font-d); }
.empty-sub { font-size: 13px; color: var(--text-dim); margin: 0 auto 16px; max-width: 400px; line-height: 1.55; }
.empty-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.empty.error .empty-ill { background: var(--red-soft); color: var(--red); }
.empty .big { display: none; }

/* ----- activity feed ----- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border-soft); align-items: flex-start; }
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: var(--bg-hover); }
.feed-ico {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
  background: var(--bg-hover); color: var(--text-dim);
  display: grid; place-items: center;
}
.feed-ico svg { width: 15px; height: 15px; }
.feed-ico.green { background: var(--green-soft); color: var(--green); }
.feed-ico.red { background: var(--red-soft); color: var(--red); }
.feed-ico.blue { background: var(--blue-soft); color: var(--blue); }
.feed-ico.amber { background: var(--amber-soft); color: var(--amber); }
.feed-body { min-width: 0; flex: 1; }
.feed-title { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.feed-meta { font-size: 12px; color: var(--text-dim); margin-top: 1px; overflow-wrap: anywhere; }
.feed-time { font-size: 12px; color: var(--text-faint); white-space: nowrap; padding-top: 2px; }

/* ----- getting-started checklist ----- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.check-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 12px; border-radius: 10px; }
.check-item:hover { background: var(--bg-hover); }
.check-dot {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border);
  display: grid; place-items: center; flex: 0 0 24px; color: transparent; margin-top: 1px;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.check-dot svg { width: 13px; height: 13px; }
.check-item.done .check-dot { background: var(--green); border-color: var(--green); color: #fff; }
.check-item.done .check-title { color: var(--text-dim); }
.check-title { font-weight: 600; font-size: 13.5px; }
.check-desc { font-size: 12.5px; color: var(--text-dim); margin-top: 1px; }
.check-go { margin-left: auto; flex: 0 0 auto; padding-top: 1px; }
.check-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.check-progress .progress { flex: 1; }
.check-progress .pct { font-size: 12.5px; font-weight: 700; color: var(--text-dim); white-space: nowrap; }

/* ----- wizard stepper ----- */
.steps { display: flex; align-items: center; margin: 6px 0 26px; }
.step { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.step-n {
  width: 30px; height: 30px; border-radius: 50%; background: var(--bg-hover);
  color: var(--text-dim); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex: 0 0 30px;
}
.step-n svg { width: 14px; height: 14px; }
.step.active .step-n { background: var(--accent); color: var(--onacc); }
.step.done .step-n { background: var(--green); color: #fff; }
.step-label { font-size: 13px; font-weight: 600; color: var(--text-faint); white-space: nowrap; }
.step.active .step-label { color: var(--text); }
.step.done .step-label { color: var(--text-dim); }
.step-line { flex: 1 1 24px; height: 2px; background: var(--border); margin: 0 12px; min-width: 16px; border-radius: 2px; }
.wizard { max-width: 660px; margin: 8px auto 32px; }
.wizard .skip { font-size: 13px; color: var(--text-dim); }
.wizard-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* ----- callouts ----- */
.callout {
  display: flex; gap: 12px; padding: 13px 15px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-raised);
  font-size: 13.5px; margin-bottom: 16px; align-items: flex-start;
}
.callout.info { background: var(--blue-soft); border-color: var(--blue); }
.callout.warn { background: var(--amber-soft); border-color: var(--amber); }
.callout.err { background: var(--red-soft); border-color: var(--red); }
.callout.ok { background: var(--green-soft); border-color: var(--green); }
.callout .c-ico { flex: 0 0 auto; padding-top: 1px; }
.callout .c-ico svg { width: 18px; height: 18px; display: block; }
.callout.info .c-ico { color: var(--blue); }
.callout.warn .c-ico { color: var(--amber); }
.callout.err .c-ico { color: var(--red); }
.callout.ok .c-ico { color: var(--green); }
.callout .c-body { min-width: 0; flex: 1; }
.callout .c-title { font-weight: 700; margin-bottom: 2px; }
.callout .c-text { color: var(--text-dim); }

/* ----- first-run setup banner ----- */
.setup-banner {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--accent-soft), transparent 65%);
  border: 1px solid var(--accent); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 20px;
}
.setup-banner .sb-ico {
  width: 46px; height: 46px; border-radius: 13px; flex: 0 0 46px;
  background: var(--accent); color: var(--onacc); display: grid; place-items: center;
}
.setup-banner .sb-ico svg { width: 24px; height: 24px; }
.setup-banner .sb-body { flex: 1 1 240px; min-width: 0; }
.setup-banner .sb-title { font-weight: 700; font-size: 16px; font-family: var(--font-d); margin-bottom: 3px; }
.setup-banner .sb-text { font-size: 13px; color: var(--text-dim); }
.setup-banner .sb-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ----- provider dots (federation) ----- */
.prov-dot {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  display: grid; place-items: center; color: #fff;
  font-weight: 800; font-size: 15px; font-family: var(--font-d);
}
.conn-name { font-weight: 600; font-size: 13.5px; }
.conn-sub { font-size: 12px; color: var(--text-dim); }

/* ----- choice cards (branding layout picker) ----- */
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice {
  border: 1.5px solid var(--border); background: var(--bg); border-radius: 10px;
  padding: 13px 12px; text-align: left; cursor: pointer; color: var(--text);
  font-family: inherit; transition: border-color 0.15s ease, background 0.15s ease;
}
.choice:hover { border-color: var(--text-faint); }
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice .ch-title { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.choice .ch-hint { font-size: 11.5px; color: var(--text-dim); font-weight: 400; line-height: 1.45; }

/* ----- color swatches ----- */
.swatch-row { display: flex; gap: 8px; align-items: center; }
input[type="color"].swatch {
  width: 44px; height: 36px; padding: 2px; flex: 0 0 44px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); cursor: pointer;
}

/* ----- browser-chrome preview frame ----- */
.preview-frame { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg); }
.preview-bar {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: var(--bg-soft); border-bottom: 1px solid var(--border-soft);
}
.preview-bar .pdot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.preview-url {
  flex: 1; min-width: 0; font-family: var(--font-m); font-size: 11.5px; color: var(--text-dim);
  background: var(--bg); border: 1px solid var(--border-soft); border-radius: 6px;
  padding: 4px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-canvas { padding: 20px; }

/* ----- section headers inside editors ----- */
.sec-h { display: flex; align-items: center; gap: 9px; margin: 20px 0 10px; }
.sec-h:first-child { margin-top: 0; }
.sec-h .sec-ico { width: 26px; height: 26px; border-radius: 8px; background: var(--bg-hover); color: var(--text-dim); display: grid; place-items: center; flex: 0 0 26px; }
.sec-h .sec-ico svg { width: 14px; height: 14px; }
.sec-h h3 { margin: 0; font-size: 13.5px; font-weight: 700; }
.sec-h .hint { margin-left: auto; }

/* ----- modal motion ----- */
.modal-back { animation: fadein 0.18s ease-out; }
.modal { animation: pop 0.2s ease-out; }
@keyframes fadein { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

/* ----- toast kinds and motion ----- */
.toast { animation: slidein 0.22s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }
.toast.info { border-left: 3px solid var(--blue); }
.toast.warn { border-left: 3px solid var(--amber); }
#toasts { max-height: calc(100vh - 40px); overflow-y: auto; }

/* ----- misc atoms ----- */
.kbd {
  font-family: var(--font-m); font-size: 11.5px; background: var(--bg-hover);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px;
}
.divider { height: 1px; background: var(--border-soft); margin: 16px 0; border: 0; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; white-space: nowrap; align-items: center; }
.stat-ic { display: inline-grid; place-items: center; vertical-align: -3px; margin-right: 6px; color: var(--text-faint); }
.stat-ic svg { width: 14px; height: 14px; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; }
.copy-btn svg { width: 13px; height: 13px; }

/* ----- responsive additions ----- */
@media (max-width: 760px) {
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .steps { flex-wrap: wrap; gap: 10px 0; }
  .step-label { display: none; }
  .step.active .step-label { display: inline; }
  .wizard { margin-top: 0; }
  .kpi-num { font-size: 26px; }
  .setup-banner { padding: 14px 16px; }
  .preview-canvas { padding: 12px; }
  .row-actions { flex-wrap: wrap; justify-content: flex-start; }
}

/* ----- reduced motion: kill all non-essential animation ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .skel::after { animation: none; }
}

/* SSH CA page (Phase 9.7) */
.sshca-pubkey { white-space: pre-wrap; word-break: break-all; max-width: 100%; }
