:root {
  --primary: #2b4c9b;
  --primary-dark: #1e3a7a;
  --bg: #f0f3f9;
  --card-bg: #ffffff;
  --border: #e0e4ec;
  --text: #1c2333;
  --muted: #6b7280;
  --success: #1a7f37;
  --success-bg: #e6f6ea;
  --error: #b42318;
  --error-bg: #fdecea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}

.topbar .brand { font-weight: 700; font-size: 18px; display: inline-flex; align-items: center; line-height: 0; }
.topbar .brand-logo { height: 30px; width: auto; display: block; }

.container { max-width: 1000px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}

.auth-card { max-width: 380px; margin: 60px auto; }
.auth-logo { display: block; margin: 0 auto 18px; height: 56px; width: 56px; }

h1 { font-size: 22px; margin-top: 0; }
h2 { font-size: 16px; color: var(--primary-dark); border-top: 1px solid var(--border); padding-top: 14px; margin-top: 18px; }

label { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.req { color: var(--error); }

input[type=text], input[type=email], input[type=password], select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: normal; }
.checkbox-row input { width: auto; }

button, .btn, .btn-secondary {
  display: inline-block;
  margin-top: 18px;
  padding: 9px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

button[type=submit], .btn { background: var(--primary); color: white; }
button[type=submit]:hover, .btn:hover { background: var(--primary-dark); }

.btn-secondary { background: #eef0f4; color: var(--text); margin-left: 8px; }

.link-btn {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin: 0;
  text-decoration: underline;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 10px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.table th { background: #f7f8fb; font-size: 12px; text-transform: uppercase; color: var(--muted); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { text-align: center; }
.stat-num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); margin: 6px 0 10px; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--error-bg); color: var(--error); }

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

.multiselect { position: relative; margin-top: 6px; }

.multiselect-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
}
.multiselect-toggle .chevron { color: var(--muted); font-size: 12px; }

.multiselect-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 320px;
  display: flex;
  flex-direction: column;
}

/* Critical: without this, the [hidden] attribute never actually hides the
   panel, because the class rule above (display: flex) overrides the
   browser's default [hidden] { display: none } behavior. This rule must
   come after the class rule so it wins. */
.multiselect-panel[hidden] {
  display: none;
}

.ms-search {
  margin: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.ms-options { overflow-y: auto; padding: 4px 0 8px; }

.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: normal;
  cursor: pointer;
  margin: 0;
  position: relative;
}
.ms-option:hover { background: #f5f7fb; }
.ms-option input { position: absolute; opacity: 0; pointer-events: none; }
.ms-option .ms-check { margin-left: auto; color: var(--primary); opacity: 0; }
.ms-option input:checked ~ .ms-check { opacity: 1; }
.ms-option input:checked ~ span:first-of-type { color: var(--primary); font-weight: 600; }

.hidden { display: none !important; }
.cascade-field select, .cascade-field input { width: 100%; }

.scenario-card .result { margin-top: 14px; padding: 12px; border-radius: 8px; font-size: 13px; }
.result-ok { background: var(--success-bg); }
.result-fail { background: var(--error-bg); }
.result pre, .mini-pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; margin: 8px 0 0; }

/* ---------- Tabbed form (Customer Info / Address / Tax Info / Remarks) ---------- */
.tabs-form { display: flex; gap: 0; align-items: flex-start; }
.tabs-nav {
  width: 190px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding-right: 16px;
  margin-right: 24px;
}
.tabs-nav button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 4px;
  margin: 0;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.tabs-nav button:hover { color: var(--text); }
.tabs-nav button.active {
  color: var(--primary);
  border-left-color: var(--primary);
  padding-left: 10px;
}
.tab-content { flex: 1; min-width: 0; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.field-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field-row.two { grid-template-columns: 1fr 1fr; }
.field-row label { margin-top: 0; }
@media (max-width: 720px) {
  .tabs-form { flex-direction: column; }
  .tabs-nav { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; margin-right: 0; margin-bottom: 12px; display: flex; overflow-x: auto; }
  .tabs-nav button.active { border-left-color: transparent; border-bottom: 3px solid var(--primary); padding-left: 4px; }
  .field-row, .field-row.two { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Badges (environment / status) ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 100px; font-size: 12px; font-weight: 600; }
.badge-production { background: #e7f0ff; color: var(--primary-dark); }
.badge-sandbox { background: #fff4e0; color: #8a5a00; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-failed { background: var(--error-bg); color: var(--error); }
.badge-pending { background: #eef0f4; color: var(--muted); }

.tab-links { display: flex; gap: 6px; margin-bottom: 16px; }
.tab-links a {
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
  background: #eef0f4;
}
.tab-links a.active { background: var(--primary); color: white; }

/* ---------- Invoice line-item builder ---------- */
.item-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fbfcfe;
  position: relative;
}
.item-card .item-remove {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--error);
  font-size: 13px;
  cursor: pointer;
  margin: 0;
  padding: 0;
  text-decoration: underline;
}
.item-card .field-row { grid-template-columns: repeat(4, 1fr); }
.item-card .field-row + .field-row { margin-top: 4px; }
.item-card label { font-size: 11px; margin: 8px 0 3px; }
.item-total {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}
.item-total strong { color: var(--text); }
details.advanced-fields { margin-top: 10px; }
details.advanced-fields summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
}
details.advanced-fields .field-row { margin-top: 10px; }
@media (max-width: 720px) {
  .item-card .field-row { grid-template-columns: 1fr 1fr; }
}

.invoice-totals-bar {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  padding: 14px 4px;
  font-size: 14px;
}
.invoice-totals-bar .grand-total { font-size: 18px; font-weight: 700; color: var(--primary); }

/* ---------- Invoice detail / print view ---------- */
.invoice-doc { background: white; }
.invoice-business-logo { max-height: 64px; max-width: 160px; object-fit: contain; flex-shrink: 0; }
.invoice-doc-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.invoice-doc-head h1 { margin-bottom: 4px; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.invoice-parties .party h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.invoice-parties .party p { margin: 2px 0; font-size: 14px; }
.invoice-meta { text-align: right; font-size: 13px; color: var(--muted); }
.invoice-meta strong { color: var(--text); }
.print-only { display: none; }
@media print {
  .shell.has-sidebar { padding-left: 0 !important; }
  .topbar, .appbar, .sidebar, .sidebar-backdrop, .page-head a, .print-hide, form button, .flash { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .card { border: none; padding: 0; }
}

/* Generic response/result box (used outside .scenario-card too, e.g. invoice detail) */
.result { margin-top: 14px; padding: 12px; border-radius: 8px; font-size: 13px; }

/* ---------- FBR compliance stamp: logo + QR + invoice number ---------- */
.fbr-stamp {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfe;
}
.fbr-stamp-logo img { width: 1in; height: 1in; object-fit: contain; }
.fbr-logo-missing {
  width: 160px;
  font-size: 11px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 8px;
}
.fbr-logo-missing code { font-size: 10px; }
.fbr-stamp-qr svg { width: 1in; height: 1in; display: block; }
.fbr-stamp-text { font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.fbr-stamp-text strong { font-size: 15px; letter-spacing: 0.3px; }
@media print {
  .fbr-stamp { border: none; padding: 0; }
}

/* =====================================================================
   App shell: top bar + profile menu + sidebar + business switcher
   ===================================================================== */
[hidden] { display: none !important; }
:root { --sidebar-w: 240px; --appbar-h: 58px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.08); }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

.appbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--appbar-h);
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.appbar-left, .appbar-right { display: flex; align-items: center; gap: 14px; }
.appbar .brand { display: inline-flex; align-items: center; line-height: 0; }
.appbar .brand-logo { height: 30px; width: auto; display: block; }
.icon-btn {
  margin: 0; padding: 6px; background: transparent; border: 0; color: #fff; border-radius: 8px;
  cursor: pointer; display: inline-flex;
}
.icon-btn:hover { background: rgba(255,255,255,.14); }
.icon-btn .icon { width: 22px; height: 22px; }
.sidebar-toggle { display: none; }
.appbar-biz {
  display: inline-flex; align-items: center; gap: 8px;
  color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 100px; background: rgba(255,255,255,.12);
  max-width: 260px;
}
.appbar-biz span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-biz:hover { background: rgba(255,255,255,.2); }

.profile-menu { position: relative; }
.profile-btn { margin: 0; padding: 0; background: none; border: 0; cursor: pointer; border-radius: 50%; }
.profile-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--primary); font-weight: 700; font-size: 14px; letter-spacing: .5px;
  border: 2px solid rgba(255,255,255,.6);
}
.avatar-lg { width: 44px; height: 44px; font-size: 16px; background: #e8eefb; border-color: #e8eefb; flex-shrink: 0; }
.profile-dropdown {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 270px; background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16,24,40,.16);
  padding: 8px; z-index: 50;
}
.profile-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.profile-id { min-width: 0; }
.profile-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-email { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 0; padding: 10px; border-radius: 8px;
  background: none; border: 0; color: var(--text) !important;
  font-size: 14px; font-weight: 500; text-decoration: none; text-align: left; cursor: pointer;
}
.profile-item:hover { background: #f2f5fb; }
.profile-dropdown .logout-form { display: block; margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--border); }
.profile-dropdown button.profile-logout { background: none; color: var(--error) !important; font-weight: 600; }
.profile-dropdown button.profile-logout:hover { background: var(--error-bg); }

.shell { min-height: calc(100vh - var(--appbar-h)); }
.shell.has-sidebar { padding-left: var(--sidebar-w); }
.sidebar {
  position: fixed; top: var(--appbar-h); bottom: 0; left: 0; z-index: 30;
  width: var(--sidebar-w);
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 12px 12px;
  overflow-y: auto;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: #3b4456; text-decoration: none; font-size: 14px; font-weight: 500;
}
.side-link .icon { color: #7a8397; }
.side-link:hover { background: #f2f5fb; color: var(--primary); }
.side-link:hover .icon { color: var(--primary); }
.side-link.active { background: #e8eefb; color: var(--primary); font-weight: 600; }
.side-link.active .icon { color: var(--primary); }

.biz-switch {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--border); background: #f8fafd;
  text-decoration: none; color: var(--text);
}
.biz-switch:hover { border-color: var(--primary); background: #f2f5fb; }
.biz-switch .icon { color: var(--muted); }
.biz-avatar, .biz-card-icon {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 13px;
}
.biz-avatar img, .biz-card-icon img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.biz-switch-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.biz-switch-text strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-switch-text small { font-size: 11px; color: var(--muted); }
.sidebar-backdrop { display: none; }

.shell .container { max-width: 1180px; padding: 28px 32px; }

@media (max-width: 900px) {
  .sidebar-toggle { display: inline-flex; }
  .shell.has-sidebar { padding-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 24px rgba(0,0,0,.15); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; top: var(--appbar-h); left: 0; right: 0; bottom: 0; background: rgba(15,23,42,.35); z-index: 25; }
  .appbar-biz { display: none; }
  .shell .container { padding: 20px 16px; }
}

/* ---------- Business picker ---------- */
.picker { max-width: 1040px; margin: 0 auto; }
.picker-head h1 { margin-bottom: 4px; font-size: 24px; }
.picker-toolbar { display: flex; gap: 12px; align-items: center; margin: 22px 0 18px; flex-wrap: wrap; }
.search-box { flex: 1; min-width: 220px; position: relative; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search-box input { padding-left: 38px !important; height: 42px; border-radius: 8px !important; background: #fff; }
.view-toggle { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.view-toggle button { margin: 0; padding: 6px 8px; background: none; border-radius: 6px; color: var(--muted); display: inline-flex; }
.view-toggle button svg { width: 20px; height: 20px; }
.view-toggle button.active { background: #e8eefb; color: var(--primary); }
.picker-add { margin-top: 0; height: 42px; display: inline-flex; align-items: center; }

.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.biz-card-form { margin: 0; }
.biz-card {
  width: 100%; height: 100%; margin: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 18px; min-height: 92px;
  background: #fff !important; color: var(--text) !important;
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow);
  text-align: left; font-weight: 400; cursor: pointer; text-decoration: none;
  position: relative;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.biz-card:hover { border-color: var(--primary); box-shadow: 0 6px 18px rgba(43,76,155,.14); transform: translateY(-1px); }
.biz-card.current { border-color: var(--primary); }
.biz-card-icon { width: 48px; height: 48px; border-radius: 10px; font-size: 16px; }
.biz-card-icon.add { background: #eef2fb; color: var(--primary); font-size: 24px; font-weight: 400; }
.biz-card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.biz-card-text strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-card-text small { font-size: 13px; color: var(--muted); }
.biz-card-text .biz-card-loc { font-size: 12px; }
.biz-card-add { border-style: dashed; box-shadow: none; }
.biz-current-badge { position: absolute; top: 10px; right: 10px; font-size: 11px; }
.biz-grid.list { grid-template-columns: 1fr; gap: 8px; }
.biz-grid.list .biz-card { min-height: 0; padding: 12px 16px; }
.biz-grid.list .biz-card-icon { width: 38px; height: 38px; }
.picker-manage { margin-top: 20px; font-size: 14px; }

/* ---------- Dashboard ---------- */
.dash-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.dash-greeting { font-size: 26px; margin: 0 0 4px; }
.dash-sub { margin: 0; color: var(--muted); }
.dash-cta { margin-top: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: 18px; display: flex; gap: 14px; align-items: flex-start; min-width: 0;
}
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.si-blue { background: #e8eefb; color: var(--primary); }
.si-green { background: #e3f6e9; color: #1a7f37; }
.si-amber { background: #fff3dc; color: #a15c00; }
.si-purple { background: #efe8fb; color: #6b3fb8; }
.stat-body { min-width: 0; }
.stat-title { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; margin: 4px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-foot { font-size: 12px; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.shell .card { border-radius: 12px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 16px; }
.card-link { font-size: 13px; font-weight: 600; text-decoration: none; color: var(--primary); }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: #edf0f5; stroke-width: 1; }
.chart-label { fill: #8a93a6; font-size: 11px; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: #fff; stroke: var(--primary); stroke-width: 2.5; }
.chart-empty { text-align: center; margin: 6px 0 0; }

.progress { height: 6px; background: #edf0f5; border-radius: 100px; overflow: hidden; margin-bottom: 14px; }
.progress span { display: block; height: 100%; background: var(--success); border-radius: 100px; }
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-mark {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: #eef0f4; color: var(--muted);
}
.step.done .step-mark { background: var(--success-bg); color: var(--success); }
.step a { font-weight: 600; font-size: 14px; text-decoration: none; color: var(--text); }
.step a:hover { color: var(--primary); }
.step.done a { color: var(--muted); text-decoration: line-through; }
.step p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.table-flat { border-radius: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.empty-row { text-align: center; color: var(--muted); padding: 28px 12px !important; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ---------- Profile ---------- */
.profile-card { max-width: 820px; }
.section-title { font-size: 15px; margin: 6px 0 2px; }
.profile-card .section-title ~ .section-title { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }

@media print {
  .shell .container { max-width: 100%; padding: 0; }
  .shell .card { box-shadow: none; }
}

/* =====================================================================
   Accounts: approval status, locked features, admin console
   ===================================================================== */
.flash-warn { background: #fff4e0; color: #8a5a00; }

.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 100px;
  font-size: 12px; font-weight: 700; text-decoration: none;
  background: rgba(255,255,255,.16); color: #fff;
}
.status-chip:hover { background: rgba(255,255,255,.26); }
.chip-active { background: #d6f3de; color: #14682d; }
.chip-admin { background: #e3e9ff; color: #24356f; }
.chip-pending { background: #ffe6b8; color: #7a4d00; }
.chip-locked { background: #ffd9d4; color: #97271c; }

.side-group {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #9aa2b4; padding: 14px 12px 6px;
}
.side-nav .side-group:first-child { padding-top: 2px; }
.side-link span:first-of-type { flex: 1; }
.side-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 100px;
  background: var(--error); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.side-lock { display: inline-flex; color: #b6bcc9; }
.side-lock .icon { width: 15px; height: 15px; }
.side-link.locked { color: #9aa2b4; }
.side-link.locked .icon { color: #b6bcc9; }
.side-link.locked:hover { background: #f6f7fa; color: #6b7280; }

.locked-notice {
  border: 1px solid #f3d9a6; background: #fffaf0; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 18px;
}
.locked-notice strong { color: #8a5a00; }
.locked-notice p { margin: 4px 0 0; font-size: 13px; color: #6b5330; }
.bare-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.bare-fieldset[disabled] { opacity: .6; }
.locked-text { font-weight: 600; font-size: 14px; color: var(--muted); }

.status-card { border-left: 4px solid var(--muted); }
.status-card.status-ok { border-left-color: var(--success); }
.status-card.status-warn { border-left-color: #c98a00; }
.status-card.status-bad { border-left-color: var(--error); }
.status-card-head { display: flex; gap: 12px; align-items: flex-start; }
.status-headline { font-size: 18px; margin: 0 0 4px; border: 0; padding: 0; color: var(--text); }
.status-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--muted); }
.status-ok .status-dot { background: var(--success); }
.status-warn .status-dot { background: #e0a100; }
.status-bad .status-dot { background: var(--error); }
.sub-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.sub-facts .sub-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.sub-facts strong { font-size: 15px; }
@media (max-width: 720px) { .sub-facts { grid-template-columns: 1fr 1fr; } }

.feature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.feature-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.feature-list li span {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: #eef0f4 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='3' stroke-linecap='round'%3E%3Crect x='6' y='11' width='12' height='9' rx='2'/%3E%3Cpath d='M9 11V8a3 3 0 016 0v3'/%3E%3C/svg%3E") center/13px no-repeat;
}
.feature-list li.on span {
  background: var(--success-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a7f37' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") center/13px no-repeat;
}
.feature-list li.off { color: var(--muted); }

/* ---------- Admin console ---------- */
.admin-stats { grid-template-columns: repeat(4, 1fr); }
.admin-stats .stat-card { padding: 16px 18px; }
.user-cell { display: flex; flex-direction: column; }
.user-cell small { color: var(--muted); font-size: 12px; }
.admin-actions-col { width: 230px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.admin-actions form { margin: 0; }
.btn-mini {
  display: inline-block; margin: 0; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text);
  font-size: 12px; font-weight: 600; cursor: pointer; list-style: none;
}
.btn-mini::-webkit-details-marker { display: none; }
button.btn-approve[type=submit], .btn-approve { background: var(--success); color: #fff; border-color: var(--success); }
button.btn-approve[type=submit]:hover { background: #14682d; }
button.btn-danger[type=submit], .btn-danger { background: #fff; color: var(--error); border-color: #f0c2bd; }
button.btn-danger[type=submit]:hover { background: var(--error-bg); }
button.btn-warn[type=submit], .btn-warn { background: #fff; color: #8a5a00; border-color: #f0dcb6; }
button.btn-warn[type=submit]:hover { background: #fff4e0; }
.action-note { position: relative; }
.action-note[open] > form {
  position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; width: 230px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16,24,40,.16); padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.action-note form input { font-size: 12px; padding: 7px 8px; }
@media (max-width: 1100px) { .admin-stats { grid-template-columns: repeat(2, 1fr); } }
