/* =========================================================
   SpeedRecon — Unified Theme System (Light/Dark/Dim/Contrast)
   - No static colors in components
   - All UI uses tokens (CSS variables)
   ========================================================= */

/* Base font + smoothing */
:root{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -------------------------
   Theme tokens (DEFAULT = light)
   ------------------------- */
:root{
  /* Surfaces */
  --bg: #f6f7fb;
  --bg-2: #eef1f7;
  --card: #ffffff;
  --card-2: #f9fafb;

  /* Text */
  --text: #0f172a;
  --muted: #64748b;

  /* Borders / shadows */
  --border: #e5e7eb;
  --shadow: 0 1px 10px rgba(2, 6, 23, 0.08);
  --shadow-lg: 0 18px 55px rgba(2, 6, 23, 0.18);

  /* Brand */
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --on-primary: #ffffff;
 /*
  --primary: #15803d;
  --primary-2: #0d6e31;
  --on-primary: #ffffff;
*/
  /* Interactive */
  --link: var(--primary);
  --focus: rgba(37, 99, 235, 0.25);

  /* Inputs */
  --input-bg: #ffffff;
  --input-text: var(--text);
  --input-border: var(--border);
  --input-placeholder: #94a3b8;

  /* Tables */
  --table-head: #f8fafc;
  --table-head-2: #ffffff;
  --table-row-hover: rgba(2, 6, 23, 0.03);

  /* Badges / status */
  --success-bg: #dcfce7;
  --success-border: #86efac;
  --error-bg: #fee2e2;
  --error-border: #fca5a5;
  --warn-outline: #f59e0b;

  --btn-success-bg: #16a34a;        /* emerald-600 */
  --btn-success-bg-hover: #15803d;  /* emerald-700 */
  --btn-success-text: #ffffff;

  /* Reconciliation row colors */
  --row-green: #eaffea;
  --row-red: #ffecec;

  /* Buttons */
  --btn-bg: var(--primary);
  --btn-bg-hover: var(--primary-2);
  --btn-text: var(--on-primary);
  --btn-border: transparent;

  --btn-2-bg: var(--card);
  --btn-2-bg-hover: rgba(2,6,23,0.04);
  --btn-2-text: var(--text);
  --btn-2-border: var(--border);

  /* Action buttons (tables) */
  --danger: #dc3545;
  --danger-2: #b02a37;

  --btn-danger-bg: transparent;
  --btn-danger-bg-hover: rgba(220, 53, 69, 0.10);
  --btn-danger-text: var(--danger);
  --btn-danger-border: rgba(220, 53, 69, 0.35);

  --btn-soft-bg: rgba(2, 6, 23, 0.04);
  --btn-soft-bg-hover: rgba(2, 6, 23, 0.07);
  --btn-soft-text: var(--text);
  --btn-soft-border: var(--border);

  /* Separator */
  --sep: #e5e7eb;

  /* Scrollbar */
  --scrollbar-thumb: rgba(100, 116, 139, 0.35);
  --scrollbar-track: rgba(100, 116, 139, 0.12);

  /* Success buttons */
  --success: #16a34a;
  --success-2: #15803d;
  --on-success: #ffffff;

  --btn-success-bg: var(--success);
  --btn-success-bg-hover: var(--success-2);
  --btn-success-text: var(--on-success);
  --btn-success-border: transparent;
  --topbar-bg: color-mix(in srgb, var(--card) 88%, var(--bg-2));
}

/* ===========================
   SpeedRecon Badges
=========================== */

/* Color tokens (light default) */
:root{
  --badge-bg: rgba(2, 7, 70, 0.06);
  --badge-border: rgba(2, 7, 70, 0.14);
  --badge-text: var(--text);

  --badge-success-bg: rgba(22, 163, 74, 0.12);
  --badge-success-border: rgba(22, 163, 74, 0.28);
  --badge-success-text: #14532d;

  --badge-warning-bg: rgba(245, 158, 11, 0.14);
  --badge-warning-border: rgba(245, 158, 11, 0.30);
  --badge-warning-text: #7c2d12;

  --badge-danger-bg: rgba(239, 68, 68, 0.14);
  --badge-danger-border: rgba(239, 68, 68, 0.30);
  --badge-danger-text: #7f1d1d;

  --badge-info-bg: rgba(59, 130, 246, 0.14);
  --badge-info-border: rgba(59, 130, 246, 0.30);
  --badge-info-text: #1e3a8a;

  --badge-neutral-bg: rgba(100, 116, 139, 0.14);
  --badge-neutral-border: rgba(100, 116, 139, 0.28);
  --badge-neutral-text: #334155;

  --badge-archived-bg: rgba(168, 85, 247, 0.18);
  --badge-archived-border: rgba(168, 85, 247, 0.34);
  --badge-archived-text: rgba(63, 61, 61, 0.92);
}

/* -------------------------
   Dark theme
   ------------------------- */
html[data-theme="dark"]{
  --bg:#0b1220;
  --bg-2:#0a1020;
  --card:#0f172a;
  --card-2:#111c33;

  --text:#e5e7eb;
  --muted:#94a3b8;

  --border:#1f2a44;
  --shadow: 0 1px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 22px 70px rgba(0,0,0,0.55);

  --primary:#60a5fa;
  --primary-2:#3b82f6;
  --on-primary:#071426;

  --link:#93c5fd;
  --focus: rgba(96, 165, 250, 0.30);

  --input-bg:#0b1326;
  --input-text: var(--text);
  --input-border: var(--border);
  --input-placeholder:#64748b;

  --table-head:#0b1326;
  --table-head-2:#0f172a;
  --table-row-hover: rgba(148, 163, 184, 0.08);

  --success-bg: rgba(34, 197, 94, 0.16);
  --success-border: rgba(34, 197, 94, 0.32);
  --error-bg: rgba(239, 68, 68, 0.16);
  --error-border: rgba(239, 68, 68, 0.32);

  --btn-success-bg: #22c55e;        /* lighter green for contrast */
  --btn-success-bg-hover: #16a34a;
  --btn-success-text: #0f172a;

  --row-green: rgba(34, 197, 94, 0.14);
  --row-red: rgba(239, 68, 68, 0.14);

  --btn-bg: var(--primary);
  --btn-bg-hover: var(--primary-2);
  --btn-text: var(--on-primary);
  --btn-border: transparent;

  --btn-2-bg: #0b1326;
  --btn-2-bg-hover: rgba(148,163,184,0.10);
  --btn-2-text: var(--text);
  --btn-2-border: var(--border);

  --sep: #1f2a44;

  --scrollbar-thumb: rgba(148,163,184,0.35);
  --scrollbar-track: rgba(148,163,184,0.12);

  --danger: #ef4444;
  --danger-2: #dc2626;

  --btn-danger-bg: transparent;
  --btn-danger-bg-hover: rgba(239, 68, 68, 0.12);
  --btn-danger-text: var(--danger);
  --btn-danger-border: rgba(239, 68, 68, 0.35);

  --btn-soft-bg: rgba(148,163,184,0.10);
  --btn-soft-bg-hover: rgba(148,163,184,0.16);
  --btn-soft-text: var(--text);
  --btn-soft-border: var(--border);

  --success: #22c55e;
  --success-2: #16a34a;
  --on-success: #071426;

  --btn-success-bg: var(--success);
  --btn-success-bg-hover: var(--success-2);
  --btn-success-text: var(--on-success);
  --btn-success-border: transparent;

  /* Badges */
  --badge-bg: rgba(255,255,255,0.08);
  --badge-border: rgba(255,255,255,0.14);
  --badge-text: rgba(255,255,255,0.92);

  --badge-success-bg: rgba(34, 197, 94, 0.16);
  --badge-success-border: rgba(34, 197, 94, 0.30);
  --badge-success-text: rgba(255,255,255,0.92);

  --badge-warning-bg: rgba(245, 158, 11, 0.18);
  --badge-warning-border: rgba(245, 158, 11, 0.30);
  --badge-warning-text: rgba(255,255,255,0.92);

  --badge-danger-bg: rgba(239, 68, 68, 0.18);
  --badge-danger-border: rgba(239, 68, 68, 0.32);
  --badge-danger-text: rgba(255,255,255,0.92);

  --badge-info-bg: rgba(59, 130, 246, 0.18);
  --badge-info-border: rgba(59, 130, 246, 0.32);
  --badge-info-text: rgba(255,255,255,0.92);

  --badge-neutral-bg: rgba(148, 163, 184, 0.16);
  --badge-neutral-border: rgba(148, 163, 184, 0.28);
  --badge-neutral-text: rgba(255,255,255,0.90);

  --badge-archived-bg: rgba(168, 85, 247, 0.18);
  --badge-archived-border: rgba(168, 85, 247, 0.34);
  --badge-archived-text: rgba(255,255,255,0.92);

  --topbar-bg: color-mix(in srgb, var(--card) 82%, var(--bg-2));
}

/* -------------------------
   Dim theme (softer dark)
   ------------------------- */
html[data-theme="dim"]{
  --bg:#0b1020;
  --bg-2:#0a0f1f;
  --card:#101827;
  --card-2:#0f1a2f;

  --text:#dbe4ee;
  --muted:#9aa9bd;

  --border:#22324a;
  --shadow: 0 1px 12px rgba(0,0,0,0.32);
  --shadow-lg: 0 22px 70px rgba(0,0,0,0.50);

  --primary:#7aa2ff;
  --primary-2:#5b86ff;
  --on-primary:#071024;

  --link:#a5c0ff;
  --focus: rgba(122, 162, 255, 0.28);

  --input-bg:#0c1426;
  --input-text: var(--text);
  --input-border: var(--border);
  --input-placeholder:#7c8aa5;

  --table-head:#0c1426;
  --table-head-2:#101827;
  --table-row-hover: rgba(154,169,189,0.08);

  --success-bg: rgba(34,197,94,0.14);
  --success-border: rgba(34,197,94,0.28);
  --error-bg: rgba(239,68,68,0.14);
  --error-border: rgba(239,68,68,0.28);

  --btn-success-bg: #16a34a;
  --btn-success-bg-hover: #15803d;
  --btn-success-text: #ffffff;

  --row-green: rgba(34,197,94,0.12);
  --row-red: rgba(239,68,68,0.12);

  --sep: #22324a;

  --danger: #ef4444;
  --danger-2: #dc2626;

  --btn-danger-bg: transparent;
  --btn-danger-bg-hover: rgba(239, 68, 68, 0.12);
  --btn-danger-text: var(--danger);
  --btn-danger-border: rgba(239, 68, 68, 0.35);

  --btn-soft-bg: rgba(154,169,189,0.10);
  --btn-soft-bg-hover: rgba(154,169,189,0.16);
  --btn-soft-text: var(--text);
  --btn-soft-border: var(--border);

  --success: #22c55e;
  --success-2: #16a34a;
  --on-success: #071024;

  --btn-success-bg: var(--success);
  --btn-success-bg-hover: var(--success-2);
  --btn-success-text: var(--on-success);
  --btn-success-border: transparent;

/* Badges */
  --badge-bg: rgba(255,255,255,0.08);
  --badge-border: rgba(255,255,255,0.14);
  --badge-text: rgba(255,255,255,0.90);

  --badge-success-bg: rgba(34, 197, 94, 0.16);
  --badge-success-border: rgba(34, 197, 94, 0.30);
  --badge-success-text: rgba(255,255,255,0.92);

  --badge-warning-bg: rgba(245, 158, 11, 0.18);
  --badge-warning-border: rgba(245, 158, 11, 0.30);
  --badge-warning-text: rgba(255,255,255,0.92);

  --badge-danger-bg: rgba(239, 68, 68, 0.18);
  --badge-danger-border: rgba(239, 68, 68, 0.32);
  --badge-danger-text: rgba(255,255,255,0.92);

  --badge-info-bg: rgba(59, 130, 246, 0.18);
  --badge-info-border: rgba(59, 130, 246, 0.32);
  --badge-info-text: rgba(255,255,255,0.92);

  --badge-neutral-bg: rgba(148, 163, 184, 0.16);
  --badge-neutral-border: rgba(148, 163, 184, 0.28);
  --badge-neutral-text: rgba(255,255,255,0.90);

  --badge-archived-bg: rgba(168, 85, 247, 0.18);
  --badge-archived-border: rgba(168, 85, 247, 0.34);
  --badge-archived-text: rgba(255,255,255,0.92);

  --topbar-bg: color-mix(in srgb, var(--card) 78%, var(--bg-2));
}

/* -------------------------
   High contrast theme
   ------------------------- */
html[data-theme="contrast"]{
  --bg:#000;
  --bg-2:#000;
  --card:#000;
  --card-2:#000;

  --text:#fff;
  --muted:#d1d5db;

  --border:#fff;
  --shadow: none;
  --shadow-lg: none;

  --primary:#00e5ff;
  --primary-2:#00c8df;
  --on-primary:#000;

  --link:#00e5ff;
  --focus: rgba(0, 229, 255, 0.40);

  --input-bg:#000;
  --input-text:#fff;
  --input-border:#fff;
  --input-placeholder:#cbd5e1;

  --table-head:#000;
  --table-head-2:#000;
  --table-row-hover: rgba(255,255,255,0.10);

  --success-bg: rgba(34,197,94,0.25);
  --success-border: #22c55e;
  --error-bg: rgba(239,68,68,0.25);
  --error-border: #ef4444;

  --row-green: rgba(34,197,94,0.22);
  --row-red: rgba(239,68,68,0.22);

  --sep:#fff;

  --danger: #ff3b3b;
  --danger-2: #ff0000;

  --btn-danger-bg: transparent;
  --btn-danger-bg-hover: rgba(255,255,255,0.10);
  --btn-danger-text: var(--danger);
  --btn-danger-border: #fff;

  --btn-soft-bg: rgba(255,255,255,0.10);
  --btn-soft-bg-hover: rgba(255,255,255,0.16);
  --btn-soft-text: var(--text);
  --btn-soft-border: var(--border);

  --topbar-bg: color-mix(in srgb, var(--card) 92%, var(--bg-2));
}

/* =========================================================
   Global element reset / base
   ========================================================= */
*{ box-sizing: border-box; }
/*
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
}
*/
a{ color: var(--link); }

hr{
  border:0;
  border-top:1px solid var(--border);
  margin: 14px 0;
}

h1{ margin: 18px 0; }

/* Scrollbar (optional nice touch) */
*::-webkit-scrollbar{ width: 10px; height: 10px; }
*::-webkit-scrollbar-track{ background: var(--scrollbar-track); border-radius: 10px; }
*::-webkit-scrollbar-thumb{ background: var(--scrollbar-thumb); border-radius: 10px; }

/* =========================================================
   Base badge component (token-based, with variants)
     - Use for status labels, counts, tags, etc
   ========================================================= */
/* Base badge */
.tb-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--badge-border);
  background:var(--badge-bg);
  color:var(--badge-text);
  font-size:12px;
  font-weight:700;
  line-height:1;
  white-space:nowrap;
}

/* Sizes */
.tb-badge.sm{ font-size:11px; padding:3px 9px; }
.tb-badge.lg{ font-size:13px; padding:6px 12px; }

/* Dot (optional) */
.tb-badge .dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background: currentColor;
  opacity:0.85;
}

/* Variants */
.tb-badge.success{
  background: var(--badge-success-bg);
  border-color: var(--badge-success-border);
  color: var(--badge-success-text);
}

.tb-badge.warning{
  background: var(--badge-warning-bg);
  border-color: var(--badge-warning-border);
  color: var(--badge-warning-text);
}

.tb-badge.danger{
  background: var(--badge-danger-bg);
  border-color: var(--badge-danger-border);
  color: var(--badge-danger-text);
}

.tb-badge.info{
  background: var(--badge-info-bg);
  border-color: var(--badge-info-border);
  color: var(--badge-info-text);
}

.tb-badge.neutral{
  background: var(--badge-neutral-bg);
  border-color: var(--badge-neutral-border);
  color: var(--badge-neutral-text);
}

/* Useful semantic aliases */
.tb-badge.draft{   background: var(--badge-neutral-bg); border-color: var(--badge-neutral-border); color: var(--badge-neutral-text); }
.tb-badge.pending{ background: var(--badge-warning-bg); border-color: var(--badge-warning-border); color: var(--badge-warning-text); }
.tb-badge.completed{ background: var(--badge-success-bg); border-color: var(--badge-success-border); color: var(--badge-success-text); }
.tb-badge.archived{
  background: var(--badge-archived-bg, rgba(124,58,237,0.14));
  border-color: var(--badge-archived-border, rgba(124,58,237,0.28));
  color: var(--badge-archived-text, #5b21b6);
}


/* =========================================================
   Layout
   ========================================================= */
/*.container{ max-width: 980px; margin: 0 auto; padding: 18px; }

.container{
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px 24px; 
}
*/
html, body{
  min-height:100%;
}

body{
  margin:0;
  min-height:100vh;
  background: var(--bg);
  color: var(--text);
}

.container{
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px 24px;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}


/* Card + Form surfaces */
.card, form, .topbar{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.card{ padding: 16px; }
form{ padding: 16px; }




/* =========================================================
   Typography helpers
   ========================================================= */
.muted{ color: var(--muted); }
.kv{ margin-bottom: 4px; }
.kv .k{ font-weight: 600; color: var(--text); margin-right: 6px; }

/* =========================================================
   Inputs
   ========================================================= */
label{ display:block; margin-top: 10px; font-size: 14px; color: var(--text); }

input, select, textarea{
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  outline: none;
}

input::placeholder, textarea::placeholder{ color: var(--input-placeholder); }

input:focus, select:focus, textarea:focus, button:focus{
  box-shadow: 0 0 0 0.22rem var(--focus);
  border-color: color-mix(in srgb, var(--primary) 70%, var(--border));
}

/* =========================================================
   Buttons
   ========================================================= */
button{
  width: 100%;
  padding: 10px;
  margin-top: 14px;
  border-radius: 12px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  font-weight: 600;
}


button:hover{ background: var(--btn-bg-hover); }
button:disabled{ opacity: 0.6; cursor: not-allowed; }

/* Secondary button class used across app */
.btn-secondary, .modal-x{
  display:inline-block;
  width:auto;
  margin-top:0;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--btn-2-border);
  background: var(--btn-2-bg);
  color: var(--btn-2-text) !important;
  text-decoration:none;
  cursor:pointer;
  font-weight: 600;
}
.btn-secondary:hover, .modal-x:hover{ background: var(--btn-2-bg-hover); }

/* Dark "pill link" button (Back button etc) */
.btn-link{
  display:inline-block;
  padding:10px 12px;
  border-radius:12px;
  background: color-mix(in srgb, var(--text) 92%, var(--card));
  color: color-mix(in srgb, var(--card) 95%, var(--text)) !important;
  text-decoration:none;
  border:1px solid var(--border);
}
.btn-link:hover{ opacity:.94; }

/* Google button */
.btn-google{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  text-align:center;
  padding:10px;
  border-radius:12px;
  border:1px solid var(--btn-2-border);
  background: var(--btn-2-bg);
  color: var(--btn-2-text);
  text-decoration:none;
  font-weight: 600;
}

.btn-google:hover{
  background: var(--btn-2-bg-hover);
}

.google-mark{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.google-mark svg{
  display:block;
}

.action-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;   /* forces bottom alignment */
}


/* makes the <form> not create a layout box */
.form-no-box{
  display: contents;
}

/* prevents “full width button” global rules from stretching it */
.btn-inline{
  width:auto !important;
  display:inline-block;
}

/* Force both button and link to behave the same */
.action-row .btn-primary,
.action-row .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1;
    height: 38px;      /* force equal height */
    box-sizing: border-box;
    width: auto !important;
}

.report-actions-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.report-actions-left{
  display:flex;
  align-items:center;
  gap:10px;
}

.report-actions-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

/* Success button */
.btn-success{
  display:inline-block;
  width:auto;
  margin-top:0;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--btn-success-border);
  background: var(--btn-success-bg);
  color: var(--btn-success-text) !important;
  text-decoration:none;
  cursor:pointer;
  font-weight: 700;
}
.btn-success:hover{ background: var(--btn-success-bg-hover); }

/* Danger button (for Cancel in modal) */
.btn-danger{
  display:inline-block;
  width:auto;
  margin-top:0;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--btn-danger-border);
  background: var(--btn-danger-bg);
  color: var(--btn-danger-text) !important;
  text-decoration:none;
  cursor:pointer;
  font-weight: 700;
}
.btn-danger:hover{ background: var(--btn-danger-bg-hover); }

/* =========================================================
   Alerts
   ========================================================= */
.alert{
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
}
.alert.success{ background: var(--success-bg); border-color: var(--success-border); }
.alert.error{ background: var(--error-bg); border-color: var(--error-border); }

/* =========================================================
   Topbar (basic) + modern topbar components
   ========================================================= */
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px 16px;
}

.brand{ font-weight: 800; letter-spacing: 0.2px; }

.nav a{
  margin-left: 12px;
  text-decoration:none;
  color: var(--link);
  font-weight: 600;
}

/* Modern topbar */
.tb-topbar{ gap: 14px; }
.tb-left{ display:flex; align-items:center; gap:14px; }
.tb-nav a{ margin-left: 10px; }

.tb-right{ display:flex; align-items:center; gap:10px; }

.tb-user{ position: relative; }
.tb-user.open .tb-menu{ display:block; }

.tb-avatar{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--btn-2-bg);
  color: var(--btn-2-text);
  font-weight: 800;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}

.tb-menu{
  display:none;
  position:absolute;
  right:0;
  top: calc(100% + 10px);
  width: 260px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow:hidden;
}

.tb-menu-head{
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--card-2);
}
.tb-menu-name{ font-weight: 800; }
.tb-menu-email{ font-size: 12px; color: var(--muted); margin-top: 2px; }

.tb-menu-items{ padding: 8px; }
.tb-menu-item{
  display:block;
  padding: 10px 10px;
  border-radius: 12px;
  text-decoration:none;
  color: var(--text);
  font-weight: 600;
}
.tb-menu-item:hover{ background: var(--btn-2-bg-hover); }


/* ===== Header: modern nav pills + profile chip ===== */

.tb-topbar{
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--card);
}

.tb-brand{
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
  letter-spacing: .2px;
}

.tb-nav{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

/* pill links */
.tb-navlink{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 84%, var(--bg));
  color: var(--text);
  text-decoration:none;
  font-weight: 600;
  font-size: 13px;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
}

.tb-navlink:hover{
  background: color-mix(in srgb, var(--card) 70%, var(--bg));
  transform: translateY(-1px);
}

.tb-navlink:focus{
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
}

/* primary action in nav */
.tb-navlink-primary{
  background: color-mix(in srgb, var(--primary) 20%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

/* right area */
.tb-right{ display:flex; align-items:center; gap:10px; }

/* profile chip button */
.tb-profile{
  width:auto;
  margin-top:0;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 84%, var(--bg));
  color: var(--text);
  border-radius: 999px;
  padding: 8px 10px;
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.tb-profile:hover{
  background: color-mix(in srgb, var(--card) 70%, var(--bg));
  transform: translateY(-1px);
}

.tb-profile:focus{
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
}

.tb-profile-icon{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.tb-profile-meta{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  line-height: 1.15;
  min-width: 180px;
  max-width: 260px;
}

.tb-profile-email{
  font-weight: 700;
  font-size: 13px;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width:100%;
}

.tb-profile-company{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width:100%;
}

.tb-profile-caret{
  opacity: .8;
  display:flex;
}

/* dropdown: keep your existing styles, but ensure above everything */
.tb-menu{ z-index: 500; }

.tb-menu-item{
  display:flex;
  align-items:center;
  gap:10px;
}

.tb-mi-ico{
  width:18px;
  height:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: var(--muted);
}
.tb-mi-ico svg{
  width:18px;
  height:18px;
}
.tb-menu-item:hover .tb-mi-ico{
  color: var(--text);
}

/* =========================================================
   Tables
   ========================================================= */
.table{ width:100%; border-collapse: collapse; }
.table th, .table td{
  text-align:left;
  padding:10px;
  border-bottom:1px solid var(--border);
  font-size: 14px;
}
.table th{ background: var(--table-head); }

/* smaller table */
.table.mini th, .table.mini td{
  padding:8px;
  vertical-align: top;
  font-size: 13px;
}

/* =========================================================
   Users grid improvements (token-based)
   ========================================================= */
.table.users-grid{
  table-layout: fixed;
}

.table.users-grid th,
.table.users-grid td{
  vertical-align: middle;
}

/* prevent wrapping in key columns */
.users-grid .nowrap{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* column sizing (reduces wrapping) */
.users-grid th.col-name, .users-grid td.col-name{ width: 18%; }
.users-grid th.col-email, .users-grid td.col-email{ width: 28%; }
.users-grid th.col-role, .users-grid td.col-role{ width: 14%; }
.users-grid th.col-status, .users-grid td.col-status{ width: 10%; }
.users-grid th.col-exp, .users-grid td.col-exp{ width: 14%; }
.users-grid th.col-last, .users-grid td.col-last{ width: 12%; }
.users-grid th.col-actions, .users-grid td.col-actions{ width: 14%; text-align: right; }

/* nicer row hover */
.users-grid tbody tr:hover td{
  background: var(--table-row-hover);
}

/* action buttons row */
.tb-actions{
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

/* compact buttons for tables (do NOT use global button styles) */
.tb-btn{
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--btn-soft-border);
  background: var(--btn-soft-bg);
  color: var(--btn-soft-text);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
  white-space: nowrap;
}

.tb-btn:hover{
  background: var(--btn-soft-bg-hover);
  transform: translateY(-1px);
}

.tb-btn:active{
  transform: translateY(0px);
  opacity: .95;
}

.tb-btn-danger{
  border-color: var(--btn-danger-border);
  color: var(--btn-danger-text);
  background: var(--btn-danger-bg);
}

.tb-btn-danger:hover{
  background: var(--btn-danger-bg-hover);
  border-color: color-mix(in srgb, var(--btn-danger-text) 55%, var(--btn-danger-border));
}

.tb-btn[disabled]{
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.btn-success{
  background: var(--btn-success-bg);
  color: var(--btn-success-text);
  border: 1px solid var(--btn-success-bg);
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.btn-success:hover{
  background: var(--btn-success-bg-hover);
  border-color: var(--btn-success-bg-hover);
}
/* =========================================================
   Forms / filters
   ========================================================= */
.filter-form{ background: transparent; padding: 0; box-shadow:none; border:none; }
.filter-row{ display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.filter-col{ flex: 1 1 220px; }
.filter-actions{ flex: 0 0 140px; }
.filter-row.compact{ gap:8px; display:flex; flex-wrap:wrap; align-items:flex-end; }
.filter-col.filter-actions{ margin-left:auto; }

.filter-form.compact label{ font-size:12px; margin-bottom:4px; }
.filter-form.compact select{ padding:6px 8px; }

/* =========================================================
   Rules map table
   ========================================================= */
.table-wrap{ overflow-x: auto; }
.rules-table select{ min-width: 180px; }
.inline-check{ display:inline-flex; gap:8px; align-items:center; }
.inline-check input{ width:auto; }

.rules-table.compact th, .rules-table.compact td{ padding:8px; }
.rules-table.compact select{ width:100%; min-width: 0; }
.rules-table .col-type{ width: 180px; }
.rules-table .col-case{ width: 90px; }
.rules-table .col-opt{ width: 90px; }

.rule-label-row td{
  background: var(--table-head);
  border-top:1px solid var(--border);
  font-size: 13px;
  padding-top:10px;
  padding-bottom:6px;
}

/* Advanced section styling (token-based) */
.advanced-cell{
  padding: 0 !important;
  background: color-mix(in srgb, var(--card) 70%, var(--bg));
  border-top: 1px solid var(--border);
}

.advanced-box{
  padding: 16px;
  background: color-mix(in srgb, var(--card) 82%, var(--bg));
  border-left: 4px solid color-mix(in srgb, var(--primary) 80%, var(--border));
}

/* Better grid alignment */
.advanced-grid{
  display:grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap:14px 12px;
  align-items:start;
}

.advanced-grid > div{
  display:flex;
  flex-direction:column;
  min-width:0;
}

.advanced-grid label{
  font-weight:700;
  margin-bottom:4px;
  line-height:1.2;
}

.advanced-grid .muted{
  font-size:12px;
  margin-top:4px;
  line-height:1.45;
}

.advanced-grid input:not([type="checkbox"]),
.advanced-grid select{
  height:38px;
  min-height:38px;
  padding:8px 12px;
  line-height:1.2;
  width:100%;
  box-sizing:border-box;
}

.js-adv-row{ transition: opacity 0.2s ease; }

/* =========================================================
   Tabs
   ========================================================= */
.tabs{ display:flex; gap:6px; align-items:flex-end; }
.tab{
  display:inline-block;
  padding:10px 14px;
  border:1px solid var(--border);
  border-bottom:none;
  border-top-left-radius:12px;
  border-top-right-radius:12px;
  background: color-mix(in srgb, var(--card) 75%, var(--bg));
  color: var(--text) !important;
  text-decoration:none;
  font-weight: 700;
}
.tab.active{
  background: var(--primary);
  color: var(--on-primary) !important;
  position:relative;
  top:1px;
}

/* =========================================================
   Report layout (Excel-like)
   ========================================================= */
.report-title{ margin: 8px 0 10px; }
.report-top{ padding: 10px 12px; }
.report-top hr{ margin:10px 0; }
.top-row{ display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }

.report-scroll{
  height: calc(100vh - 140px);
  min-height: 760px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}

/* Two-panel sheet */
.excel-sheet{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:0;
}
@media (max-width: 1100px){ .excel-sheet{ grid-template-columns: 1fr; } }

.excel-panel{ border-right:1px solid var(--border); }
.excel-panel:last-child{ border-right:none; }

.excel-header{
  padding:10px 12px;
  font-weight: 800;
  background: var(--table-head);
  border-bottom:1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Excel tables */
.excel-table{
  width:100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.excel-table th, .excel-table td{
  border-bottom:1px solid var(--border);
  border-right:1px solid var(--border);
  padding:3px 6px;
  vertical-align: middle;
  font-size:12px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  line-height: 12px;
}
.excel-table th:last-child, .excel-table td:last-child{ border-right:none; }

.excel-table thead th{
  background: var(--table-head-2);
  position: sticky;
  top: 44px; /* below excel-header */
  z-index: 1;
}

/* widths */
.col-pick{ width:26px; text-align:center; }
.excel-table th.col-pick, .excel-table td.col-pick{ padding-left:4px; padding-right:4px; }
.col-status{ width:90px; }
.col-rules{ width:140px; }

.ghost-check{
  visibility:hidden;
  width:16px;
  height:16px;
  margin:0;
  padding:0;
}

/* Status colors */
.row-green{ background: var(--row-green); }
.row-red{ background: var(--row-red); }

/* Preview selection */
.row-red-preview{
  background: var(--row-red);
  outline:2px dashed var(--warn-outline);
  outline-offset:-2px;
}
.row-green-preview{
  background: var(--row-green);
  outline:2px dashed var(--warn-outline);
  outline-offset:-2px;
}

/* Sticky action bar */
.sticky-actions{
  position: sticky;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  z-index: 3;
}

/* Override badge */
.badge-override{
  display:inline-block;
  margin-left:6px;
  padding:2px 8px;
  font-size:12px;
  border-radius:999px;
  border:1px solid var(--border);
  background: var(--card);
  white-space: nowrap;
  color: var(--text);
}

/* Single-table matched view */
.excel-one{ padding:0; }

.excel-table-one{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto; /* allow natural width */
}

/* merged panel headers */
.head-merged{
  background: var(--table-head);
  font-weight: 800;
  border-bottom:1px solid var(--border);
  padding:10px 12px;
}

/* separator column */
.sep-col, .sep-head{
  width: 2px !important;
  min-width: 2px !important;
  max-width: 2px !important;
  padding: 0 !important;
  background: var(--sep);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* Keep row height stable */
.excel-table-one th, .excel-table-one td{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 12px;
}

/* Frozen 2-row header */
.excel-table-one thead tr:first-child th{
  position: sticky !important;
  top: 0 !important;
  z-index: 5 !important;
  background: var(--table-head);

  height: 30px;
  line-height: 30px;
  padding-top: 0 !important;
  padding-bottom: 0 !important;

  border-bottom: 0 !important;
}
.excel-table-one thead tr:nth-child(2) th{
  position: sticky !important;
  top: 30px !important;
  z-index: 4 !important;
  background: var(--table-head-2);

  height: 26px;
  line-height: 26px;
  padding-top: 0 !important;
  padding-bottom: 0 !important;

  border-top: 0 !important;
  border-bottom: 1px solid var(--border);
}
.excel-table-one thead th{ transform: translateZ(0); }

/* Normal data columns fixed width (your choice) */
.excel-table-one th:not(.col-pick):not(.sep-col):not(.sep-head):not(.col-rules),
.excel-table-one td:not(.col-pick):not(.sep-col):not(.sep-head):not(.col-rules){
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}
.excel-table-one .col-pick{ min-width: 26px; width: 26px; }
.excel-table-one .col-rules{ min-width: 100px; width: 100px; }



/* =========================================================
   Stepper component (token-based)
   ========================================================= */

.tb-stepper{
  display:flex;
  align-items:center;
  gap:8;
  margin: 8px 0 10px;
  padding:8px 10px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  overflow-x:auto;
  box-shadow: var(--shadow);
}

.tb-step{
  display:flex;
  align-items:center;
  flex:1 1 0;
  min-width:160px;
  gap: 8px;
}

.tb-step-link{
  display:inline-flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:inherit;
  min-width:0;
  min-height: 30px;
  padding: 4px 6px;

}

.tb-step-link.is-disabled{
  opacity:.75;
  cursor:default;
}

.tb-step-dot{
  width:24px;
  height:24px;
  min-width:24px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:800;
  border:1px solid var(--border);
  background:var(--card-2);
  color:var(--muted);
}

.tb-step-text{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
  white-space:nowrap;
  line-height: 1.15;
}

.tb-step-line{
  height:2px;
  flex:1 1 auto;
  min-width:28px;
  margin:0 6px;
  background:var(--border);
  border-radius:999px;
}

.tb-step.done .tb-step-dot{
  background:var(--success-bg);
  border-color:var(--success-border);
  color:var(--success);
}

.tb-step.done .tb-step-text{
  color:var(--success);
}

.tb-step.current .tb-step-dot{
  background:var(--card);
  border-color:var(--primary);
  color:var(--primary);
  box-shadow:0 0 0 3px var(--focus);
}

.tb-step.current .tb-step-text{
  color:var(--primary);
}

.tb-step.done .tb-step-line{
  background:var(--success-border);
}

@media (max-width: 768px){
  .tb-stepper{
    padding:10px 12px;
  }

  .tb-step{
    min-width:140px;
  }

  .tb-step-text{
    font-size:12px;
  }
}

/* =========================================================
   Reconciliation page hero / header
   ========================================================= */

.tb-page-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin: 0 0 12px;
  padding:16px 18px;
  background:linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow: var(--shadow);
}

.tb-page-hero-main{
  min-width:0;
  flex:1 1 auto;
}

.tb-page-kicker{
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted);
  margin-bottom:6px;
}

.tb-page-title{
  margin:0;
  font-size:28px;
  line-height:1.15;
  font-weight:800;
  color:var(--text);
}

.tb-page-subtitle{
  margin-top:8px;
  font-size:14px;
  line-height:1.45;
  color:var(--muted);
  max-width:760px;
}

.tb-page-hero-side{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:8px;
  min-width:260px;
}

.tb-meta-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:32px;
  padding:6px 12px;
  border-radius:999px;
  border:1px solid var(--badge-border);
  background:var(--badge-bg);
  font-size:12px;
  font-weight:700;
  color:var(--badge-text);
  white-space:nowrap;
  padding: 6px 10px;  
}

.tb-status-pill.is-draft{
  background:var(--badge-warning-bg);
  border-color:var(--badge-warning-border);
  color:var(--badge-warning-text);
}

.tb-status-pill.is-completed{
  background:var(--badge-success-bg);
  border-color:var(--badge-success-border);
  color:var(--badge-success-text);
}

.tb-status-pill.is-archived{
  background:var(--badge-archived-bg);
  border-color:var(--badge-archived-border);
  color:var(--badge-archived-text);
}

@media (max-width: 920px){
  .tb-page-hero{
    flex-direction:column;
    align-items:stretch;
  }

  .tb-page-hero-side{
    justify-content:flex-start;
    min-width:0;
  }

  .tb-page-title{
    font-size:24px;
  }
}


/* File upload two-column layout */
.file-upload-row {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.file-upload-col {
    flex: 1;
    min-width: 280px; /* allows stacking on small screens */
}

.file-upload-col input[type="file"] {
    width: 100%;
}

/* =========================================================
   Multi-select dropdown (msd)
   ========================================================= */
.msd{
  position:relative;
  min-width:170px;
  overflow:visible;
}

.msd-btn{
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--input-text);
  text-align:left;
  cursor:pointer;
  font-weight: 600;
}
.msd.open .msd-menu{ display:block; }

.msd-menu{
  display:none;
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  z-index:120;
  width:max-content;
  min-width:100%;
  max-width:min(420px, 92vw);
  max-height:280px;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--card);
  box-shadow:var(--shadow-lg);
  padding:8px;
  text-align:left;
}

.msd-actions{
  position:sticky;
  top:0;
  z-index:1;
  display:flex;
  gap:8px;
  margin-bottom:8px;
  padding-bottom:8px;
  background:var(--card);
  border-bottom:1px solid var(--border);
}

.msd-actions button{
  width:auto;
  margin-top:0;
  padding:6px 10px;
  border-radius:12px;
  border:1px solid var(--btn-2-border);
  background: var(--btn-2-bg);
  color: var(--btn-2-text);
  cursor:pointer;
  font-size:12px;
  font-weight: 700;
}
.msd-actions button:hover{ background: var(--btn-2-bg-hover); }

.msd-item{
  display:flex !important;
  justify-content:flex-start !important;
  align-items:center !important;
  gap:8px !important;
  padding:6px 8px !important;
  margin:0 !important;
  width:100%;
  border-radius: 10px;
}
.msd-item:hover{ background: var(--btn-2-bg-hover); }

.msd-item input[type="checkbox"]{
  margin:0 !important;
  padding:0 !important;
  width:16px;
  height:16px;
  flex:0 0 16px;
}
.msd-item span{
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

#tbReportPrefsPanel,
#tbReportPrefsPanel .tb-review-panel-body,
#tbReportPrefsPanel .filter-row,
#tbReportPrefsPanel .filter-col{
  overflow:visible !important;
}

/* =========================================================
   Export modal (token-based)
   ========================================================= */
.modal{ position:fixed; inset:0; display:none; z-index:9999; }
.modal.open{ display:block; }

.modal-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.35); }

.modal-card{
  position:relative;
  width:min(920px, calc(100vw - 24px));
  margin: 6vh auto;
  background: var(--card);
  border-radius: 16px;
  border:1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display:flex;
  flex-direction:column;
  max-height: calc(100vh - 60px);
}

.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  background: var(--card-2);
}

.modal-body{
  padding:14px;
  flex: 1 1 auto;
  overflow:auto;
  padding-bottom: 80px; /* ensure dropdown never hides behind footer */
}

.modal-foot{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding:12px 14px;
  border-top:1px solid var(--border);
  background: var(--card);
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.two-col{ display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
@media (max-width: 900px){ .two-col{ grid-template-columns: 1fr; } }

.actions-row{ display:flex; gap:10px; align-items:center; }
.actions-row button{ width:auto; margin-top:0; }

/* Ensure dropdown inside modal scrolls internally */
.modal .msd-menu{
  max-height: 240px;
  overflow-y: auto;
  z-index: 200; /* above modal footer */
}


/* =========================================================
   Shared premium confirm / alert modal
   ========================================================= */

#tbConfirmModal.tb-modal{
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

#tbConfirmModal.tb-modal[aria-hidden="false"]{
  display: flex !important;
}

#tbConfirmModal .tb-confirm-modal-card{
  width: min(520px, calc(100vw - 32px));
  max-width: 520px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

#tbConfirmModal .tb-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 20px 12px;
  border-bottom:1px solid var(--border);
}

#tbConfirmModal .tb-modal-head h3{
  margin:0;
  font-size:18px;
  line-height:1.3;
  font-weight:800;
  color:var(--text);
}

#tbConfirmModal .tb-modal-close{
  width:32px !important;
  height:32px !important;
  min-width:32px !important;
  max-width:32px !important;
  padding:0 !important;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--btn-2-bg);
  color:var(--btn-2-text);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  flex:0 0 32px !important;
  line-height:1;
  font-size:18px;
}

#tbConfirmModal .tb-modal-close:hover{
  background:var(--btn-2-bg-hover);
}

#tbConfirmModal .tb-modal-body{
  display:flex;
  gap:14px;
  align-items:flex-start;
  padding:18px 20px;
}

#tbConfirmModal .tb-confirm-icon{
  width:44px;
  height:44px;
  min-width:44px;
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:24px;
  font-weight:900;
  border:1px solid var(--border);
  background:var(--card-2);
  color:var(--text);
  line-height:1;
}

#tbConfirmModal .tb-confirm-content{
  flex:1 1 auto;
  min-width:0;
}

#tbConfirmModal .tb-confirm-message{
  font-size:14px;
  line-height:1.6;
  color:var(--text);
}

#tbConfirmModal .tb-modal-actions{
  display:flex;
  justify-content:flex-end !important;
  align-items:center;
  gap:10px;
  padding:0 20px 18px;
}

#tbConfirmModal .tb-modal-actions .tb-btn,
#tbConfirmModal .tb-modal-actions button,
#tbConfirmModal #tbConfirmCancel,
#tbConfirmModal #tbConfirmOk{
  width:auto !important;
  min-width:92px;
  flex:0 0 auto !important;
  margin:0 !important;
}

#tbConfirmModal.tb-confirm-mode-danger .tb-confirm-icon{
  background:var(--badge-danger-bg);
  border-color:var(--badge-danger-border);
  color:var(--badge-danger-text);
}

#tbConfirmModal.tb-confirm-mode-info .tb-confirm-icon{
  background:var(--badge-info-bg);
  border-color:var(--badge-info-border);
  color:var(--badge-info-text);
}

#tbConfirmModal.tb-confirm-mode-success .tb-confirm-icon{
  background:var(--badge-success-bg);
  border-color:var(--badge-success-border);
  color:var(--badge-success-text);
}

@media (max-width: 640px){
  #tbConfirmModal.tb-modal{
    padding:16px;
  }

  #tbConfirmModal .tb-confirm-modal-card{
    width: calc(100vw - 24px);
  }

  #tbConfirmModal .tb-modal-body{
    padding:16px;
  }

  #tbConfirmModal .tb-modal-actions{
    padding:0 16px 16px;
    flex-wrap:wrap;
    justify-content:flex-end !important;
  }
}

/* =========================================================
   PDF table helpers (token-safe)
   ========================================================= */
table.pdf-table{
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
}
.pdf-table th, .pdf-table td{
  border:1px solid var(--border);
  padding:4px 6px;
  font-size:11px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  min-width:0 !important;
  background: var(--card);
  color: var(--text);
}
.pdf-table th{ background: var(--table-head); }

.pdf-table col.sepcol{ width:4px !important; }
.pdf-table th.sep, .pdf-table td.sep{
  width:4px !important;
  min-width:4px !important;
  max-width:4px !important;
  padding:0 !important;
  background: var(--sep);
}

/* Company sidebar (narrow icon + label) */
.company-shell{
  display:grid;
  grid-template-columns: 84px 1fr;
  gap:14px;
  align-items:start;
}

.csb{
  position: sticky;
  top: 18px;
  border:1px solid var(--border);
  background: var(--card);
  border-radius: 16px;
  padding:10px 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

.csb-toggle{
  width:100%;
  background: transparent;
  border:1px solid var(--border);
  color: var(--text);
  padding:8px 0;
  border-radius: 12px;
  cursor:pointer;
}
.csb-toggle svg{ width:18px; height:18px; }

.csb-nav{ margin-top:10px; display:flex; flex-direction:column; gap:8px; }

.csb-item{
  text-decoration:none;
  color: var(--text);
  border:1px solid transparent;
  border-radius: 14px;
  padding:10px 6px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.csb-ico{
  width:22px; height:22px;
  display:flex; align-items:center; justify-content:center;
  color: var(--muted);
}
.csb-ico svg{ width:22px; height:22px; }

.csb-label{
  font-size: 11px;
  line-height: 1.1;
  text-align:center;
  color: var(--muted);
}

.csb-item:hover{
  background: color-mix(in srgb, var(--card) 70%, var(--bg));
  border-color: var(--border);
  transform: translateY(-1px);
}
.csb-item:hover .csb-ico{ color: var(--text); }
.csb-item:hover .csb-label{ color: var(--text); }

.csb-item.active{
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}
.csb-item.active .csb-ico{ color: var(--primary); }
.csb-item.active .csb-label{ color: var(--text); }

.csb-disabled{
  opacity: .55;
  cursor: default;
}
.csb-disabled:hover{ transform:none; }

/* Retractable */
.csb.collapsed .csb-label{ display:none; }
.csb.collapsed{ width:54px; }
.company-shell:has(.csb.collapsed){
  grid-template-columns: 54px 1fr;
}


/* =====================
   Auth Layout
   ===================== */

.auth-shell{
  min-height: 100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding: 42px 16px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.04), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.035), transparent 30%),
    var(--bg);
}

.auth-brand{
  display:flex;
  justify-content:center;
  margin: 0 0 18px 0;
}

.auth-brand img{
  height: 64px;
  width: auto;
  display:block;
  opacity: 0.95;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.auth-brand img:hover{
  transform: translateY(-1px);
  opacity: 1;
}

.auth-card{
  width: 100%;
  max-width: 480px;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.auth-card.auth-card-wide{
  max-width: 560px;
}

.auth-logo,
.auth-kicker{
  display:none;
}

.auth-title{
  margin: 0 0 8px 0;
  text-align: center;
  font-size: clamp(28px, 4vw, 34px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -.02em;
}

.auth-sub{
  margin: 0 0 20px 0;
  text-align:center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.auth-form{
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.auth-section{
  margin-top: 18px;
}

.auth-divider{
  display:flex;
  align-items:center;
  gap:12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.auth-divider::before,
.auth-divider::after{
  content:"";
  flex:1;
  height:1px;
  background: var(--border);
}

.auth-alert{
  margin: 0 0 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
}

.auth-alert-error{
  border-color: rgba(220, 53, 69, .22);
  background: rgba(220, 53, 69, .08);
  color: #991b1b;
}

.auth-alert-success{
  border-color: rgba(25, 135, 84, .22);
  background: rgba(25, 135, 84, .08);
  color: #166534;
}

.auth-link-row{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap: 12px;
  margin-top: 8px;
  margin-bottom: 2px;
}

.auth-link-row-split{
  justify-content: space-between;
}

.auth-link-row a{
  font-size: 13px;
  text-decoration: none;
}

.auth-footer-note{
  margin-top: 18px;
  text-align:center;
  color: var(--muted);
  font-size: 14px;
}

.auth-footer-note a{
  font-weight: 700;
}

.auth-help-note{
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-help-note a{
  color: var(--primary);
  font-weight: 850;
  text-decoration: none;
}

.auth-help-note a:hover{
  text-decoration: underline;
}

.tb-billing-support-note{
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  text-align: center;
  border-radius: 14px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tb-billing-support-note a{
  color: var(--primary);
  font-weight: 850;
  text-decoration: none;
}

.tb-billing-support-note a:hover{
  text-decoration: underline;
}

.legal-page a,
.card .muted a{
  color: var(--primary);
  font-weight: 850;
  text-decoration: none;
}

.legal-page a:hover,
.card .muted a:hover{
  text-decoration: underline;
}

.auth-actions{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top: 16px;
  flex-wrap:wrap;
}

.auth-actions > *{
  flex: 1 1 180px;
}

.auth-meta{
  display:grid;
  gap:10px;
  margin-top: 16px;
}

.auth-meta-item{
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--soft);
}

.auth-meta-label{
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.auth-meta-value{
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}

.auth-help-list{
  margin: 16px 0 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-field-hint{
  margin-top: -2px;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

@media (max-width: 640px){
  .auth-shell{
    padding: 24px 12px;
  }

  .auth-brand{
    margin-bottom: 18px;
  }

  .auth-brand img{
    width: min(200px, 72vw);
  }

  .auth-card{
    padding: 22px 18px;
    border-radius: 20px;
  }

  .auth-actions{
    flex-direction: column;
  }

  .auth-actions > *{
    width: 100%;
    flex: 1 1 auto;
  }
}

/* =====================
   Auth Utilities
   ===================== */

.auth-inline-note{
  margin: 10px 0 0;
  text-align:center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-back-link{
  margin-top: 16px;
  text-align:center;
  color: var(--muted);
  font-size: 14px;
}

.auth-back-link a{
  font-weight: 700;
}

.auth-select-card{
  display:grid;
  gap:12px;
  margin-top: 18px;
}

.auth-company-option{
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--soft);
}

.auth-company-name{
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
}

.auth-company-sub{
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.auth-field-wrap{
  position: relative;
}

.auth-field-wrap input{
  padding-right: 44px;
}

.pw-eye-btn{
  position:absolute;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  width:32px;
  height:32px;
  border-radius:10px;
  border:1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.pw-eye-btn:hover{
  background: var(--soft);
  color: var(--text);
}

.pw-eye-btn svg{
  width:18px;
  height:18px;
}

.pw-rules-box{
  margin-top:12px;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: var(--soft);
}

.pw-rules-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.pw-rules-label{
  font-size:12px;
  opacity:.9;
}

.pw-strength-label{
  font-size:12px;
  font-weight:700;
}

.pw-strength-track{
  height:8px;
  background: rgba(0,0,0,.08);
  border-radius:999px;
  overflow:hidden;
  margin-top:8px;
}

.pw-strength-bar{
  height:8px;
  width:0%;
  border-radius:999px;
  background: transparent;
}

.pw-rules-list{
  font-size:12px;
  margin:10px 0 0 18px;
  padding:0;
  opacity:.95;
  line-height:1.55;
}

.pw-message{
  margin-top:10px;
  font-size:12px;
  opacity:.9;
  line-height:1.5;
}

.auth-sub{
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}

.auth-card .btn-google{
  margin-bottom: 0;
}

.auth-form label + input,
.auth-form label + select,
.auth-form label + .auth-field-wrap{
  margin-top: 6px;
}

.auth-form label:not(:first-child){
  margin-top: 14px;
}

.auth-form button[type="submit"]{
  margin-top: 16px;
}

.auth-shell .muted a,
.auth-footer-note a,
.auth-back-link a,
.auth-link-row a{
  text-underline-offset: 2px;
}

.auth-company-option{
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.auth-company-option:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* =======================
   Topbar Brand / Logo
   ======================= */

.tb-brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color: var(--text);
  font-weight:800;
}

.tb-logo{
  height:32px;
  width:auto;
  display:block;
}

.tb-brand-text{
  font-size:16px;
  letter-spacing:.2px;
}

/* =========================================================
   Help Center Panel
   ========================================================= */

body.tb-help-open{
  overflow: hidden;
}

.tb-help-trigger{
  display:inline-flex;
  align-items:center;
  gap:8px;
  height:40px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  font-weight:700;
  cursor:pointer;
  margin-top: 0px;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.tb-help-trigger:hover{
  transform:translateY(-1px);
  box-shadow:var(--shadow-sm);
  background:var(--soft);
}

.tb-help-trigger-ico{
  width:18px;
  height:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
}

.tb-help-trigger-ico svg{
  width:18px;
  height:18px;
  stroke:currentColor;
}

.tb-help-panel{
  position:fixed;
  inset:0;
  z-index:10020;
  pointer-events:none;
}

.tb-help-panel.is-open{
  pointer-events:auto;
}

.tb-help-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15, 23, 42, 0.38);
  opacity:0;
  transition:opacity .2s ease;
}

.tb-help-panel.is-open .tb-help-backdrop{
  opacity:1;
}

.tb-help-drawer{
  position:absolute;
  top:0;
  right:0;
  width:min(460px, 100vw);
  height:100vh;
  background:var(--card);
  border-left:1px solid var(--border);
  box-shadow:-10px 0 28px rgba(0,0,0,.12);
  transform:translateX(100%);
  transition:transform .22s ease;
  display:flex;
  flex-direction:column;
}

.tb-help-panel.is-open .tb-help-drawer{
  transform:translateX(0);
}

.tb-help-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:18px 18px 14px;
  border-bottom:1px solid var(--border);
}

.tb-help-kicker{
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:4px;
}

.tb-help-head h3{
  margin:0;
  font-size:22px;
  line-height:1.1;
}

.tb-help-close{
  width:38px;
  height:38px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  font-size:24px;
  line-height:1;
  cursor:pointer;
}
.tb-help-close:hover{
  color:var(--white);
}

.tb-help-search-wrap{
  padding:14px 18px 12px;
  border-bottom:1px solid var(--border);
}

.tb-help-search{
  width:100%;
  height:42px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--soft);
  color:var(--text);
  outline:none;
}

.tb-help-search:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(var(--primary-dark-rgb), 0.12);
}

.tb-help-body{
  flex:1;
  min-height:0;
  overflow:hidden;
}

.tb-help-list-view,
.tb-help-article-view{
  height:100%;
  overflow:auto;
  padding:16px 18px 20px;
}

.tb-help-section-label{
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:10px;
}

.tb-help-quick{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:4px;
}

.tb-help-center-cta{
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px;
  align-items:center;
  margin:12px 0 2px;
  padding:12px;
  border:1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  border-radius:14px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--primary) 9%, var(--card)),
      color-mix(in srgb, var(--card) 92%, transparent)
    );
}

.tb-help-center-cta strong{
  display:block;
  color:var(--text);
  font-size:13px;
  font-weight:900;
  line-height:1.25;
}

.tb-help-center-cta span{
  display:block;
  margin-top:3px;
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
  font-weight:650;
}

.tb-help-center-cta a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:0 11px;
  border-radius:10px;
  border:1px solid var(--primary);
  background:var(--primary);
  color:var(--on-primary);
  text-decoration:none;
  font-size:12px;
  font-weight:900;
  white-space:nowrap;
}

.tb-help-center-cta a:hover{
  filter:brightness(.98);
  transform:translateY(-1px);
}

.tb-help-chip{
  width:100%;
  text-align:left;
  border:1px solid var(--border);
  background:var(--bg-2);
  color:var(--text);
  border-radius:10px;
  padding:6px 8px;
  font-size:12px;
  font-weight:700;
  line-height:1.15;
  cursor:pointer;
  min-height:34px;
  margin-top: 0;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.tb-help-chip:hover{
  background:var(--card);
  box-shadow:var(--shadow-sm);
  transform:translateY(-1px);
}

.tb-help-chip-title{
  display:block;
}

.tb-help-results{
  display:grid;
  gap:8px;
}

.tb-help-result,
.tb-help-related-item{
  width:100%;
  text-align:left;
  border:1px solid var(--border);
  background:var(--card);
  border-radius:14px;
  padding:12px;
  cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

.tb-help-result:hover,
.tb-help-related-item:hover{
  transform:translateY(-1px);
  box-shadow:var(--shadow-sm);
  background:var(--soft);
}

.tb-help-result-title,
.tb-help-related-title{
  font-size:15px;
  font-weight:800;
  color:var(--text);
  line-height:1.35;
}

.tb-help-result-summary,
.tb-help-related-summary{
  margin-top:4px;
  font-size:13px;
  line-height:1.45;
  color:var(--muted);
}

.tb-help-result-meta{
  margin-top:6px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--muted);
}

.tb-help-empty{
  padding:18px 14px;
  border:1px dashed var(--border);
  border-radius:14px;
  background:var(--soft);
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
}

.tb-help-back{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:0;
  background:transparent;
  color:var(--muted);
  font-weight:700;
  padding:0;
  margin:0 0 14px;
  cursor:pointer;
}

.tb-help-back svg{
  width:18px;
  height:18px;
  stroke:currentColor;
  fill:none;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.tb-help-article-section{
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:8px;
}

.tb-help-article-title{
  margin:0;
  font-size:24px;
  line-height:1.15;
}

.tb-help-article-summary{
  margin:10px 0 0;
  color:var(--muted);
  font-size:14px;
  line-height:1.6;
}

.tb-help-article-body{
  margin-top:16px;
  font-size:14px;
  line-height:1.7;
  color:var(--text);
}

.tb-help-article-body p{
  margin:0 0 12px;
}

.tb-help-article-body ul,
.tb-help-article-body ol{
  margin:0 0 12px 18px;
}

.tb-help-related-wrap{
  margin-top:22px;
  padding-top:18px;
  border-top:1px solid var(--border);
}

.tb-help-related{
  display:grid;
  gap:10px;
}

.tb-help-group{
  display:grid;
  gap:8px;
}

.tb-help-separator{
  height:1px;
  background:var(--border);
  margin:10px 0;
}

.tb-help-feedback{
  margin-top:16px;
}

.tb-help-feedback-card{
  border:1px solid var(--border);
  background:var(--soft);
  border-radius:14px;
  padding:14px;
}

.tb-help-feedback-card.is-thanks{
  background:rgba(25, 135, 84, .08);
  border-color:rgba(25, 135, 84, .22);
}

.tb-help-feedback-card.is-error{
  background:rgba(220, 53, 69, .08);
  border-color:rgba(220, 53, 69, .22);
}

.tb-help-feedback-title{
  font-size:14px;
  font-weight:800;
  color:var(--text);
  line-height:1.35;
}

.tb-help-feedback-sub{
  margin-top:4px;
  font-size:13px;
  line-height:1.5;
  color:var(--muted);
}

.tb-help-feedback-actions{
  display:flex;
  gap:8px;
  margin-top:10px;
}

.tb-help-feedback-btn{
  min-width:72px;
  height:36px;
  padding:0 14px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  font-size:13px;
  font-weight:700;
  cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.tb-help-feedback-btn:hover{
  transform:translateY(-1px);
  box-shadow:var(--shadow-sm);
  background:var(--soft);
}

.tb-help-feedback-meta{
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
}

@media (max-width: 760px){
  .tb-help-trigger span:last-child{
    display:none;
  }

  .tb-help-trigger{
    width:40px;
    justify-content:center;
    padding:0;
  }

  .tb-help-drawer{
    width:100vw;
  }
  .tb-help-center-cta{
    grid-template-columns:1fr;
  }

  .tb-help-center-cta a{
    width:100%;
  }
}


/* ============================
   Ultra Premium "..." Row Menu
   Token-based (no hard-coded colors)
   ============================ */

.tb-row-actions{
  position:relative;
  display:inline-flex;
  justify-content:center;   /* was flex-end */
}
.tb-kebab{
  width:34px;
  height:34px;
  border-radius:12px;
  border:1px solid var(--btn-2-border);
  background: color-mix(in srgb, var(--card) 82%, var(--bg));
  color: var(--text);
  cursor:pointer;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.tb-kebab svg{
  width:18px;
  height:18px;
  fill: currentColor;
  stroke: currentColor;
}
.tb-kebab svg circle{
  fill: currentColor;
  stroke: none;
}

.tb-kebab:hover{
  background: color-mix(in srgb, var(--card) 70%, var(--bg));
  transform: translateY(-1px);
}
.tb-kebab:focus{
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
}

.tb-menu-pop{
  position: fixed;         /* was absolute */
  width: 240px;
  border-radius: 18px;
  border:1px solid var(--border);
  background: color-mix(in srgb, var(--card) 86%, var(--bg));
  box-shadow: var(--shadow-lg);
  overflow:hidden;
  z-index: 9999;
  display:none;
  transform-origin: top right;
  animation: tbMenuIn .14s ease-out;

  /* safety for small screens */
  /*max-height: min(420px, calc(100vh - 24px));*/
  max-height: min(360px, calc(100vh - 24px));  /* was 420px or none */
}
@keyframes tbMenuIn{
  from{ opacity:0; transform: translateY(-6px) scale(.98); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}
.tb-menu-pop.open{ display:block; }

/* header in menu */
.tb-menu-head{
  padding: 10px 12px 18px;
  background: color-mix(in srgb, var(--card-2) 80%, var(--bg));
  border-bottom:1px solid var(--border);
}
.tb-menu-title{ font-weight: 900; font-size: 13px; letter-spacing:.2px; }
.tb-menu-sub{ margin-top:2px; font-size:11.5px; color: var(--muted); }

/* items */
.tb-menu-items{ padding: 8px; }
.tb-mi{
  width:100%;
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;       /* reduced from 10px */
  border-radius: 12px;     /* slightly tighter */
  text-decoration:none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  cursor:pointer;
  font-weight: 700;
  font-size: 12.5px;       /* slightly smaller */
  line-height: 1.2;
  justify-content:flex-start;
}
.tb-mi:hover{
  background: var(--btn-2-bg-hover);
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
  transform: translateY(-1px);
}
.tb-mi:active{ transform: translateY(0); }


.tb-mi-ico{
  width:16px;
  height:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: var(--muted);
  flex: 0 0 16px;
}
.tb-mi-ico svg{
  width:16px;
  height:16px;
}
.tb-mi:hover .tb-mi-ico{ color: var(--text); }

.tb-mi-text{
  flex: 1 1 auto;
  min-width:0;
  text-align:left;         /* ensure left */
}


.tb-mi-chip{
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: color-mix(in srgb, var(--card) 70%, var(--bg));
  color: var(--muted);
}

.tb-mi-sep{
  height:1px;
  background: var(--border);
  margin: 8px 8px;
  opacity: .9;
}

.tb-mi.danger{
  color: color-mix(in srgb, var(--error-border) 85%, var(--text));
}
.tb-mi.danger:hover{
  background: var(--error-bg);
  border-color: color-mix(in srgb, var(--error-border) 55%, var(--border));
}

/* Make button items look identical to link items */
button.tb-mi{
  appearance:none;
  -webkit-appearance:none;
  background: transparent;
}

/* Scroll only the items area */
.tb-menu-items{
  max-height: calc(min(360px, calc(100vh - 24px)) - 54px); /* subtract header height */
  overflow-y: auto;
  padding: 6px; /* slightly tighter */
}

/* nicer scrollbar (optional, token-safe) */
.tb-menu-items::-webkit-scrollbar{ width: 10px; }
.tb-menu-items::-webkit-scrollbar-track{ background: var(--scrollbar-track); border-radius: 10px; }
.tb-menu-items::-webkit-scrollbar-thumb{ background: var(--scrollbar-thumb); border-radius: 10px; }

/* -----------------------------
   Subscriptions (pricing grid)
------------------------------ */
.subs-header{
  display:flex;
  gap:16px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.subs-current{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px 14px;
  background: var(--card, #fff);
  min-width:260px;
}

/* 3 cards side-by-side on wide screens, responsive down */
.subs-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:16px;
}

@media (max-width: 1100px){
  .subs-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px){
  .subs-grid{ grid-template-columns: 1fr; }
}

.subs-card{
  position:relative;
  border:1px solid var(--border);
  border-radius:16px;
  background: var(--card, #fff);
  box-shadow: 0 10px 28px rgba(0,0,0,0.06);
  overflow:hidden;

  /* make each card tall + consistent and allow CTA to sit at bottom */
  display:flex;
  flex-direction:column;
  min-height: 520px;
}

.subs-card.is-highlight{
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}
.subs-card.is-current{
  border-color: color-mix(in srgb, var(--primary) 65%, var(--border));
}

/* top accent bar like the screenshot */
.subs-card-accent{
  height:4px;
  background: color-mix(in srgb, var(--primary) 85%, #fff);
}

.subs-card-head{
  padding:18px 18px 8px;
  text-align:center;
}

.subs-card-name{
  font-size:18px;
  font-weight:950;
  display:inline-flex;
  align-items:center;
  gap:10px;
}

.subs-pill{
  font-size:12px;
  font-weight:900;
  padding:4px 10px;
  border-radius:999px;
  background: color-mix(in srgb, var(--primary) 16%, #fff);
  border:1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  color: var(--primary);
}

.subs-card-price{
  margin-top:14px;
}

.subs-price-main{
  font-size:34px;
  font-weight:950;
  letter-spacing:-0.5px;
  line-height:1.05;
}

.subs-price-sub{
  font-size:12px;
  margin-top:6px;
}

/* feature list */
.subs-features{
  list-style:none;
  margin: 10px 0 0;
  padding: 0 18px 0;
  display:flex;
  flex-direction:column;
  gap:12px;
  flex: 1; /* takes space so CTA stays at bottom */
}

.subs-features li{
  position:relative;
  padding-left:28px;
  line-height:1.35;
}

.subs-features li::before{
  content:"✓";
  position:absolute;
  left:0;
  top:0;
  font-weight:950;
  color: var(--primary);
}

/* CTA pinned at bottom */
.subs-card-cta{
  padding:16px 18px 18px;
  margin-top:auto;
}

.filter-row-inline{
  display:grid;
  grid-template-columns: minmax(80px, 0.78fr) 92px minmax(80px, 0.78fr) 92px minmax(150px, 1.1fr) minmax(150px, 1.1fr) auto;
  gap:8px;
  align-items:end;
}

.filter-row-inline > hr{
  display:none;
}

.filter-col{
  min-width:0;
}

.filter-col label{
  white-space:nowrap;
}

.filter-col select,
.filter-col .msd,
.filter-col .msd-btn{
  width:100%;
  min-width:0;
}

.filter-col.dir-col{
  min-width:92px;
  max-width:92px;
}

.filter-col.dir-col select{
  min-width:92px;
}

.actions-inline-col{
  min-width:max-content;
}

.actions-inline-col label{
  display:block;
  visibility:hidden;
  height:18px;
  margin-bottom:6px;
}

.report-top-inline-actions{
  display:flex;
  gap:6px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:nowrap;
}

.report-top-inline-actions > button{
  width:auto;
  margin-top:0;
  white-space:nowrap;
  padding:7px 10px;
  font-size:12px;
}

.tb-group-row-line{
  margin-bottom:2px;
  line-height:12px;
}

.tb-group-row-line:last-child{
  margin-bottom:0;
}

@media (max-width: 1400px){
  .filter-row-inline{
    grid-template-columns: minmax(80px, 0.78fr) 92px minmax(80px, 0.78fr) 92px minmax(150px, 1fr) minmax(150px, 1fr);
  }

  .actions-inline-col{
    grid-column: 1 / -1;
  }

  .report-top-inline-actions{
    justify-content:flex-start;
    flex-wrap:wrap;
  }
}

.recon-meta{
  display:flex;
  gap:24px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom:6px;
}

.recon-meta div{
  font-size:14px;
}

.recon-readonly{
  background:rgba(0,0,0,0.06);
  padding:4px 10px;
  border-radius:6px;
  font-size:12px;
  font-weight:500;
}


/* ============================
   Settings page (token-based)
   ============================ */
.settings-grid{
    display:grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap:16px;
    align-items:start;
    margin-bottom:16px;
  }

  @media (max-width: 1180px){
    .settings-grid{
      grid-template-columns: 1fr;
    }
  }

  .settings-card{
    margin:0;
    height:100%;
  }

  .settings-card h2{
    margin:0;
    font-size:18px;
  }

  .settings-card h3{
    margin:0 0 6px;
    font-size:14px;
  }

  .settings-card-head{
    display:flex;
    align-items:flex-start;
    gap:12px;
    margin-bottom:14px;
  }

  .settings-card-head-text{
    min-width:0;
  }

  .settings-card-head-text .settings-sub{
    margin:6px 0 0;
  }

  .settings-card-ico{
    width:42px;
    height:42px;
    border-radius:14px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid var(--border);
    background: color-mix(in srgb, var(--card) 84%, var(--bg));
    box-shadow: var(--shadow);
    flex:0 0 auto;
  }

  .settings-card-ico svg{
    width:20px;
    height:20px;
    stroke:currentColor;
  }

  .settings-card-ico.user{
    background: color-mix(in srgb, var(--primary) 12%, var(--card));
  }

  .settings-card-ico.password{
    background: color-mix(in srgb, var(--warn-outline) 14%, var(--card));
  }

  .settings-card-ico.security{
    background: color-mix(in srgb, var(--success-border) 14%, var(--card));
  }

  .settings-sub{
    color:var(--muted);
    font-size:13px;
    margin-bottom:14px;
    line-height:1.45;
  }

  .settings-kv{
    display:grid;
    grid-template-columns: 110px 1fr;
    gap:10px 12px;
    align-items:start;
    margin-top:10px;
  }

  .settings-kv .k{
    font-size:12px;
    color:var(--muted);
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.2px;
  }

  .settings-kv .v{
    font-size:14px;
    line-height:1.45;
  }

  .settings-note{
    margin-top:12px;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:12px;
    background: color-mix(in srgb, var(--card) 88%, var(--bg));
    font-size:13px;
    line-height:1.45;
  }

  .settings-form-compact label{
    margin-top:10px;
  }

  .settings-actions{
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:wrap;
    margin-top:14px;
  }

  .settings-section-divider{
    margin:16px 0;
    border:0;
    border-top:1px solid var(--border);
  }

  .pw-eye-btn{
    position:absolute;
    right:2px;
    top:23%;
    transform:translateY(-50%);
    width:32px;
    height:32px;
    border-radius:10px;
    border:1px solid var(--border-color, rgba(255,255,255,.2));
    background: var(--card-bg, rgba(255,255,255,.05));
    color: var(--text-color, #6c757d);
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
  }

  .pw-rules-box{
    margin-top:12px;
    padding:12px;
    border-radius:12px;
    background: rgba(0,0,0,.03);
  }

  .security-status{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:8px 12px;
    border-radius:999px;
    font-size:13px;
    font-weight:800;
    border:1px solid var(--border);
    background: color-mix(in srgb, var(--card) 90%, var(--bg));
    margin-bottom:12px;
  }

  .security-status .dot{
    width:10px;
    height:10px;
    border-radius:999px;
    background: var(--warn-outline);
  }

  .security-status.enabled .dot{
    background: var(--success-border);
  }

  .backup-grid{
    display:grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap:8px;
  }

  .backup-code{
    font-family:ui-monospace, SFMono-Regular, Menlo, monospace;
    padding:10px;
    border:1px solid #e5e7eb;
    border-radius:10px;
    background:#fff;
  }

  .settings-forced-banner{
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--warn-outline);
    background: color-mix(in srgb, var(--warn-outline) 10%, var(--card));
    box-shadow: var(--shadow);
  }

  .settings-forced-banner-title{
    font-weight: 900;
    margin-bottom: 6px;
  }

  .settings-forced-banner-text{
    color: var(--text);
    line-height: 1.45;
    font-size: 14px;
  }

  .users-grid th.col-actions,
  .users-grid td.col-actions{
    text-align: left;
  }

  /* Tokens for status badges */
  .tb-report-summary{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px;
  margin: 12px 0 16px;
}

.tb-summary-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px 14px;
  box-shadow: var(--shadow);
  min-width:0;
  margin-bottom: 10px;
}

.tb-summary-card.is-good{
  background:var(--success-bg);
  border-color:var(--success-border);
}

.tb-summary-card.is-warn{
  background:var(--badge-warning-bg);
  border-color:var(--badge-warning-border);
}

.tb-summary-card-progress{
  grid-column: span 1;
}

.tb-summary-topline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:6px;
}

.tb-summary-label{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
  margin-bottom:4px;
}

.tb-summary-value{
  font-size:24px;
  line-height:1.1;
  font-weight:800;
  color:var(--text);
}

.tb-summary-sub{
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
  line-height:1.35;
}

.tb-status-badge{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:4px 10px;
  font-size:11px;
  font-weight:700;
  white-space:nowrap;
}

.tb-status-badge.is-draft{
  background:var(--badge-warning-bg);
  border:1px solid var(--badge-warning-border);
  color:var(--badge-warning-text);
}

.tb-status-badge.is-completed{
  background:var(--badge-success-bg);
  border:1px solid var(--badge-success-border);
  color:var(--badge-success-text);
}

.tb-progress{
  width:100%;
  height:8px;
  background:var(--border);
  border-radius:999px;
  overflow:hidden;
  margin-top:8px;
}

.tb-progress-bar{
  height:100%;
  background:linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
  border-radius:999px;
}

@media (max-width: 1200px){
  .tb-report-summary{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px){
  .tb-report-summary{
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Empty states
   ========================================================= */

.tb-empty-inline{
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:14px 16px;
  border:1px dashed var(--border);
  border-radius:12px;
  background:linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  color:var(--text);
}

.tb-empty-inline.compact{
  padding:10px 12px;
  gap:10px;
  border-radius:10px;
}

.tb-empty-card{
  display:flex;
  align-items:flex-start;
  gap:14px;
  padding:18px 20px;
  border:1px dashed var(--border);
  border-radius:14px;
  background:linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  color:var(--text);
  box-shadow: var(--shadow);
}

.tb-empty-icon{
  width:38px;
  height:38px;
  min-width:38px;
  border-radius:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--badge-bg);
  border:1px solid var(--badge-border);
  color:var(--badge-text);
  font-size:18px;
  font-weight:800;
  line-height:1;
}

.tb-empty-body{
  min-width:0;
  flex:1 1 auto;
}

.tb-empty-title{
  margin:0;
  font-size:14px;
  font-weight:800;
  color:var(--text);
  line-height:1.3;
}

.tb-empty-text{
  margin:4px 0 0;
  font-size:13px;
  line-height:1.45;
  color:var(--muted);
}

.tb-empty-actions{
  margin-top:10px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.tb-empty-cell{
  padding:12px !important;
  background:transparent !important;
}

@media (max-width: 680px){
  .tb-empty-card,
  .tb-empty-inline{
    padding:12px 14px;
  }

  .tb-empty-icon{
    width:34px;
    height:34px;
    min-width:34px;
    font-size:16px;
  }
}

/* =========================================================
   Workflow guidance cards / inline notes
   ========================================================= */

.tb-guide-card{
  display:flex;
  align-items:flex-start;
  gap:14px;
  margin: 0 0 14px;
  padding:16px 18px;
  border:1px solid var(--border);
  border-radius:14px;
  background:linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  box-shadow: var(--shadow);
}

.tb-guide-card.info{
  border-color: var(--badge-info-border);
}

.tb-guide-card.warn{
  border-color: var(--badge-warning-border);
}

.tb-guide-card.success{
  border-color: var(--badge-success-border);
}

.tb-guide-icon{
  width:40px;
  height:40px;
  min-width:40px;
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  font-weight:900;
  line-height:1;
  background:var(--badge-bg);
  border:1px solid var(--badge-border);
  color:var(--badge-text);
}

.tb-guide-card.info .tb-guide-icon{
  background:var(--badge-info-bg);
  border-color:var(--badge-info-border);
  color:var(--badge-info-text);
}

.tb-guide-card.warn .tb-guide-icon{
  background:var(--badge-warning-bg);
  border-color:var(--badge-warning-border);
  color:var(--badge-warning-text);
}

.tb-guide-card.success .tb-guide-icon{
  background:var(--badge-success-bg);
  border-color:var(--badge-success-border);
  color:var(--badge-success-text);
}

.tb-guide-body{
  min-width:0;
  flex:1 1 auto;
}

.tb-guide-title{
  font-size:15px;
  font-weight:800;
  color:var(--text);
  line-height:1.35;
  margin:0 0 4px;
}

.tb-guide-text{
  font-size:13px;
  line-height:1.55;
  color:var(--muted);
}

.tb-inline-note{
  margin: 0 0 10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--card-2);
  color:var(--text);
  font-size:13px;
  line-height:1.5;
}

.tb-inline-note.warn{
  background:var(--badge-warning-bg);
  border-color:var(--badge-warning-border);
  color:var(--badge-warning-text);
}

.tb-inline-note.success{
  background:var(--badge-success-bg);
  border-color:var(--badge-success-border);
  color:var(--badge-success-text);
}


/* =========================================
   SpeedRecon Wizard - Shared Step Header
   ========================================= */

.tb-wizard-card{
  margin-bottom: 14px;
}

.tb-step-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.tb-step-head-main{
  min-width:0;
  flex:1 1 420px;
}

.tb-step-head-kicker{
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--muted, #6b7280);
  margin-bottom:6px;
}

.tb-step-head-title{
  font-size:28px;
  line-height:1.15;
  font-weight:900;
  color:var(--text, inherit);
  margin:0 0 6px;
}

.tb-step-head-text{
  color:var(--text, inherit);
  line-height:1.5;
}

.tb-step-head-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.tb-step-head-actions > a,
.tb-step-head-actions > button,
.tb-step-head-actions > form > button{
  width:auto !important;
  margin-top:0;
  white-space:nowrap;
  text-decoration:none;
}

.tb-step-head-actions form{
  margin:0;
}

.tb-btn-anchor{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:auto !important;
  min-height:44px;
  padding:0 18px;
  text-decoration:none;
  white-space:nowrap;
  border-radius:14px;
}

.tb-step-meta-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom:14px;
  margin-top: 8px;
}

.tb-step-note-block{
  margin-bottom:14px;
}

.tb-step-note-title{
  font-weight:800;
  margin-bottom:4px;
}

/* =========================================
   SpeedRecon Upload Step
   ========================================= */

.tb-upload-stack{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:16px;
}

.tb-upload-box{
  border:1px solid var(--border, #e5e7eb);
  border-radius:14px;
  background:var(--card, #fff);
  padding:16px;
  box-shadow:var(--shadow, 0 8px 24px rgba(15,23,42,.06));
  min-width:0;
}

.tb-upload-box h3{
  margin:0 0 12px;
  font-size:16px;
}

.tb-upload-controls{
  display:grid;
  grid-template-columns:minmax(0,1.6fr) minmax(130px,.8fr) minmax(180px,.8fr);
  gap:14px;
  align-items:start;
}

.tb-upload-control{
  min-width:0;
}

.tb-upload-control .btn-secondary{
  width:100%;
  margin-top:0;
}

.tb-upload-sheet-row{
  margin-top:12px;
}

.tb-upload-status{
  display:none;
  font-size:13px;
  padding:9px 12px;
  border-radius:10px;
  border:1px solid transparent;
  line-height:1.4;
  margin-top:10px;
}

.tb-upload-status.is-info{
  display:block;
  color:var(--text);
  background:var(--bg-2);
  border-color:var(--border);
}

.tb-upload-status.is-success{
  display:block;
  color:var(--text);
  background:var(--success-bg);
  border-color:var(--success-border);
}

.tb-upload-status.is-error{
  display:block;
  color:var(--text);
  background:var(--error-bg);
  border-color:var(--error-border);
}

.tb-upload-preview{
  margin-top:12px;
  border:1px solid var(--border, #e5e7eb);
  border-radius:12px;
  overflow-x:auto;
  overflow-y:auto;
  max-width:100%;
  background:var(--bg-2, rgba(0,0,0,0.02));
}

.tb-upload-preview table{
  width:max-content;
  min-width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.tb-upload-preview th,
.tb-upload-preview td{
  padding:8px 10px;
  border-bottom:1px solid var(--border, #e5e7eb);
  text-align:left;
  white-space:nowrap;
}

.tb-upload-meta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
  min-width:0;
}

.tb-upload-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid var(--border, #e5e7eb);
  background:var(--bg-2, rgba(0,0,0,0.02));
  max-width:100%;
}

.tb-upload-side-note{
  margin-top:8px;
  font-size:12px;
  color:var(--muted, #6b7280);
}

.tb-upload-label-note{
  font-size:12px;
  font-weight:500;
}

.tb-upload-current-file{
  margin-top:10px;
}

.tb-upload-help-note{
  margin-top:14px;
}

.tb-upload-submit-btn{
  margin-top:12px;
}


@media (max-width: 1100px){
  .tb-upload-stack{
    grid-template-columns:1fr;
  }
}

@media (max-width: 760px){
  .tb-step-head{
    flex-direction:column;
    align-items:flex-start;
  }

  .tb-step-head-actions{
    width:100%;
  }

  .tb-upload-controls{
    grid-template-columns:1fr;
  }
}

.tb-upload-top-btn{
  min-width: 220px;
}

.tb-upload-control-action{
  align-self: stretch;
}

.tb-inspect-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:44px;
  padding:10px 16px;
  border-radius:14px;
  border:1px solid var(--btn-success-border, var(--btn-success-bg));
  background:var(--btn-success-bg);
  color:var(--btn-success-text, #fff);
  font-weight:700;
  line-height:1.1;
  box-shadow: var(--shadow);
  cursor:pointer;
  margin-top: 5px;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

.tb-inspect-btn:hover{
  background:var(--btn-success-bg-hover);
  border-color:var(--btn-success-bg-hover);
  box-shadow: var(--shadow-lg);
  transform:translateY(-1px);
}

.tb-inspect-btn:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px color-mix(in srgb, var(--btn-success-bg) 22%, transparent), var(--shadow-lg);
}

.tb-upload-status-wrap{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin-top:10px;
}

.tb-upload-status-label{
  font-size:11px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--muted);
}

.tb-upload-status{
  display:block;
  font-size:13px;
  line-height:1.45;
  color:var(--text);
  margin-top: -2px;

}

.tb-upload-status.is-info{
  color:var(--muted);
}

.tb-upload-status.is-success{
  color:var(--success, var(--text));
  font-weight:600;
}

.tb-upload-status.is-error{
  color:var(--danger, var(--text));
  font-weight:600;
}

@media (max-width: 860px){
  .tb-upload-top-btn{
    width:100%;
  }

  .tb-step-head-actions{
    width:100%;
  }
}

/* =========================================================
   Upload diagnostics
   ========================================================= */
.tb-upload-diagnostics{
  margin-top:12px;
}

.tb-diag-card{
  border:1px solid var(--border);
  background:var(--card);
  border-radius:16px;
  padding:14px;
  box-shadow: var(--shadow-sm);
}

.tb-diag-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.tb-diag-title-wrap{
  min-width:0;
}

.tb-diag-title{
  font-size:15px;
  font-weight:800;
  color:var(--text);
  margin-bottom:4px;
}

.tb-diag-summary{
  font-size:13px;
  line-height:1.45;
  color:var(--muted);
}

.tb-diag-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
  min-height:30px;
  padding:0 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  border:1px solid var(--border);
}

.tb-diag-badge.is-good{
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
  border-color: var(--badge-success-border);
}

.tb-diag-badge.is-warning{
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
  border-color: var(--badge-warning-border);
}

.tb-diag-badge.is-attention{
  background: var(--badge-danger-bg);
  color: var(--badge-danger-text);
  border-color: var(--badge-danger-border);
}

.tb-diag-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap:10px;
  margin-bottom:14px;
}

.tb-diag-stat{
  border:1px solid var(--border);
  background: var(--card-2);
  border-radius:12px;
  padding:10px 12px;
}

.tb-diag-stat-label{
  font-size:12px;
  color:var(--muted);
  line-height:1.35;
  margin-bottom:4px;
}

.tb-diag-stat-value{
  font-size:18px;
  font-weight:800;
  color:var(--text);
  line-height:1.2;
}

.tb-diag-section{
  margin-top:12px;
}

.tb-diag-section-title{
  font-size:13px;
  font-weight:800;
  color:var(--text);
  margin-bottom:8px;
}

.tb-diag-detected-list{
  display:grid;
  gap:10px;
}

.tb-diag-detected-item{
  border:1px solid var(--border);
  background: var(--card-2);
  border-radius:12px;
  padding:10px 12px;
}

.tb-diag-detected-label{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
  margin-bottom:6px;
}

.tb-diag-chip-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.tb-diag-chip{
  display:inline-flex;
  align-items:center;
  min-height:26px;
  padding:0 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  border:1px solid var(--border);
  background: var(--table-head);
  color: var(--text);
}

.tb-diag-empty{
  font-size:12px;
  color:var(--muted);
}

.tb-diag-list{
  margin:0;
  padding-left:18px;
  color:var(--text);
}

.tb-diag-list li{
  margin:0 0 6px;
  line-height:1.5;
}

.tb-diag-list.is-hints{
  color:var(--muted);
}

@media (max-width: 640px){
  .tb-diag-head{
    flex-direction:column;
    align-items:flex-start;
  }

  .tb-diag-grid{
    grid-template-columns: 1fr 1fr;
  }
}

/* =========================================================
   Import review source health summary
   ========================================================= */
.tb-import-health{
  margin-top:14px;
  border:1px solid var(--border);
  background: var(--card-2);
  border-radius:14px;
  padding:12px;
}

.tb-import-health-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.tb-import-health-title{
  font-size:13px;
  font-weight:800;
  color:var(--text);
  margin-bottom:4px;
}

.tb-import-health-summary{
  font-size:12px;
  line-height:1.45;
  color:var(--muted);
}

.tb-import-health-mini{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}

.tb-import-mini-pill{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:0 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  border:1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.tb-import-health-list{
  margin:10px 0 0;
  padding-left:18px;
  color:var(--text);
  font-size:12px;
}

.tb-import-health-list li{
  margin:0 0 4px;
  line-height:1.45;
}

@media (max-width: 640px){
  .tb-import-health-head{
    flex-direction:column;
    align-items:flex-start;
  }
}

/* =========================================================
   Import review cross-file comparison hint
   ========================================================= */
.tb-crossfile-check{
  margin: 10px 0 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.tb-crossfile-check.info{
  border-color: var(--info-border, var(--border));
  background: var(--info-bg, var(--card));
}

.tb-crossfile-check.warning{
  border-color: var(--badge-warning-border);
  background: var(--badge-warning-bg);
}

.tb-crossfile-check-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
}

.tb-crossfile-check-title{
  font-size:14px;
  font-weight:800;
  color:var(--text);
}

.tb-crossfile-check-list{
  margin:0;
  padding-left:18px;
  color:var(--text);
}

.tb-crossfile-check-list li{
  margin:0 0 6px;
  line-height:1.5;
}

.tb-crossfile-check-list li:last-child{
  margin-bottom:0;
}

/* Import review vertical spacing tidy-up */
.tb-review-shell > .tb-crossfile-check{
  margin-top: 8px;
  margin-bottom: 12px;
}

.tb-review-shell > .tb-split-grid,
.tb-review-shell > .tb-two-col,
.tb-review-shell > .tb-review-grid{
  margin-top: 0;
}

#tbReportTabsAnchor,
#tbMatchedSubtabsAnchor,
#tbUnmatchedSubtabsAnchor{
  scroll-margin-top: 110px;
}

/* =========================================
   SpeedRecon Import Review Step
   ========================================= */

.tb-import-review{
  display:grid;
  gap:18px;
}

.tb-summary-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}

.tb-summary-card{
  border:1px solid var(--border, #e5e7eb);
  border-radius:16px;
  background:var(--card, var(--bg, #fff));
  box-shadow:var(--shadow, 0 1px 12px rgba(0,0,0,0.08));
  padding:16px;
  min-width:0;
}

.tb-summary-card h2{
  margin:0 0 12px;
  font-size:18px;
}

.tb-summary-pills{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:12px;
}

.tb-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:7px 11px;
  border-radius:999px;
  font-size:12px;
  border:1px solid var(--border, #e5e7eb);
  background:var(--bg-2, rgba(0,0,0,0.02));
  color:var(--text, inherit);
}

.tb-summary-note{
  font-size:13px;
  color:var(--muted, #6b7280);
}

.tb-preview-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}

.tb-preview-card{
  border:1px solid var(--border, #e5e7eb);
  border-radius:16px;
  background:var(--card, var(--bg, #fff));
  box-shadow:var(--shadow, 0 1px 12px rgba(0,0,0,0.08));
  padding:16px;
  min-width:0;
  overflow:hidden;
}

.tb-preview-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
  flex-wrap:wrap;
}

.tb-preview-head h3{
  margin:0;
  font-size:18px;
}

.tb-preview-sub{
  font-size:13px;
  color:var(--muted, #6b7280);
}

.tb-table-wrap{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:auto;
  border:1px solid var(--border, #e5e7eb);
  border-radius:12px;
  background:var(--bg-2, rgba(0,0,0,0.02));
}

.tb-table{
  width:max-content;
  min-width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.tb-table th,
.tb-table td{
  padding:8px 10px;
  border-bottom:1px solid var(--border, #e5e7eb);
  text-align:left;
  white-space:nowrap;
  vertical-align:top;
}

.tb-table th{
  position:sticky;
  top:0;
  background:var(--table-head, var(--bg, #fff));
  z-index:1;
}

.tb-table tbody tr:hover{
  background:var(--table-row-hover, rgba(0,0,0,0.03));
}

.tb-empty{
  padding:18px;
  border:1px dashed var(--border, #e5e7eb);
  border-radius:12px;
  background:var(--bg-2, rgba(0,0,0,0.02));
  color:var(--muted, #6b7280);
}

.tb-row-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:3px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:600;
  border:1px solid var(--border, #e5e7eb);
  background:var(--bg-2, rgba(0,0,0,0.02));
  color:var(--text, inherit);
}

.tb-row-badge.is-carry{
  color:var(--primary, #2563eb);
  border-color:var(--focus, rgba(37, 99, 235, 0.28));
  background:rgba(59, 130, 246, 0.10);
}

/* Outstanding modal */
.tb-modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15, 23, 42, 0.45);
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:5000;
}

.tb-modal-backdrop.is-open{
  display:flex;
}

.tb-modal{
  width:min(1200px, 100%);
  max-height:90vh;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  border-radius:20px;
  border:1px solid var(--border, #e5e7eb);
  background:var(--card, var(--bg, #fff));
  color:var(--text, inherit);
  box-shadow:var(--shadow-lg, 0 22px 70px rgba(0,0,0,0.25));
}

.tb-modal-head{
  padding:16px 18px;
  border-bottom:1px solid var(--border, #e5e7eb);
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}

.tb-modal-head h3{
  margin:0 0 4px;
}

.tb-modal-head p{
  margin:0;
  color:var(--muted, #6b7280);
  font-size:13px;
}

.tb-modal-close{
  border:1px solid var(--border, #e5e7eb);
  background:var(--bg, #fff);
  color:var(--text, inherit);
  border-radius:12px;
  width:38px;
  height:38px;
  cursor:pointer;
  font-size:20px;
  line-height:1;
}

.tb-modal-close:hover{
  background:var(--btn-soft-bg, rgba(148,163,184,0.10));
}

.tb-modal-body{
  padding:16px 18px;
  overflow:auto;
  display:grid;
  gap:16px;
}

.tb-modal-formgrid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
}

.tb-modal-stats{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.tb-modal-status{
  display:none;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid transparent;
  font-size:13px;
  line-height:1.45;
}

.tb-modal-status.is-info{
  display:block;
  color:var(--text, #1f2937);
  background:var(--bg-2, #f3f4f6);
  border-color:var(--border, #e5e7eb);
}

.tb-modal-status.is-success{
  display:block;
  color:var(--text, #166534);
  background:var(--success-bg, rgba(34, 197, 94, 0.12));
  border-color:var(--success-border, rgba(34, 197, 94, 0.28));
}

.tb-modal-status.is-error{
  display:block;
  color:var(--text, #991b1b);
  background:var(--error-bg, rgba(239, 68, 68, 0.12));
  border-color:var(--error-border, rgba(239, 68, 68, 0.28));
}

.tb-outstanding-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}

.tb-outstanding-card{
  border:1px solid var(--border, #e5e7eb);
  border-radius:16px;
  background:var(--card, var(--bg, #fff));
  box-shadow:var(--shadow, 0 1px 12px rgba(0,0,0,0.08));
  min-width:0;
  overflow:hidden;
}

.tb-outstanding-card.is-accounting .tb-outstanding-card-head{
  background:rgba(59, 130, 246, 0.10);
  border-bottom:1px solid var(--focus, rgba(59, 130, 246, 0.28));
}

.tb-outstanding-card.is-bank .tb-outstanding-card-head{
  background:var(--success-bg, rgba(34, 197, 94, 0.12));
  border-bottom:1px solid var(--success-border, rgba(34, 197, 94, 0.28));
}

.tb-outstanding-card-head{
  padding:12px 14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.tb-outstanding-card-head h4{
  margin:0;
  font-size:16px;
}

.tb-select-actions{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  font-size:12px;
}

.tb-modal-foot{
  padding:16px 18px;
  border-top:1px solid var(--border, #e5e7eb);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.tb-modal-foot-left{
  color:var(--muted, #6b7280);
  font-size:13px;
}

.tb-modal-foot-actions{
  display:flex;
  gap:10px;
  flex-wrap:nowrap;
  align-items:center;
}

.tb-modal-foot-actions > button{
  width:auto;
  margin-top:0;
}

@media (max-width: 980px){
  .tb-summary-grid,
  .tb-preview-grid,
  .tb-modal-formgrid,
  .tb-outstanding-grid{
    grid-template-columns:1fr;
  }
}

/* =========================================
   SpeedRecon Mapping Step
   ========================================= */

.tb-map-divider{
  margin:18px 0 14px;
  border-top:1px solid var(--border);
}

.tb-collapse-toggle{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:transparent;
  border:none;
  padding:0;
  margin:0;
  color:var(--text);
  font:inherit;
  cursor:pointer;
  text-align:left;
}

.tb-collapse-toggle:hover .tb-collapse-title{
  color:var(--primary);
}

.tb-collapse-title{
  font-weight:800;
  font-size:15px;
  transition:color .15s ease;
}

.tb-collapse-line{
  flex:1;
  height:1px;
  background:var(--border);
  opacity:.9;
}

.tb-collapse-icon{
  font-size:18px;
  line-height:1;
  color:var(--muted);
  transition:transform .15s ease, color .15s ease;
}

.tb-collapse-toggle[aria-expanded="true"] .tb-collapse-icon{
  transform:rotate(90deg);
  color:var(--primary);
}

.tb-collapsible-panel{
  margin-top:12px;
}

.tb-map-template-card{
  margin-top:0;
}

.tb-template-top{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin-bottom:14px;
}

.tb-template-help{
  font-size:12px;
  margin-top:6px;
  margin-bottom:10px;
}

.tb-template-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.tb-template-delete-btn{
  color:#b42318;
}

.tb-template-delete-note{
  font-size:12px;
}

.tb-map-balance-card{
  margin-bottom:14px;
  padding:14px;
}

.tb-map-balance-title{
  font-weight:800;
  margin-bottom:6px;
}

.tb-map-balance-text{
  margin-bottom:12px;
}

.tb-map-grid-2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

.tb-map-mode-switch{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
  margin-top:12px;
}

.tb-map-mode-switch > *{
  min-width:0;
}

.tb-map-mode-option,
.tb-map-layout-option{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  width:100%;
  min-width:0;
  box-sizing:border-box;
  min-height:58px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--card) 96%, var(--bg) 4%),
      color-mix(in srgb, var(--card) 100%, transparent)
    );
  color:var(--text);
  transition:
    border-color .18s ease,
    background .18s ease,
    box-shadow .18s ease,
    transform .18s ease;
  cursor:pointer;
}

.tb-map-mode-option:hover,
.tb-map-layout-option:hover{
  border-color:color-mix(in srgb, var(--border) 70%, var(--primary) 30%);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--card) 90%, var(--primary) 10%),
      color-mix(in srgb, var(--card) 98%, var(--primary) 2%)
    );
}

.tb-map-mode-option input,
.tb-map-layout-option input{
  width:auto;
  min-width:auto;
  height:auto;
  min-height:0;
  margin:0;
  margin-top:0;
  padding:0;
  flex:0 0 auto;
  align-self:center;
  border:none;
  background:transparent;
  box-shadow:none;
}

.tb-map-mode-option input[type="radio"],
.tb-map-layout-option input[type="radio"]{
  appearance:auto;
  -webkit-appearance:radio;
}

.tb-map-choice-copy{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
  flex:1 1 auto;
}

.tb-map-choice-copy strong,
.tb-map-choice-copy small{
  display:block;
  min-width:0;
  white-space:normal;
  word-break:break-word;
}

.tb-map-choice-copy strong{
  font-size:13px;
  line-height:1.2;
  color:var(--text);
}

.tb-map-choice-copy small{
  font-size:11px;
  line-height:1.25;
  color:var(--muted);
}

.tb-map-standard-box,
.tb-map-debit-credit-box{
  margin-top:12px;
}

.tb-map-amount-panels{
  align-items:start;
  gap:12px;
}

.tb-map-amount-panel{
  border:1px solid var(--border);
  border-radius:16px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--card) 98%, var(--bg) 2%),
      color-mix(in srgb, var(--card-2, var(--card)) 100%, transparent)
    );
  padding:14px;
}

.tb-map-amount-panel-head{
  margin-bottom:10px;
}

.tb-map-amount-panel-title{
  font-weight:900;
  color:var(--text);
  margin-bottom:2px;
}

.tb-map-amount-panel-text{
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
}

.tb-map-layout-switch{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
  margin-bottom:10px;
}

.tb-map-layout-switch > *{
  min-width:0;
}

.tb-map-layout-option{
  min-height:50px;
  padding:8px 10px;
  align-items:center;
}

.tb-map-layout-box{
  display:grid;
  gap:8px;
  padding-top:4px;
}

.tb-map-layout-box label{
  margin-bottom:2px;
}

.tb-map-layout-box select{
  margin-bottom:4px;
}

.tb-map-balance-subcard{
  margin-top:12px;
  border:1px solid color-mix(in srgb, var(--border) 82%, var(--primary) 18%);
  border-radius:14px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--card) 94%, var(--primary) 6%),
      color-mix(in srgb, var(--card) 99%, transparent)
    );
  padding:12px;
}

.tb-map-balance-subtitle{
  font-weight:800;
  color:var(--text);
  margin-bottom:3px;
  font-size:13px;
}

.tb-map-balance-subtext{
  margin-bottom:10px;
  font-size:12px;
  line-height:1.35;
}

.tb-map-balance-card .tb-map-grid-2 > div > label,
.tb-map-layout-box > label{
  font-size:12px;
  font-weight:700;
  color:var(--text);
}

.tb-map-balance-card select{
  min-height:40px;
}

.tb-map-rules-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:16px 0 10px;
}

.tb-map-rules-title{
  font-weight:800;
}

.tb-map-rule-card{
  border:1px solid var(--border);
  background:var(--card);
  border-radius:14px;
  padding:14px;
  margin-bottom:12px;
  box-shadow:var(--shadow);
}

.tb-map-rule-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}

.tb-map-rule-name{
  font-weight:800;
}

.tb-map-rule-required{
  color:var(--primary);
  font-weight:700;
}

.tb-map-rule-grid{
  display:grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(180px, 1fr) minmax(140px, .9fr) minmax(140px, .9fr);
  gap:16px;
  align-items:start;
}

.tb-map-rule-grid > div{
  min-width:0;
}

.tb-map-field-wide{
  min-width:0;
}
/*
.tb-map-rule-grid .tb-map-field-wide{
  grid-column:span 2;
}
*/
.tb-map-advanced{
  margin-top:12px;
}

.tb-map-rule-dash{
  padding-top:10px;
}

.tb-map-advanced-help{
  font-size:12px;
  margin-top:4px;
}

.tb-map-date-tolerance-box{
  grid-column: span 2;
  display:flex;
  flex-direction:column;
  min-width:0;
}

.tb-map-date-tolerance-row{
  display:grid;
  grid-template-columns: minmax(140px, 1fr) minmax(90px, .7fr);
  gap:10px;
  align-items:start;
}

.tb-map-date-tolerance-field{
  display:flex;
  flex-direction:column;
  min-width:0;
}

.tb-map-date-tolerance-field label{
  margin-bottom:4px;
  line-height:1.2;
}

.tb-map-date-tolerance-unit{
  min-width:0;
}

.tb-map-date-tolerance-unit select,
.tb-map-date-tolerance-field input{
  min-height:38px;
  width:100%;
  box-sizing:border-box;
}

.advanced-grid .tb-map-digits-only{
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  min-width:0;
}

.advanced-grid .tb-map-digits-only .inline-check{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin:28px 0 0 0;
  min-height:38px;
  line-height:1.2;
}

.advanced-grid .tb-map-digits-only .inline-check input{
  width:auto;
  min-height:auto;
  margin:0;
}

.advanced-grid .tb-map-digits-only .tb-map-advanced-help{
  margin-top:4px;
}

@media (max-width: 1200px){
  .tb-map-rule-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .advanced-grid{
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tb-map-date-tolerance-box{
    grid-column: span 2;
  }

  .tb-map-mode-switch{
    grid-template-columns:1fr;
  }

  .tb-map-layout-switch{
    grid-template-columns:1fr;
  }
}

@media (max-width: 900px){
  .tb-map-rule-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advanced-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tb-map-date-tolerance-box{
    grid-column: span 2;
  }
  .tb-map-mode-switch{
    grid-template-columns:1fr;
  }

  .tb-map-layout-switch{
    grid-template-columns:1fr;
  }
}

@media (max-width: 640px){
  .tb-map-rule-grid,
  .advanced-grid{
    grid-template-columns: 1fr;
  }

  .tb-map-date-tolerance-box{
    grid-column: span 1;
  }

  .tb-map-date-tolerance-row{
    grid-template-columns: 1fr;
  }
  .tb-map-mode-switch{
    grid-template-columns:1fr;
  }

  .tb-map-layout-switch{
    grid-template-columns:1fr;
  }
}

/* =========================================
   SpeedRecon Review Step
   ========================================= */

.tb-review-workbench{
  margin-bottom:0px;
  padding: 14px 16px;
}

.tb-review-top-tabs{
  margin-bottom:0;
}

.tb-review-first-run{
  margin-bottom:10px;
  margin-top: 10px;
  padding: 10px 12px;
}

.tb-review-summary-strip{
  display:grid;
  grid-template-columns:repeat(6, minmax(0, 1fr));
  gap:10px;
  margin-top:12px;
  padding-top: 10px;
}

.tb-review-mini{
  border:1px solid var(--border);
  background:var(--bg-2);
  border-radius:14px;
  /*padding:10px 12px;*/
  min-width:0;
  min-height: 78px;
  padding: 12px 14px;
}

.tb-review-mini-label{
  font-size:12px;
  color:var(--muted);
  margin-bottom:4px;
}

.tb-review-mini-value{
  font-size:16px;
  font-weight:800;
  line-height:1.1;
  color:var(--text);
}

.tb-review-mini-sub{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
}

.tb-review-panel{
  margin-bottom:0px;
  margin-top:12px;
  overflow:hidden;
  border-radius:16px;
}

.tb-review-panel-body{
  margin-top:12px;
}

.tb-disclosure-card summary{
  cursor:pointer;
  list-style:none;
  font-weight:800;
  padding:0;
  display:flex;
  align-items:center;
  gap:10px;
  min-height:24px;
}

.tb-disclosure-card summary::-webkit-details-marker{
  display:none;
}

.tb-disclosure-card summary::before{
  content:'▶';
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  font-size:11px;
  color:var(--primary);
  transition:transform .15s ease, color .15s ease;
  flex:0 0 18px;
}

.tb-disclosure-card[open] summary::before{
  transform:rotate(90deg);
}

.tb-disclosure-card summary::after{
  content:none !important;
}

.tb-review-next-card{
  margin-bottom:14px;
}

.tb-review-next-title{
  font-weight:800;
  margin-bottom:8px;
}

.tb-review-divider{
  margin:14px 0;
  border:none;
  border-top:1px solid var(--border);
}

.tb-subtabs{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:14px;
  margin-top:6px;
}

.tb-subtabs-left{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.tb-subtabs-note{
  font-size:13px;
  color:var(--muted);
}

.tb-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}

.tb-section-title-wrap{
  min-width:0;
}

.tb-section-title{
  font-size:18px;
  font-weight:900;
  line-height:1.15;
  color:var(--text);
  margin:0;
}

.tb-section-subtitle{
  margin-top:3px;
  font-size:12px;
  color:var(--muted);
  line-height:1.3;
}

.tb-sticky-actionbar{
  position:sticky;
  bottom:0;
  z-index:15;
  display:grid;
  grid-template-columns:minmax(220px, auto) minmax(260px, 420px) auto;
  align-items:center;
  gap:16px;
  margin-top:12px;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:16px;
  background:color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter:blur(8px);
  box-shadow:var(--shadow);
}

.tb-sticky-actionbar-left{
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:4px;
  color:var(--muted);
  font-size:13px;
  min-height:42px;
}

.tb-sticky-actionbar-mid{
  min-width:0;
  max-width:420px;
  width:100%;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  gap:6px;
  padding-top:50px;
}

.tb-sticky-note-label{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  font-weight:700;
  color:var(--text);
  margin:0 0 2px;
  letter-spacing:.01em;
  line-height:1.1;
}

.tb-sticky-note-label::before{
  content:"";
  width:14px;
  height:14px;
  flex:0 0 14px;
  opacity:.82;
  background:currentColor;
  -webkit-mask-repeat:no-repeat;
  -webkit-mask-position:center;
  -webkit-mask-size:contain;
  mask-repeat:no-repeat;
  mask-position:center;
  mask-size:contain;
  -webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 1.5V8h4.5'/><path fill='black' d='M8 11h8v1.5H8zm0 3h8v1.5H8zm0 3h5v1.5H8z'/></svg>");
  mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 1.5V8h4.5'/><path fill='black' d='M8 11h8v1.5H8zm0 3h8v1.5H8zm0 3h5v1.5H8z'/></svg>");
}

.tb-sticky-note-wrap{
  position:relative;
}

.tb-sticky-note-wrap::before{
  content:"";
  position:absolute;
  left:12px;
  top:50%;
  transform:translateY(-50%);
  width:16px;
  height:16px;
  opacity:.78;
  pointer-events:none;
  background:var(--muted);
  -webkit-mask-repeat:no-repeat;
  -webkit-mask-position:center;
  -webkit-mask-size:contain;
  mask-repeat:no-repeat;
  mask-position:center;
  mask-size:contain;
  -webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 1.5V8h4.5'/><path fill='black' d='M8 11h8v1.5H8zm0 3h8v1.5H8zm0 3h5v1.5H8z'/></svg>");
  mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 1.5V8h4.5'/><path fill='black' d='M8 11h8v1.5H8zm0 3h8v1.5H8zm0 3h5v1.5H8z'/></svg>");
}

.tb-sticky-note-input{
  width:100%;
  min-width:0;
  height:42px;
  padding:0 14px 0 38px;
  border:1px solid color-mix(in srgb, var(--border) 78%, var(--primary) 22%);
  border-radius:14px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--card) 86%, var(--primary) 14%),
      color-mix(in srgb, var(--card) 94%, var(--primary) 6%)
    );
  color:var(--text);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--card) 55%, var(--bg) 45%),
    0 1px 2px color-mix(in srgb, var(--shadow) 20%, transparent);
  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    background .18s ease,
    transform .18s ease;
}

.tb-sticky-note-input:hover{
  border-color:color-mix(in srgb, var(--border) 60%, var(--primary) 40%);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--card) 82%, var(--primary) 18%),
      color-mix(in srgb, var(--card) 92%, var(--primary) 8%)
    );
}

.tb-sticky-note-input:focus{
  outline:none;
  border-color:color-mix(in srgb, var(--border) 35%, var(--primary) 65%);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--card) 78%, var(--primary) 22%),
      color-mix(in srgb, var(--card) 90%, var(--primary) 10%)
    );
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--focus) 24%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--card) 45%, var(--bg) 55%);
}

.tb-sticky-note-input::placeholder{
  color:color-mix(in srgb, var(--muted) 88%, var(--text) 12%);
}

.tb-sticky-actionbar-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  align-self:end;
  gap:10px;
  flex-wrap:wrap;
  min-height:42px;
  padding-top:18px;
}

.tb-sticky-actionbar-right > a,
.tb-sticky-actionbar-right > button,
.tb-sticky-actionbar-right > form > button{
  width:auto;
  margin-top:0;
  white-space:nowrap;
}

.tb-sticky-actionbar-right form{
  margin:0;
}

.tb-report-sum-col{
  font-weight:400;
}

.tb-manual-summary-row{
  margin-top:4px;
}

.tb-balance-badge-inline{
  margin-left:8px;
}

.tb-export-title{
  font-weight:700;
}

.tb-export-check{
  margin-top:8px;
}

.tb-complete-modal-backdrop{
  position:fixed;
  inset:0;
  z-index:99998;
  background:rgba(0,0,0,.45);
}

.tb-complete-modal-center{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.tb-complete-modal-card{
  background:var(--card);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:16px;
  padding:18px;
  width:100%;
  max-width:520px;
  box-shadow:var(--shadow-lg);
}

.tb-complete-modal-title{
  font-weight:950;
  font-size:16px;
  margin-bottom:8px;
}

.tb-complete-modal-text{
  line-height:1.5;
}

.tb-complete-modal-warning{
  color: color-mix(in srgb, var(--danger) 85%, var(--text));
  font-weight:700;
}

.tb-complete-modal-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  margin-top:16px;
  flex-wrap:wrap;
}

.tb-complete-modal-btn{
  width:auto;
  margin-top:0;
}

.tb-manual-state-text{
  margin-left:8px;
  color:var(--muted);
  font-size:12px;
}

@media (max-width: 1200px){
  .tb-review-summary-strip{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px){
  .tb-subtabs,
  .tb-section-head,
  .tb-sticky-actionbar{
    grid-template-columns:1fr;
    align-items:stretch;
  }

  .tb-sticky-actionbar-right{
    width:100%;
    justify-content:flex-start;
  }

  .tb-review-summary-strip{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px){
  .tb-review-summary-strip{
    grid-template-columns:1fr;
  }
}

/* Bring Forward Outstanding Items modal - tighter table spacing */
#tbOutstandingModal .tb-table th,
#tbOutstandingModal .tb-table td{
  padding-top: 6px;
  padding-bottom: 6px;
}

#tbOutstandingModal .tb-table th{
  line-height: 1.2;
}

#tbOutstandingModal .tb-table td{
  line-height: 1.25;
}

#tbOutstandingModal .tb-row-badge{
  min-height: 22px;
  padding: 0 8px;
  font-size: 11px;
}

/* =========================================
   SpeedRecon Wizard Polish Pass
   Tight spacing, unified buttons, softer cards
   ========================================= */

:root{
  --tb-wizard-card-radius: 18px;
  --tb-wizard-card-padding: 18px;
  --tb-wizard-card-padding-tight: 14px;
  --tb-wizard-gap: 14px;
  --tb-wizard-gap-tight: 10px;

  --tb-btn-height: 44px;
  --tb-btn-radius: 14px;

  --tb-soft-border: color-mix(in srgb, var(--border) 82%, transparent);
  --tb-soft-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
  --tb-soft-shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.08);

  --tb-title-size: 28px;
  --tb-title-line: 1.15;
  --tb-subtext-line: 1.5;
}

/* ---------- Stepper spacing ---------- */
.tb-stepper{
  margin-bottom: 14px;
}

/* ---------- Wizard cards ---------- */
.tb-wizard-card,
.tb-summary-card,
.tb-preview-card,
.tb-map-rule-card,
.tb-upload-box,
.tb-outstanding-card,
.tb-review-mini,
.tb-sticky-actionbar,
.tb-complete-modal-card{
  border-color: var(--tb-soft-border);
  box-shadow: var(--tb-soft-shadow);
}

.card.tb-wizard-card,
.tb-wizard-card{
  border-radius: var(--tb-wizard-card-radius);
  padding: var(--tb-wizard-card-padding);
}

.tb-summary-card,
.tb-preview-card,
.tb-upload-box,
.tb-outstanding-card{
  border-radius: 16px;
  padding: 16px;
}

.tb-map-rule-card{
  border-radius: 16px;
  padding: 16px;
}

.tb-review-mini{
  border-radius: 16px;
  padding: 12px 14px;
}

.tb-map-balance-card{
  padding: 16px;
  border-radius: 16px;
}

.tb-map-template-card{
  padding: 16px;
  border-radius: 16px;
}

/* ---------- Headings rhythm ---------- */
.tb-step-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.tb-step-head-kicker{
  font-size: 11px;
  margin-bottom: 2px;
}

.tb-step-head-title{
  /*font-size: var(--tb-title-size);*/
  /*line-height: var(--tb-title-line);*/
  margin: 0 0 4px;
  font-size: 26px;
  line-height: 1.05;
}

.tb-step-head-text{
  /*line-height: var(--tb-subtext-line);*/
  max-width: 860px;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

.tb-step-meta-row{
  gap: 8px;
  margin-bottom: 12px;
}

.tb-step-note-block,
.tb-step-note{
  margin-bottom: 14px;
}

.tb-step-note-title{
  margin-bottom: 4px;
}

/* ---------- Buttons: one shared size ---------- */
button,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-link,
.tb-btn-anchor,
.tb-step-head-actions > a,
.tb-step-head-actions > button,
.tb-step-head-actions > form > button,
.tb-sticky-actionbar-right > a,
.tb-sticky-actionbar-right > button,
.tb-sticky-actionbar-right > form > button,
.tb-template-actions > form > button,
.report-top-inline-actions > button{
  min-height: var(--tb-btn-height);
  border-radius: var(--tb-btn-radius);
}

.tb-btn-anchor,
.tb-step-head-actions > a.btn-primary,
.tb-step-head-actions > a.btn-secondary{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
}

.tb-step-head-actions > a,
.tb-step-head-actions > button,
.tb-step-head-actions > form > button{
  margin-top: 0;
  width: auto !important;
  white-space: nowrap;
}

/* smaller utility buttons inside tight areas */
.btn-inline,
.tb-template-actions .btn-inline,
.tb-map-rule-head .btn-secondary,
.msd-actions button{
  min-height: 34px;
  border-radius: 10px;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* ---------- Cards and panel rhythm ---------- */
.tb-import-review,
.tb-upload-stack,
.tb-summary-grid,
.tb-preview-grid{
  gap: 16px;
}

.tb-map-divider{
  margin: 16px 0 12px;
}

.tb-collapsible-panel{
  margin-top: 10px;
}

.tb-map-rules-header{
  margin: 14px 0 10px;
}

.tb-section-head{
  margin-bottom: 10px;
}

.tb-section-title{
  margin: 0;
  line-height: 1.2;
}

.tb-section-subtitle{
  margin-top: 4px;
  line-height: 1.45;
}

.tb-subtabs{
  margin-top: 6px;
  margin-bottom: 12px;
}

/* ---------- Info notes ---------- */
.tb-inline-note,
.tb-step-note,
.tb-modal-status{
  border-radius: 14px;
  padding: 12px 14px;
}

.tb-upload-help-note{
  margin-top: 14px;
}

.tb-upload-submit-btn{
  margin-top: 12px;
}

/* ---------- Summary / KPI strip ---------- */
.tb-review-summary-strip{
  gap: 12px;
  margin-top: 14px;
}

.tb-review-mini-label{
  margin-bottom: 5px;
}

.tb-review-mini-value{
  line-height: 1.15;
}

.tb-review-mini-sub{
  margin-top: 5px;
}

/* ---------- Sticky action bars ---------- */
.tb-sticky-actionbar{
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border-color: var(--tb-soft-border);
  box-shadow: var(--tb-soft-shadow-lg);
  background: color-mix(in srgb, var(--card) 94%, transparent);
}

.tb-sticky-actionbar-left{
  line-height: 1.45;
}

.tb-sticky-actionbar-right{
  gap: 10px;
}

/* ---------- Tables and table cards ---------- */
.tb-table-wrap,
.tb-upload-preview{
  border-radius: 14px;
  border-color: var(--tb-soft-border);
}

.tb-table th,
.tb-table td,
.tb-upload-preview th,
.tb-upload-preview td{
  padding: 9px 11px;
}

.tb-empty{
  border-radius: 14px;
  padding: 18px;
}

/* ---------- Modal polish ---------- */
.tb-modal{
  border-radius: 22px;
  border-color: var(--tb-soft-border);
  box-shadow: var(--tb-soft-shadow-lg);
}

.tb-modal-head,
.tb-modal-body,
.tb-modal-foot{
  padding-left: 18px;
  padding-right: 18px;
}

.tb-modal-head{
  padding-top: 16px;
  padding-bottom: 16px;
}

.tb-modal-body{
  padding-top: 16px;
  padding-bottom: 16px;
}

.tb-modal-foot{
  padding-top: 14px;
  padding-bottom: 14px;
}

/* ---------- Form rhythm ---------- */
label{
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
select,
textarea{
  min-height: 44px;
  border-radius: 12px;
}

.tb-upload-control .btn-secondary{
  min-height: 44px;
}

.tb-upload-side-note,
.tb-summary-note,
.tb-preview-sub,
.tb-subtabs-note,
.tb-map-advanced-help,
.tb-template-help{
  line-height: 1.45;
}

/* ---------- Specific cleanup for report page ---------- */
.tb-review-panel{
  border-radius:16px;
}

.tb-review-panel summary{
  padding:0;
}

.tb-review-panel-body{
  margin-top:12px;
}

.tb-review-next-card{
  border-radius: 16px;
  padding: 16px;
}

/* ---------- Specific cleanup for mapping ---------- */
.tb-collapse-title{
  font-size: 15px;
}

.tb-map-rule-head{
  margin-bottom: 12px;
}

.tb-map-rule-grid{
  gap: 12px;
}

.tb-map-advanced{
  margin-top: 12px;
}

/* ---------- Responsive tightening ---------- */
@media (max-width: 760px){
  :root{
    --tb-wizard-card-padding: 16px;
    --tb-title-size: 24px;
  }

  .tb-step-head{
    gap: 12px;
  }

  .tb-step-meta-row{
    margin-bottom: 10px;
  }

  .tb-review-summary-strip{
    gap: 10px;
  }

  .tb-sticky-actionbar{
    padding: 12px;
  }
}

/* =========================================
   Anchor buttons should look like real buttons
   ========================================= */

a.btn-primary,
a.btn-secondary,
a.btn-success,
a.btn-danger,
a.tb-btn-anchor,
.tb-step-head-actions a.btn-primary,
.tb-step-head-actions a.btn-secondary,
.tb-step-head-actions a.btn-success,
.tb-step-head-actions a.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tb-btn-height, 44px);
  padding: 0 18px;
  width: auto;
  border-radius: var(--tb-btn-radius, 14px);
  text-decoration: none !important;
  white-space: nowrap;
}

a.btn-primary,
.tb-step-head-actions a.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text) !important;
  border: 1px solid var(--btn-border);
}

a.btn-primary:hover,
.tb-step-head-actions a.btn-primary:hover {
  background: var(--btn-bg-hover);
  color: var(--btn-text) !important;
  text-decoration: none !important;
}

a.btn-secondary,
.tb-step-head-actions a.btn-secondary {
  background: var(--btn-2-bg);
  color: var(--btn-2-text) !important;
  border: 1px solid var(--btn-2-border);
}

a.btn-secondary:hover,
.tb-step-head-actions a.btn-secondary:hover {
  background: var(--btn-2-bg-hover);
  color: var(--btn-2-text) !important;
  text-decoration: none !important;
}

a.btn-success,
.tb-step-head-actions a.btn-success {
  text-decoration: none !important;
}

a.btn-danger,
.tb-step-head-actions a.btn-danger {
  text-decoration: none !important;
}

/* =========================================
   Wizard nav button icons
   ========================================= */

.tb-btn-with-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.tb-btn-with-icon svg{
  width:16px;
  height:16px;
  flex:0 0 16px;
  stroke:currentColor;
  stroke-width:2.2;
  fill:none;
}

.tb-btn-with-icon.is-back svg{
  margin-left:-2px;
}

.tb-btn-with-icon.is-next svg{
  margin-right:-2px;
}

/* Make mapping collapse use same style as report collapse */
.tb-map-collapse-panel{
  margin-bottom:12px;
  margin-top: 0px;
}

/* =========================================================
   Fix shared confirm modal overlay sizing
   The confirm modal itself is an overlay, not a content card.
   ========================================================= */
#tbConfirmModal.tb-modal{
  width: auto !important;
  max-width: none !important;
  max-height: none !important;
  overflow: visible !important;
  flex-direction: row !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: rgba(15, 23, 42, 0.42) !important;
}

#tbConfirmModal .tb-confirm-modal-card{
  width: min(520px, calc(100vw - 32px));
  max-width: 520px;
}

/* =========================================================
   Match explanation - compact inline style
   ========================================================= */
.col-explain{
  width:32px;
  min-width:32px;
  max-width:32px;
  text-align:center;
  white-space:nowrap;
  padding-left:4px !important;
  padding-right:4px !important;
}

.tb-explain-icon{
  appearance:none;
  -webkit-appearance:none;
  border:0;
  outline:0;
  background:transparent;
  color:var(--primary);
  cursor:pointer;

  width:16px;
  height:16px;
  min-width:16px;
  min-height:16px;

  padding:0 !important;
  margin:0 auto !important;

  display:block;
  line-height:0;
  font-size:0;
  border-radius:0;
  
  box-shadow:none;
}

.tb-explain-icon svg{
  width:16px;
  height:16px;
  display:block;
  stroke:currentColor;
  stroke-width:1.8;
  fill:none;
  pointer-events:none;
}

.tb-explain-icon:hover{
  background:transparent;
}

.tb-explain-icon.is-open{
  background:transparent;
}

.tb-explain-row > td{
  background: var(--card);
  padding: 8px 10px !important;
  border-top: 0;
}

.tb-explain-inline{
  border:1px solid var(--border);
  background: var(--card-2);
  border-radius:10px;
  padding:8px 10px;
}

.tb-explain-inline-top{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:8px;
}

.tb-explain-chip{
  display:inline-flex;
  align-items:center;
  min-height:22px;
  padding:0 8px;
  border-radius:999px;
  border:1px solid var(--border);
  font-size:11px;
  font-weight:800;
}

.tb-explain-chip.is-auto{
  background: var(--table-head);
  color: var(--text);
}

.tb-explain-chip.is-manual{
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
  border-color: var(--badge-warning-border);
}

.tb-explain-chip.is-rule{
  background: var(--card);
  color: var(--text);
}

.tb-explain-inline-summary{
  font-size:12px;
  color:var(--muted);
  line-height:1.4;
}

.tb-explain-table-wrap{
  overflow-x:auto;
}

.tb-explain-table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.tb-explain-table th,
.tb-explain-table td{
  border:1px solid var(--border);
  padding:6px 8px;
  vertical-align:middle;
  text-align:left;
}

.tb-explain-table th{
  background: var(--table-head);
  color: var(--muted);
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
}

.tb-explain-table tr.is-match td{
  background: color-mix(in srgb, var(--badge-success-bg) 40%, var(--card) 60%);
}

.tb-explain-table tr.is-no-match td{
  background: color-mix(in srgb, var(--badge-warning-bg) 45%, var(--card) 55%);
}

.tb-explain-col-rule{
  white-space:nowrap;
}

.tb-explain-rule-name{
  font-weight:800;
  color:var(--text);
}

.tb-explain-mini{
  margin-top:2px;
  font-size:11px;
  line-height:1.35;
  color:var(--muted);
}

.tb-explain-note{
  max-width:320px;
}

.tb-explain-result{
  display:inline-flex;
  align-items:center;
  min-height:20px;
  padding:0 7px;
  border-radius:999px;
  border:1px solid var(--border);
  font-size:10px;
  font-weight:800;
  white-space:nowrap;
}

.tb-explain-result.is-match{
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
  border-color: var(--badge-success-border);
}

.tb-explain-result.is-no-match{
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
  border-color: var(--badge-warning-border);
}

.tb-explain-empty{
  font-size:12px;
  color:var(--muted);
}

@media (max-width: 760px){
  .col-explain{
    width: 40px;
    min-width: 40px;
  }

  .tb-explain-inline{
    padding:8px;
  }
}

/* =========================================================
   Reconciliation audit timeline
   ========================================================= */
.tb-timeline-card{
  margin-top:12px;
}

.tb-timeline-body{
  padding:14px 16px 16px;
}

.tb-timeline-item{
  position:relative;
  display:grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap:12px;
  padding:0 0 14px;
}

.tb-timeline-item:last-child{
  padding-bottom:0;
}

.tb-timeline-item:not(:last-child)::after{
  content:"";
  position:absolute;
  left:8px;
  top:18px;
  bottom:0;
  width:2px;
  background:var(--border);
}

.tb-timeline-dot{
  width:14px;
  height:14px;
  border-radius:999px;
  background:var(--primary);
  margin-top:4px;
  position:relative;
  z-index:1;
}

.tb-timeline-content{
  min-width:0;
  border:1px solid var(--border);
  background:var(--card-2);
  border-radius:14px;
  padding:12px;
}

.tb-timeline-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.tb-timeline-title{
  font-size:14px;
  font-weight:800;
  color:var(--text);
}

.tb-timeline-when{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}

.tb-timeline-actor{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
}

.tb-timeline-message{
  margin-top:8px;
  font-size:13px;
  line-height:1.5;
  color:var(--text);
}

.tb-timeline-chip-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}

.tb-timeline-chip{
  display:inline-flex;
  align-items:center;
  min-height:26px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  font-size:12px;
  font-weight:700;
}

.tb-timeline-preview-block{
  margin-top:10px;
  border-top:1px dashed var(--border);
  padding-top:10px;
}

.tb-timeline-preview-title{
  font-size:12px;
  font-weight:800;
  color:var(--muted);
  margin-bottom:6px;
}

.tb-timeline-preview-line{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  font-size:12px;
  line-height:1.45;
  color:var(--text);
  margin-bottom:4px;
}

@media (max-width: 760px){
  .tb-timeline-head{
    flex-direction:column;
    align-items:flex-start;
  }

  .tb-timeline-when{
    white-space:normal;
  }
}


/* =========================================================
   Final reconciliation statement
   ========================================================= */
.tb-final-statement-card{
  margin-top:14px;
  padding:18px;
  border-radius:18px;
}

.tb-final-statement-head{
  margin-bottom:16px;
}

.tb-final-statement-brand-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
}

.tb-final-statement-brand-left{
  min-width:0;
}

.tb-final-statement-brand-right{
  text-align:right;
  flex:0 0 auto;
}

.tb-final-statement-company{
  font-size:16px;
  font-weight:900;
  color:var(--text);
  margin-bottom:4px;
  letter-spacing:.01em;
}

.tb-final-statement-kicker{
  font-size:12px;
  font-weight:900;
  color:var(--primary);
  text-transform:uppercase;
  letter-spacing:.06em;
  margin-bottom:6px;
}

.tb-final-statement-title{
  margin:0 0 6px;
  font-size:22px;
  line-height:1.2;
  color:var(--text);
}

.tb-final-statement-appname{
  font-size:14px;
  font-weight:900;
  color:var(--text);
  margin-bottom:8px;
}

.tb-final-statement-sub,
.tb-final-statement-meta-line{
  font-size:13px;
  color:var(--muted);
  line-height:1.5;
}

.tb-final-statement-summary-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:10px;
  margin-bottom:16px;
}

.tb-final-stat-box{
  border:1px solid var(--border);
  background:var(--card-2);
  border-radius:14px;
  padding:12px;
}

.tb-final-stat-label{
  font-size:12px;
  color:var(--muted);
  margin-bottom:4px;
}

.tb-final-stat-value{
  font-size:20px;
  font-weight:800;
  color:var(--text);
  line-height:1.2;
}

.tb-final-stat-sub{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
}

.tb-final-statement-files{
  margin-bottom:16px;
}

.tb-final-file-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
}

.tb-final-file-pill{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--card-2);
  color:var(--text);
  font-size:12px;
}

.tb-final-section{
  margin-top:18px;
}

.tb-final-section-title{
  font-size:15px;
  font-weight:800;
  color:var(--text);
  margin-bottom:8px;
}

.tb-final-subtitle{
  font-size:13px;
  font-weight:800;
  color:var(--muted);
  margin:10px 0 6px;
}

.tb-final-table-wrap{
  overflow-x:auto;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--card-2);
}

.tb-final-table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.tb-final-table th,
.tb-final-table td{
  border-bottom:1px solid var(--border);
  padding:8px 10px;
  vertical-align:middle;
  text-align:left;
}

.tb-final-table th{
  background:var(--table-head);
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
}

.tb-final-table tfoot th{
  background:var(--card);
  color:var(--text);
}

.tb-final-group-head th{
  background:var(--card);
  color:var(--text);
  font-size:12px;
  font-weight:800;
}

.tb-final-group-subtotal td{
  background:var(--card);
  color:var(--text);
  font-weight:800;
}

.tb-final-group-subtotal-line{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
  align-items:center;
}

.tb-final-manual-section{
  margin-top:10px;
}

.tb-final-manual-section-head{
  margin:0 0 8px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--card);
  color:var(--text);
  font-size:12px;
  font-weight:800;
}

.tb-final-manual-group{
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--card-2);
  padding:12px;
  margin-bottom:10px;
}

.tb-final-manual-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

.tb-final-manual-side{
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--card);
  padding:10px;
}

.tb-final-manual-side-title{
  font-size:12px;
  font-weight:800;
  color:var(--text);
  margin-bottom:8px;
}

.tb-final-manual-row{
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--card-2);
  padding:8px 10px;
}

.tb-final-manual-row + .tb-final-manual-row{
  margin-top:8px;
}

.tb-final-manual-row-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:4px;
  color:var(--text);
}

.tb-final-manual-row-amount{
  font-weight:800;
  color:var(--text);
  white-space:nowrap;
}

.tb-final-manual-row-line{
  font-size:12px;
  line-height:1.45;
  color:var(--muted);
}

.tb-final-manual-foot{
  display:flex;
  flex-wrap:wrap;
  gap:16px;
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid var(--border);
  color:var(--text);
  font-size:12px;
}

.tb-final-manual-total{
  font-weight:700;
}

.tb-final-manual-note{
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
}

.tb-final-manual-section-subtotal{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
  align-items:center;
  margin-top:8px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--card);
  color:var(--text);
  font-size:12px;
  font-weight:800;
}

.tb-final-empty{
  border:1px dashed var(--border);
  border-radius:12px;
  padding:12px;
  color:var(--muted);
  font-size:13px;
  background:var(--card-2);
}

.tb-final-signoff{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:20px;
  margin-top:28px;
}

.tb-final-sign-box{
  text-align:center;
}

.tb-final-sign-line{
  height:40px;
  border-bottom:1px solid var(--text);
  margin-bottom:8px;
}

.tb-final-sign-role{
  font-size:12px;
  font-weight:800;
  color:var(--text);
}

/* Print mode */
@media print{
  body *{
    visibility:hidden;
  }

  #tbFinalStatement,
  #tbFinalStatement *{
    visibility:visible;
  }

  #tbFinalStatement{
    position:absolute;
    left:0;
    top:0;
    width:100%;
    margin:0;
    padding:0;
    box-shadow:none !important;
    border:0 !important;
    background:#fff !important;
    color:#000 !important;
  }

  #tbFinalStatement .tb-final-statement-brand-row{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:20px;
  }

  #tbFinalStatement .tb-final-statement-company{
    font-size:18px;
    font-weight:900;
    color:#000 !important;
    margin-bottom:4px;
  }

  #tbFinalStatement .tb-final-statement-kicker{
    color:#000 !important;
  }

  #tbFinalStatement .tb-final-statement-appname{
    text-align:right;
    color:#000 !important;
  }

  #tbFinalStatement .tb-final-table-wrap{
    overflow:visible;
    border:1px solid #ccc;
  }

  #tbFinalStatement .tb-final-table th,
  #tbFinalStatement .tb-final-table td,
  #tbFinalStatement .tb-final-stat-box,
  #tbFinalStatement .tb-final-empty,
  #tbFinalStatement .tb-final-file-pill,
  #tbFinalStatement .tb-final-manual-group,
  #tbFinalStatement .tb-final-manual-side,
  #tbFinalStatement .tb-final-manual-row,
  #tbFinalStatement .tb-final-manual-section-head,
  #tbFinalStatement .tb-final-manual-section-subtotal{
    color:#000 !important;
    background:#fff !important;
  }

  #tbFinalStatement .tb-final-signoff{
    page-break-inside:avoid;
  }
  #tbFinalStatement .tb-final-manual-group,
  #tbFinalStatement .tb-final-manual-side,
  #tbFinalStatement .tb-final-manual-row,
  #tbFinalStatement .tb-final-manual-section-head,
  #tbFinalStatement .tb-final-manual-section-subtotal,
  #tbFinalStatement .tb-final-table-wrap{
    border-color:#ccc !important;
  }

}

@media (max-width: 760px){
  .tb-final-statement-brand-row{
    flex-direction:column;
    align-items:flex-start;
  }

  .tb-final-statement-brand-right{
    text-align:left;
  }

  .tb-final-signoff{
    grid-template-columns:1fr;
    gap:14px;
  }
}

/* Final statement disclosure shell */
.tb-final-statement-shell{
  margin-top:0px;
}

.tb-final-statement-shell-body{
  margin-top:12px;
}

.tb-final-statement-shell .tb-final-statement-card{
  margin-top:0;
}

/* =========================================================
   Reconciliation access / permission visibility
   ========================================================= */
.tb-access-card{
  margin-top:12px;
  border:1px solid var(--border);
  background:var(--card-2);
  border-radius:16px;
  padding:12px;
  margin-bottom: 10px;
}

.tb-access-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.tb-access-title{
  font-size:13px;
  font-weight:800;
  color:var(--text);
  margin-bottom:4px;
}

.tb-access-text{
  font-size:12px;
  line-height:1.45;
  color:var(--muted);
}

.tb-access-role{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:0 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  border:1px solid var(--border);
  white-space:nowrap;
}

.tb-access-role.is-owner{
  background:var(--badge-success-bg);
  color:var(--badge-success-text);
  border-color:var(--badge-success-border);
}

.tb-access-role.is-collab{
  background:var(--badge-info-bg, var(--table-head));
  color:var(--text);
}

.tb-access-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(160px, 1fr));
  gap:8px;
}

.tb-access-item{
  border:1px solid var(--border);
  background:var(--card);
  border-radius:12px;
  padding:10px 12px;
}

.tb-access-item-label{
  font-size:12px;
  color:var(--muted);
  margin-bottom:4px;
}

.tb-access-item-value{
  font-size:13px;
  font-weight:800;
  color:var(--text);
}

.tb-access-item-value.is-yes{
  color:var(--badge-success-text);
}

.tb-access-item-value.is-no{
  color:var(--badge-danger-text);
}

/* Dashboard collaborator permission chips */
.tb-collab-role-chip{
  display:inline-flex;
  align-items:center;
  min-height:22px;
  padding:0 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  border:1px solid var(--border);
  background:var(--table-head);
  color:var(--text);
  margin-top:5px;
}

.tb-collab-perm-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:6px;
}

.tb-collab-perm-chip{
  display:inline-flex;
  align-items:center;
  min-height:22px;
  padding:0 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  border:1px solid var(--border);
  background:var(--card-2);
  color:var(--text);
}

.tb-collab-perm-chip.is-yes{
  background:var(--badge-success-bg);
  color:var(--badge-success-text);
  border-color:var(--badge-success-border);
}

.tb-collab-perm-chip.is-no{
  background:var(--badge-warning-bg);
  color:var(--badge-warning-text);
  border-color:var(--badge-warning-border);
}

@media (max-width: 760px){
  .tb-access-head{
    flex-direction:column;
    align-items:flex-start;
  }
}

/* =========================================================
   Collaborators modal
   Scoped so shared .tb-modal rules do not interfere
   ========================================================= */
#tbCollabModal.tb-collab-modal{
  position: fixed;
  inset: 0;
  width: auto;
  max-width: none;
  max-height: none;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: auto;
  z-index: 9999;
}

#tbCollabModal.tb-collab-modal .tb-modal-card{
  width: min(980px, calc(100vw - 36px));
  max-width: 980px;
  margin: 40px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 14px;
}

#tbCollabModal.tb-collab-modal .tb-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

#tbCollabModal.tb-collab-modal .tb-collab-check{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  margin:10px 0;
}

#tbCollabModal.tb-collab-modal .tb-collab-check input[type="checkbox"]{
  margin:0;
  width:16px;
  height:16px;
  flex:0 0 auto;
}

#tbCollabModal.tb-collab-modal .tb-collab-check span{
  line-height:1.25;
}

@media (max-width: 760px){
  #tbCollabModal.tb-collab-modal{
    padding:12px;
  }

  #tbCollabModal.tb-collab-modal .tb-modal-card{
    width: min(980px, calc(100vw - 24px));
    margin: 18px auto;
    padding: 12px;
  }

  #tbCollabModal.tb-collab-modal .tb-modal-head{
    align-items:flex-start;
  }
}

/* =========================================================
   Admin area shell
   Shared width, header, tabs, cards, and page rhythm
   ========================================================= */
.admin-shell{
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.admin-topbar{
  position: sticky;
  top: 12px;
  z-index: 40;
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: color-mix(in srgb, var(--card) 90%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.admin-topbar-main{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 16px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
}

.admin-topbar-brand{
  min-width: 0;
}

.admin-topbar-kicker{
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}

.admin-topbar-title{
  font-size: 24px;
  line-height: 1.15;
  font-weight: 900;
  color: var(--text);
}

.admin-topbar-subtitle{
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.admin-topbar-actions{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-topbar-user{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 76%, var(--bg));
  color: var(--text);
  white-space: nowrap;
}

.admin-topbar-user-label{
  font-size: 12px;
  color: var(--muted);
}

.admin-topbar-btn{
  min-height: 40px;
}

.admin-tabs{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--card-2) 88%, var(--bg));
}

.admin-tab{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 78%, var(--bg));
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: .18s ease;
}

.admin-tab:hover{
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 9%, var(--card));
  transform: translateY(-1px);
}

.admin-tab.is-active{
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: color-mix(in srgb, var(--primary) 14%, var(--card));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}

.admin-tab.is-disabled{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 60%, var(--bg));
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  opacity: .8;
  cursor: default;
}

.admin-page{
  display: grid;
  gap: 18px;
}

.admin-page-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-page-title{
  margin: 0;
  font-size: 30px;
  line-height: 1.08;
  font-weight: 900;
}

.admin-page-subtitle{
  margin-top: 6px;
  color: var(--muted);
  max-width: 860px;
}

.admin-page-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-grid-stats{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.admin-stat{
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  box-shadow: var(--shadow);
}

.admin-stat-label{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.admin-stat-value{
  font-size: 28px;
  line-height: 1.05;
  font-weight: 900;
  color: var(--text);
}

.admin-card{
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  box-shadow: var(--shadow);
}

.admin-card-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.admin-card-title{
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.admin-muted{
  color: var(--muted);
}

.admin-table-wrap{
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.admin-table-wrap .table{
  margin: 0;
}

.admin-table-wrap thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--card) 92%, var(--bg));
  color: var(--text);
}

@media (max-width: 900px){
  .admin-topbar-main{
    padding: 16px;
  }

  .admin-page-title{
    font-size: 26px;
  }
}

@media (max-width: 720px){
  .admin-shell{
    padding: 14px 12px 24px;
  }

  .admin-topbar{
    top: 8px;
    border-radius: 18px;
  }

  .admin-topbar-main{
    flex-direction: column;
    align-items: stretch;
  }

  .admin-topbar-actions{
    justify-content: flex-start;
  }

  .admin-tabs{
    padding: 10px 12px 12px;
  }
}

/* =========================================================
   Admin page form finishers
   ========================================================= */
.admin-page .input,
.admin-page input[type="text"],
.admin-page input[type="email"],
.admin-page input[type="url"],
.admin-page input[type="password"],
.admin-page textarea,
.admin-page select{
  width: 100%;
}

.admin-page label{
  color: var(--text);
  font-weight: 700;
}

.admin-page code{
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card) 78%, var(--bg));
  color: var(--text);
  font-size: 12px;
}

/* =========================================================
   Admin plans master-detail layout
   ========================================================= */
.admin-plans-shell{
  display:grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap:18px;
  align-items:start;
}

.admin-plans-rail{
  position:sticky;
  top:104px;
}

.admin-plan-list{
  display:grid;
  gap:10px;
}

.admin-plan-item{
  display:block;
  text-decoration:none;
  color:var(--text);
  border:1px solid var(--border);
  border-radius:18px;
  padding:14px;
  background:linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  transition:.18s ease;
  box-shadow:var(--shadow);
}

.admin-plan-item:hover{
  transform:translateY(-1px);
  border-color:color-mix(in srgb, var(--primary) 32%, var(--border));
  background:color-mix(in srgb, var(--primary) 6%, var(--card));
}

.admin-plan-item.is-selected{
  border-color:color-mix(in srgb, var(--primary) 55%, var(--border));
  background:color-mix(in srgb, var(--primary) 10%, var(--card));
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent), var(--shadow);
}

.admin-plan-item-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.admin-plan-item-name{
  font-size:16px;
  font-weight:900;
  line-height:1.15;
}

.admin-plan-item-code{
  margin-top:5px;
}

.admin-plan-item-prices{
  margin-top:12px;
  display:grid;
  gap:4px;
  font-size:13px;
}

.admin-plan-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:0 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  border:1px solid var(--border);
  white-space:nowrap;
}

.admin-plan-badge.is-active{
  background:color-mix(in srgb, var(--primary) 14%, var(--card));
  border-color:color-mix(in srgb, var(--primary) 45%, var(--border));
}

.admin-plan-badge.is-inactive{
  background:color-mix(in srgb, var(--card) 70%, var(--bg));
  color:var(--muted);
}

.admin-plans-editor{
  min-width:0;
}

.admin-plan-section-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:14px;
}

.admin-plan-pricing-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:14px;
}

.admin-price-card{
  border:1px solid var(--border);
  border-radius:18px;
  padding:16px;
  background:linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
}

.admin-entitlement-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:12px;
}

.admin-entitlement-item{
  border:1px solid var(--border);
  border-radius:18px;
  padding:14px;
  background:linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  display:grid;
  gap:10px;
}

.admin-entitlement-head{
  display:grid;
  gap:4px;
}

.admin-entitlement-title{
  font-weight:800;
  color:var(--text);
}

.admin-entitlement-help{
  font-size:12px;
  color:var(--muted);
  line-height:1.4;
}

.admin-check-card{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:16px;
  background:linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
}

.admin-check-card input{
  margin-top:3px;
}

.admin-check-card--compact{
  padding:10px 12px;
  min-height:44px;
  align-items:center;
}

@media (max-width: 980px){
  .admin-plans-shell{
    grid-template-columns:1fr;
  }

  .admin-plans-rail{
    position:static;
  }
}

/* =========================================================
   Admin strip header redesign
   Flat, full-width, premium top strip
   ========================================================= */
.admin-strip{
  position: sticky;
  top: 0;
  z-index: 70;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.admin-strip-inner{
  width: 100%;
  padding: 0 20px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--card) 98%, transparent) 0%, color-mix(in srgb, var(--card) 94%, var(--card-2)) 100%);
}

.admin-strip-main{
  min-height: 66px;
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.admin-strip-brand{
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-width: 180px;
}

.admin-strip-kicker{
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary);
  line-height: 1.1;
}

.admin-strip-title{
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.08;
  font-weight: 900;
  color: var(--text);
}

.admin-strip-search{
  display:flex;
  justify-content:center;
}

.admin-strip-searchbox{
  width: min(720px, 100%);
  min-height: 42px;
  display:flex;
  align-items:center;
  gap:10px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 35%, var(--card));
  color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.admin-strip-searchbox svg{
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex: 0 0 auto;
}

.admin-strip-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
  flex-wrap:wrap;
}

.admin-strip-user{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 80%, var(--bg));
  color: var(--text);
  white-space: nowrap;
}

.admin-strip-user-label{
  font-size: 12px;
  color: var(--muted);
}

.admin-strip-link{
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  min-height: 38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.admin-strip-link:hover{
  background: color-mix(in srgb, var(--primary) 6%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
}

.admin-strip-rule{
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.admin-strip-tabs{
  min-height: 52px;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  padding: 8px 0;
}

.admin-strip-tab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text);
  text-decoration:none;
  font-size:13px;
  font-weight:800;
  transition:.16s ease;
}

.admin-strip-tab.is-active,
.admin-strip-tab.is-active:visited,
.admin-strip-tab.is-active:hover,
.admin-strip-tab.is-active:focus {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: var(--on-primary) !important;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 22%, transparent);
}

.admin-strip-tab.is-active svg,
.admin-strip-tab.is-active span {
  color: var(--on-primary) !important;
}

.admin-strip-tab:hover{
  background: color-mix(in srgb, var(--primary) 7%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
}

.admin-strip-tab.is-active{
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent);
}

.admin-shell{
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.admin-topbar,
.admin-topbar-main,
.admin-topbar-brand,
.admin-topbar-kicker,
.admin-topbar-title,
.admin-topbar-subtitle,
.admin-topbar-actions,
.admin-topbar-user,
.admin-topbar-user-label,
.admin-topbar-btn,
.admin-tabs,
.admin-tab,
.admin-tab.is-active,
.admin-tab.is-disabled{
  all: unset;
}

/* =========================================================
   Plans page polish and entitlement grouping
   ========================================================= */
.admin-plans-rail{
  top: 98px;
}

.admin-entitlement-group-wrap{
  display:grid;
  gap:18px;
}

.admin-entitlement-group{
  border:1px solid var(--border);
  border-radius:20px;
  padding:16px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
}

.admin-entitlement-group-head{
  display:grid;
  gap:4px;
  margin-bottom:14px;
}

.admin-entitlement-group-title{
  font-size:15px;
  font-weight:900;
  color:var(--text);
}

.admin-entitlement-group-subtitle{
  font-size:12px;
  line-height:1.45;
  color:var(--muted);
}

.admin-price-card{
  padding:18px;
}

.admin-entitlement-item{
  min-height: 142px;
}

@media (max-width: 1180px){
  .admin-strip-main{
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    padding: 14px 0;
  }

  .admin-strip-search{
    justify-content: stretch;
  }

  .admin-strip-searchbox{
    width: 100%;
  }

  .admin-strip-actions{
    justify-content: flex-start;
  }
}

@media (max-width: 720px){
  .admin-strip-inner{
    padding: 0 12px;
  }

  .admin-strip-tabs{
    padding: 8px 0 10px;
  }

  .admin-shell{
    padding: 14px 12px 24px;
  }
}

/* =========================================================
   Admin strip refinement
   Centered nav, premium icon tabs, single user dropdown
   ========================================================= */

/* Let the admin strip truly touch the top of the viewport */
html,
body{
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.admin-strip{
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100vw;
  margin: 0 calc(50% - 50vw);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.admin-strip-inner{
  width: 100%;
  padding: 0 20px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--muted) 9%, var(--card)) 0%,
      color-mix(in srgb, var(--muted) 5%, var(--card)) 100%
    );
}

.admin-strip-main{
  min-height: 62px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.admin-strip-brand{
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-width: 180px;
}

.admin-strip-kicker{
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary);
  line-height: 1.1;
}

.admin-strip-title{
  margin-top: 2px;
  font-size: 22px;
  line-height: 1.08;
  font-weight: 900;
  color: var(--text);
}

.admin-strip-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}

.admin-strip-rule{
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.admin-strip-tabs{
  min-height: 54px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
  padding: 8px 0;
}

.admin-strip-tab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  color: var(--text);
  text-decoration:none;
  font-size:13px;
  font-weight:800;
  transition:.16s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.admin-strip-tab:hover{
  background: color-mix(in srgb, var(--primary) 18%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  transform: translateY(-1px);
}

.admin-strip-tab.is-active{
  background: color-mix(in srgb, var(--primary) 22%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--primary) 16%, transparent),
    var(--shadow);
}

.admin-strip-tab-icon{
  width:16px;
  height:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: var(--text);
  opacity: .92;
  flex: 0 0 auto;
}

.admin-strip-tab-icon svg{
  width:16px;
  height:16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Single top-right user control */
.admin-user-menu{
  position: relative;
}

.admin-user-menu summary{
  list-style: none;
}

.admin-user-menu summary::-webkit-details-marker{
  display:none;
}

.admin-user-menu-trigger{
  min-height: 42px;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 84%, var(--bg));
  color: var(--text);
  cursor:pointer;
  user-select:none;
  transition:.16s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.admin-user-menu-trigger:hover{
  background: color-mix(in srgb, var(--primary) 7%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
}

.admin-user-menu[open] .admin-user-menu-trigger{
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
}

.admin-user-menu-copy{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.admin-user-menu-label{
  font-size:12px;
  color: var(--muted);
}

.admin-user-menu-caret{
  width:16px;
  height:16px;
  stroke: currentColor;
  stroke-width:2;
  fill:none;
  flex: 0 0 auto;
}

.admin-user-menu-pop{
  position:absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  padding: 8px;
  border:1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  box-shadow: var(--shadow-lg);
}

.admin-user-menu-item{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:42px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--text);
  text-decoration:none;
  font-size:13px;
  font-weight:700;
}

.admin-user-menu-item:hover{
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
}

.admin-user-menu-item svg{
  width:16px;
  height:16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex:0 0 auto;
}

/* Hide old link styles if they still linger */
.admin-strip-link,
.admin-strip-search,
.admin-strip-searchbox{
  display:none !important;
}

/* Improve content spacing beneath flat strip */
.admin-shell{
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px 16px 28px;
}

.admin-plans-rail{
  top: 106px;
}

@media (max-width: 1100px){
  .admin-strip-main{
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 820px){
  .admin-strip-inner{
    padding: 0 12px;
  }

  .admin-strip-main{
    min-height: auto;
    padding: 12px 0;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .admin-strip-actions{
    justify-content:flex-start;
  }

  .admin-strip-tabs{
    justify-content:flex-start;
    padding: 10px 0;
  }

  .admin-shell{
    padding: 14px 12px 24px;
  }

  .admin-plans-rail{
    top: 96px;
  }
}

/* =========================================================
   Admin strip final polish
   ========================================================= */

:root{
  --topbar-bg: color-mix(in srgb, var(--card) 88%, var(--bg-2));
}

/* If your theme blocks already exist, add --topbar-bg there too.
   These are safe fallback overrides if not added earlier. */
[data-theme="dark"]{
  --topbar-bg: color-mix(in srgb, var(--card) 82%, var(--bg-2));
}
[data-theme="dim"]{
  --topbar-bg: color-mix(in srgb, var(--card) 78%, var(--bg-2));
}
[data-theme="contrast"]{
  --topbar-bg: color-mix(in srgb, var(--card) 92%, var(--bg-2));
}

/* Kill any remaining top gap from wrappers */
body > :first-child{
  margin-top: 0 !important;
}
.admin-strip,
.admin-strip + .admin-shell{
  margin-top: 0 !important;
}

.admin-strip{
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100vw;
  margin: 0 calc(50% - 50vw);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.admin-strip-inner{
  width: 100%;
  padding: 0 20px;
  background: var(--topbar-bg);
}

.admin-strip-main{
  min-height: 58px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.admin-strip-logo-link{
  display:inline-flex;
  align-items:center;
  text-decoration:none;
}

.admin-strip-logo{
  display:block;
  height: 40px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
}

.admin-strip-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  grid-column: 3;
}

.admin-strip-rule{
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.admin-strip-tabs{
  min-height: 54px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
  padding: 8px 0;
  background: var(--card);
}

.admin-strip-tab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  color: var(--text);
  text-decoration:none;
  font-size:13px;
  font-weight:800;
  transition:.16s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.admin-strip-tab:hover{
  background: color-mix(in srgb, var(--primary) 18%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  transform: translateY(-1px);
}

.admin-strip-tab.is-active{
  background: color-mix(in srgb, var(--primary) 22%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--primary) 16%, transparent),
    var(--shadow);
}

.admin-strip-tab-icon{
  width:16px;
  height:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: var(--text);
  opacity: .92;
  flex: 0 0 auto;
}

.admin-strip-tab-icon svg{
  width:16px;
  height:16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-user-menu{
  position: relative;
}

.admin-user-menu summary{
  list-style: none;
}
.admin-user-menu summary::-webkit-details-marker{
  display:none;
}

.admin-user-menu-trigger{
  min-height: 42px;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 84%, var(--bg));
  color: var(--text);
  cursor:pointer;
  user-select:none;
  transition:.16s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.admin-user-menu-trigger:hover{
  background: color-mix(in srgb, var(--primary) 7%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
}

.admin-user-menu[open] .admin-user-menu-trigger{
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
}

.admin-user-menu-copy{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.admin-user-menu-label{
  font-size:12px;
  color: var(--muted);
}

.admin-user-menu-caret{
  width:16px;
  height:16px;
  stroke: currentColor;
  stroke-width:2;
  fill:none;
  flex: 0 0 auto;
}

.admin-user-menu-pop{
  position:absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  padding: 8px;
  border:1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  box-shadow: var(--shadow-lg);
}

.admin-user-menu-item{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:42px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--text);
  text-decoration:none;
  font-size:13px;
  font-weight:700;
}

.admin-user-menu-item:hover{
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
}

.admin-user-menu-item svg{
  width:16px;
  height:16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex:0 0 auto;
}

.admin-shell{
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px 16px 28px;
}

@media (max-width: 820px){
  .admin-strip-inner{
    padding: 0 12px;
  }

  .admin-strip-main{
    min-height: auto;
    padding: 12px 0;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .admin-strip-actions{
    grid-column: auto;
    justify-content:flex-start;
  }

  .admin-strip-logo{
    height: 24px;
    max-width: 150px;
  }

  .admin-strip-tabs{
    justify-content:flex-start;
    padding: 10px 0;
  }

  .admin-shell{
    padding: 14px 12px 24px;
  }
}

/* =========================================================
   Main app strip header
   Mirrors admin strip language
   ========================================================= */

:root{
  --topbar-bg: color-mix(in srgb, var(--card) 88%, var(--bg-2));
}

[data-theme="dark"]{
  --topbar-bg: color-mix(in srgb, var(--card) 82%, var(--bg-2));
}
[data-theme="dim"]{
  --topbar-bg: color-mix(in srgb, var(--card) 78%, var(--bg-2));
}
[data-theme="contrast"]{
  --topbar-bg: color-mix(in srgb, var(--card) 92%, var(--bg-2));
}

.container--topflush{
  padding-top: 0 !important;
}

.tb-strip{
  position: sticky;
  top: 0;
  z-index: 85;
  width: 100vw;
  margin: 0 calc(50% - 50vw);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.tb-strip-inner{
  width: 100%;
  padding: 0 20px;
  background: var(--topbar-bg);
}

.tb-strip-main{
  min-height: 62px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.tb-strip-left{
  display:flex;
  align-items:center;
}

.tb-strip-brand{
  display:inline-flex;
  align-items:center;
  text-decoration:none;
  line-height: 0;
  padding: 2px 0;
}

.tb-strip-logo{
  display:block;
  height: 40px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
}

.tb-strip-nav{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}

.tb-strip-tab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:38px;
  padding: 0 14px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--primary) 16%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  color: var(--text);
  text-decoration:none;
  font-size:13px;
  font-weight:800;
  transition:.16s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.tb-strip-tab:hover{
  background: color-mix(in srgb, var(--primary) 18%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  transform: translateY(-1px);
}

.tb-strip-tab.is-active,
.tb-strip-tab--primary{
  background: color-mix(in srgb, var(--primary) 22%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--primary) 16%, transparent),
    var(--shadow);
}

.tb-strip-tab-icon{
  width:16px;
  height:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: var(--text);
  flex:0 0 auto;
}

.tb-strip-tab-icon svg{
  width:16px;
  height:16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tb-strip-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
  flex-wrap:wrap;
}

.tb-strip-help{
  min-height:40px;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 0 14px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--primary) 16%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  color: var(--text);
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.tb-strip-help:hover{
  background: color-mix(in srgb, var(--primary) 18%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.tb-strip-help-icon{
  width:16px;
  height:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.tb-strip-help-icon svg{
  width:16px;
  height:16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tb-profile--strip{
  min-height:42px;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 0 14px;
  border-radius:999px;
  border:1px solid var(--border);
  background: color-mix(in srgb, var(--card) 84%, var(--bg));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.tb-profile--strip:hover,
.tb-profile--strip[aria-expanded="true"]{
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
}

.tb-menu--strip{
  top: calc(100% + 10px);
  right: 0;
  min-width: 250px;
  border:1px solid var(--border);
  border-radius:16px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  box-shadow: var(--shadow-lg);
}

.tb-strip-rule{
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.topbar.tb-topbar,
.tb-left,
.tb-right,
.tb-brand,
.tb-logo,
.tb-nav,
.tb-navlink,
.tb-navlink-primary{
  all: unset;
}

@media (max-width: 1100px){
  .tb-strip-main{
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    padding: 12px 0;
  }

  .tb-strip-nav{
    justify-content:flex-start;
  }

  .tb-strip-actions{
    justify-content:flex-start;
  }
}

@media (max-width: 720px){
  .tb-strip-inner{
    padding: 0 12px;
  }

  .tb-strip-logo{
    height:24px;
    max-width:150px;
  }
}

/* =========================================================
   Main strip header polish - split rows like admin topbar
   ========================================================= */

.tb-strip-inner{
  width: 100%;
  padding: 0 20px;
  background: var(--topbar-bg);
}

.tb-strip-top{
  min-height: 62px;
  display:grid;
  grid-template-columns: auto 1fr auto;
  align-items:center;
  gap:16px;
}

.tb-strip-bottom{
  min-height: 54px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 8px 0;
  background: var(--card);
}

.tb-strip-nav{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}

.tb-strip-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
  flex-wrap:wrap;
}

/* Help button should hug content, not stretch wide */
.tb-strip-help{
  width: auto !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
  white-space: nowrap;
  padding: 0 14px;
  margin-top: 0px;
}

.tb-strip-rule{
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.tb-strip-main{
  all: unset;
}

@media (max-width: 1100px){
  .tb-strip-top{
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    padding: 12px 0;
  }

  .tb-strip-actions{
    justify-content:flex-start;
  }

  .tb-strip-bottom{
    justify-content:flex-start;
  }

  .tb-strip-nav{
    justify-content:flex-start;
  }
}

@media (max-width: 720px){
  .tb-strip-inner{
    padding: 0 12px;
  }

  .tb-strip-top{
    min-height: auto;
    padding: 12px 0;
  }

  .tb-strip-bottom{
    padding: 10px 0;
  }
}

/* =========================================================
   Full-width strip footer
   Top and bottom sections can use different backgrounds
   ========================================================= */

:root{
  --footer-top-bg: color-mix(in srgb, var(--card) 86%, var(--bg-2));
  --footer-bottom-bg: var(--card);
}

[data-theme="dark"]{
  --footer-top-bg: color-mix(in srgb, var(--card) 80%, var(--bg-2));
  --footer-bottom-bg: color-mix(in srgb, var(--card) 94%, var(--bg));
}

[data-theme="dim"]{
  --footer-top-bg: color-mix(in srgb, var(--card) 76%, var(--bg-2));
  --footer-bottom-bg: color-mix(in srgb, var(--card) 92%, var(--bg));
}

[data-theme="contrast"]{
  --footer-top-bg: color-mix(in srgb, var(--card) 92%, var(--bg-2));
  --footer-bottom-bg: color-mix(in srgb, var(--card) 98%, var(--bg));
}

.tb-footer{
  width: 100vw;
  margin: 28px calc(50% - 50vw) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--footer-bottom-bg);
}

.tb-footer-top{
  background: var(--footer-top-bg);
}

.tb-footer-bottom{
  background: var(--footer-bottom-bg);
}

.tb-footer-rule{
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.tb-footer-inner{
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

.tb-footer-grid{
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(180px, .9fr) minmax(220px, 1fr) minmax(260px, 1fr);
  gap: 22px;
  padding: 22px 0 18px;
  align-items: start;
}

.tb-footer-logo-link{
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-bottom: 10px;
}

.tb-footer-logo{
  display:block;
  height: 42px;
  width:auto;
  max-width:280px;
  object-fit:contain;
}

.tb-footer-tagline{
  margin: 0 0 12px;
  max-width: 300px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.tb-footer-title{
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text);
}

.tb-footer-links{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
}

.tb-footer-links a,
.tb-footer-meta a{
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tb-footer-links a:hover,
.tb-footer-meta a:hover{
  color: var(--primary);
}

.tb-footer-meta{
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.tb-footer-socials{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tb-footer-social{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 76%, var(--bg));
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.tb-footer-social:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
}

.tb-footer-news{
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  box-shadow: var(--shadow);
}

.tb-footer-news-form{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
  align-items: center;
}

.tb-footer-input{
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.tb-footer-btn{
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary, #fff);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.tb-footer-btn:hover{
  background: var(--primary-2);
}

.tb-footer-bottom-inner{
  min-height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 1100px){
  .tb-footer-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px){
  .tb-footer-inner{
    padding: 0 12px;
  }

  .tb-footer-grid{
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .tb-footer-news-form{
    grid-template-columns: 1fr;
  }

  .tb-footer-bottom-inner{
    justify-content: flex-start;
  }
}

/* =========================================================
   Shared shell rhythm
   Makes header + footer align perfectly
   ========================================================= */

:root{
  --shell-max: 1320px;
  --shell-pad-x: 20px;
  --shell-row-min: 62px;
  --shell-subrow-min: 54px;
  --shell-gap: 16px;
}

[data-theme="dark"]{
  --shell-max: 1320px;
  --shell-pad-x: 20px;
}
[data-theme="dim"]{
  --shell-max: 1320px;
  --shell-pad-x: 20px;
}
[data-theme="contrast"]{
  --shell-max: 1320px;
  --shell-pad-x: 20px;
}

/* Header */
.tb-strip-inner{
  width: 100%;
  padding: 0 var(--shell-pad-x);
  background: var(--topbar-bg);
}

.tb-strip-top{
  min-height: var(--shell-row-min);
  display:grid;
  grid-template-columns: auto 1fr auto;
  align-items:center;
  gap: var(--shell-gap);
}

.tb-strip-bottom{
  min-height: var(--shell-subrow-min);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 8px 0;
  background: var(--card);
}

/* Footer */
.tb-footer-inner{
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--shell-pad-x);
}

.tb-footer-grid{
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(180px, .9fr) minmax(220px, 1fr) minmax(260px, 1fr);
  gap: 22px;
  padding: 22px 0 18px;
  align-items: start;
}

.tb-footer-bottom-inner{
  min-height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

/* Main content shell should match the same horizontal rhythm */
.admin-shell{
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 16px var(--shell-pad-x) 28px;
}

.container{
  max-width: var(--shell-max);
  margin-left: auto;
  margin-right: auto;
}

/* Make the full-width strips visually align with the same inner rhythm */
.admin-strip-inner,
.tb-strip-inner{
  box-sizing: border-box;
}

@media (max-width: 720px){
  :root{
    --shell-pad-x: 12px;
    --shell-row-min: 58px;
    --shell-subrow-min: 50px;
    --shell-gap: 12px;
  }

  .tb-footer-grid{
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .tb-footer-bottom-inner{
    justify-content: flex-start;
  }
}

.tb-review-nav-zone{
  margin-top: 0px;
  position: relative;
  z-index: 2;
}

.tb-review-nav-zone .tb-review-top-tabs{
  margin-bottom: 0;
}

.tb-review-nav-zone .tb-review-summary-strip{
  margin-top: 0;
  border-top-left-radius: 0;
}

.tb-review-content-shell,
.tb-report-main-card,
.excel-grid,
.tb-review-grid-shell{
  position: relative;
  z-index: 1;
}

.tb-review-mini-disclosure{
  margin-top: 10px;
}

.tb-review-mini-disclosure summary{
  font-size: 14px;
  font-weight: 800;
}

.tb-review-mini-disclosure-body{
  padding-top: 10px;
}

.tb-review-mini-access-row{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* =========================================================
   Report page: page-level tabs outside scroller,
   sub-tabs + section heads become working sticky header
   ========================================================= */

.tb-review-nav-zone{
  margin-top: 12px;
  margin-bottom: 10px;
  position: relative;
  z-index: 3;
}

.report-scroll{
  height: calc(100vh - 140px);
  min-height: 760px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}

/* give the inside content a bit of top breathing room */
.report-scroll > *:first-child{
  margin-top: 0;
}

/* the true working header inside the scroller */
.report-scroll .tb-subtabs{
  position: sticky;
  top: 0;
  z-index: 8;
  margin-top: 0;
  margin-bottom: 10px;
  padding: 10px 14px 8px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

/* keep the note aligned nicely */
.report-scroll .tb-subtabs-note{
  align-self: center;
}

/* section title block sticks under subtabs */
.report-scroll .tb-section-head{
  position: sticky;
  top: 58px;
  z-index: 7;
  margin: 0;
  padding: 12px 16px 8px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

/* remove extra gap between sticky title and table */
.report-scroll .excel-section{
  margin-top: 0;
}

.report-scroll .excel-one,
.report-scroll .excel-panel{
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* table headers now sit below subtabs + section title */
.report-scroll .excel-table thead th{
  top: 112px;
  z-index: 6;
}

/* two-panel "All" tab headers */
.report-scroll .excel-header{
  top: 0;
  z-index: 7;
}

/* if the All tab is active, its table headers should sit below its own panel header only */
.report-scroll .excel-panel .excel-table thead th{
  top: 44px;
}

/* keep sticky blocks visually solid */
.report-scroll .tb-subtabs,
.report-scroll .tb-section-head,
.report-scroll .excel-table thead th,
.report-scroll .excel-header{
  background-clip: padding-box;
}

.report-scroll .tb-subtabs .tab{
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

/* =========================================================
   Report top shell: make main tabs own the stat-card body
   and visually fuse that body with the scroller below
   ========================================================= */

.tb-review-nav-zone{
  margin-top: 12px;
  margin-bottom: 0;
  position: relative;
  z-index: 3;
}

.tb-review-top-shell{
  position: relative;
}

.tb-review-top-tabs{
  position: relative;
  z-index: 2;
  margin-bottom: 0;
}

/* this is the "body" of the main tabs */
.tb-review-top-shell-body{
  margin-top: -1px;
  padding: 12px 0 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 0 14px 0 0;
  box-shadow: inset 0 -1px 0 var(--border);
}

/* stat strip now lives inside the owned body */
.tb-review-summary-strip{
  margin: 0;
  padding: 0 10px 10px;
}

/* give the cards some left/right inset while body spans full width */
.tb-review-summary-strip{
  padding-left: 0;
  padding-right: 0;
}

.tb-review-summary-strip .tb-review-mini{
  margin-left: 0;
}

/* the scroller now visually attaches to the shell body */
.report-scroll{
  height: calc(100vh - 140px);
  min-height: 760px;
  overflow: auto;
  border: 1px solid var(--border);
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 14px;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  background: var(--card);
  margin-top: 0;
}

/* keep the sub-tabs sitting tightly under the shell */
.report-scroll .tb-subtabs{
  margin-top: 0;
}

/* optional: slightly soften the cards so they sit better on --bg body */
.tb-review-top-shell-body .tb-review-mini{
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

/* mobile: keep it safe */
@media (max-width: 980px){
  .tb-review-top-shell-body{
    border-radius: 0 12px 0 0;
  }

  .report-scroll{
    min-height: 0;
    height: auto;
    border-top-left-radius: 0;
    border-top-right-radius: 12px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
  }
}

/* =========================================================
   Main strip header: dual-row with logo + nav split
   ========================================================= */
.tb-strip-brand{
  display:inline-flex;
  align-items:center;
  text-decoration:none;
  position:relative;
}

.tb-strip-logo{
  display:block;
  height:auto;
}

/* default: light theme logo shows */
.tb-logo-dark{
  display:none;
}

.tb-logo-light{
  display:block;
}

/* dark theme */
[data-theme="dark"] .tb-logo-light{
  display:none;
}
[data-theme="dark"] .tb-logo-dark{
  display:block;
}

/* dim theme */
[data-theme="dim"] .tb-logo-light{
  display:none;
}
[data-theme="dim"] .tb-logo-dark{
  display:block;
}

.auth-brand{
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 0 0 22px 0;
}

.auth-brand-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  text-decoration: none;
}

.auth-home-link{
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.auth-home-link:hover{
  color: var(--text);
  border-color: var(--primary);
}

/* =========================================================
   Contextual field help tooltips
   ========================================================= */

.tb-map-choice-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tb-label-with-tip,
.tb-title-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.tb-label-with-tip {
  margin-top: 10px;
  margin-bottom: 4px;
}

.tb-label-with-tip label {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.tb-title-with-tip {
  margin-bottom: 6px;
}

.tb-title-with-tip > strong,
.tb-title-with-tip > span,
.tb-title-with-tip > div {
  min-width: 0;
}

/* Reusable contextual tooltip wrapper */
.tb-info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  outline: none;
}

/* The small ? / i icon */
.tb-info-tip-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
  color: var(--primary);
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  cursor: help;
  transition:
    background .16s ease,
    color .16s ease,
    border-color .16s ease,
    transform .16s ease,
    box-shadow .16s ease;
}

.tb-info-tip:hover .tb-info-tip-icon,
.tb-info-tip:focus .tb-info-tip-icon,
.tb-info-tip:focus-visible .tb-info-tip-icon {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 22%, transparent);
}

/* Tooltip bubble */
.tb-info-tip-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 999;
  width: min(320px, calc(100vw - 32px));
  padding: 12px 13px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 18px 45px color-mix(in srgb, #020617 16%, transparent);
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: auto;
  transition:
    opacity .15s ease,
    visibility .15s ease,
    transform .15s ease;
}

.tb-info-tip-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  background: var(--card);
  border-right: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  transform: translateX(-50%) rotate(45deg);
}

.tb-info-tip:hover .tb-info-tip-bubble,
.tb-info-tip:focus .tb-info-tip-bubble,
.tb-info-tip:focus-within .tb-info-tip-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tb-info-tip-bubble strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.25;
}

.tb-info-tip-bubble span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

/* Optional link support for future contextual help */
.tb-info-tip-bubble a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  margin-top: 9px;
  padding: 0 9px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border));
  background: color-mix(in srgb, var(--primary) 9%, var(--card));
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.tb-info-tip-bubble a:hover {
  background: var(--primary);
  color: var(--on-primary);
  text-decoration: none;
}

/* Keep tooltips usable near the left/right edge when needed */
.tb-info-tip.tip-left .tb-info-tip-bubble {
  left: auto;
  right: 0;
  transform: translateY(4px);
}

.tb-info-tip.tip-left:hover .tb-info-tip-bubble,
.tb-info-tip.tip-left:focus .tb-info-tip-bubble,
.tb-info-tip.tip-left:focus-within .tb-info-tip-bubble {
  transform: translateY(0);
}

.tb-info-tip.tip-left .tb-info-tip-bubble::after {
  left: auto;
  right: 12px;
  transform: rotate(45deg);
}

.tb-info-tip.tip-right .tb-info-tip-bubble {
  left: 0;
  transform: translateY(4px);
}

.tb-info-tip.tip-right:hover .tb-info-tip-bubble,
.tb-info-tip.tip-right:focus .tb-info-tip-bubble,
.tb-info-tip.tip-right:focus-within .tb-info-tip-bubble {
  transform: translateY(0);
}

.tb-info-tip.tip-right .tb-info-tip-bubble::after {
  left: 12px;
  transform: rotate(45deg);
}

/* Tooltip variation for disclosure headers or tight top areas */
.tb-info-tip.tip-bottom .tb-info-tip-bubble {
  top: calc(100% + 10px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  z-index: 5000;
}

.tb-info-tip.tip-bottom:hover .tb-info-tip-bubble,
.tb-info-tip.tip-bottom:focus .tb-info-tip-bubble,
.tb-info-tip.tip-bottom:focus-within .tb-info-tip-bubble {
  transform: translateX(-50%) translateY(0);
}

.tb-info-tip.tip-bottom .tb-info-tip-bubble::after {
  top: auto;
  bottom: 100%;
  left: 50%;
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  border-top: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  transform: translateX(-50%) rotate(45deg);
}

.tb-tooltip-safe {
  position: relative;
  z-index: 30;
  overflow: visible;
}

.tb-tooltip-safe summary {
  position: relative;
  z-index: 31;
  overflow: visible;
}

@media (max-width: 640px) {
  .tb-info-tip-bubble {
    width: min(280px, calc(100vw - 28px));
    font-size: 12px;
  }
}

.tb-template-actions-cell {
  white-space: nowrap;
  vertical-align: middle;
}

.tb-template-action-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.tb-template-action-form + .tb-template-action-form,
.tb-template-action-form + .tb-template-delete-note {
  margin-left: 8px;
}

.tb-template-action-btn {
  margin: 0;
  vertical-align: middle;
}

.tb-template-delete-note {
  display: inline-block;
  vertical-align: middle;
  font-size: 12px;
}

/* Mapping page: compact primary-style buttons for rule actions */
.tb-map-rules-header,
.tb-map-rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tb-map-rules-title,
.tb-map-rule-name {
  min-width: 0;
}

.tb-map-rule-action-btn,
button.tb-map-rule-action-btn {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  min-width: 0 !important;
  max-width: max-content !important;

  height: 30px !important;
  min-height: 30px !important;

  padding: 0 13px !important;
  margin: 0 !important;
  border: 1px solid var(--primary) !important;
  border-radius: 10px !important;
  background: var(--primary) !important;
  color: var(--on-primary) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none !important;
}

.tb-map-rule-action-btn:hover,
button.tb-map-rule-action-btn:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

.tb-map-rule-action-btn:focus,
button.tb-map-rule-action-btn:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 2px;
}

.tb-map-rule-action-btn:disabled,
button.tb-map-rule-action-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

/* =========================================================
   Admin company details tabs
   ========================================================= */

.admin-page .admin-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 18px 0 20px;
  padding: 6px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 88%, var(--bg));
  box-shadow: var(--shadow);
}

.admin-page .admin-tabs .admin-tab {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent !important;
  color: var(--muted) !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none !important;
  outline: none;
  cursor: pointer;
}

.admin-strip-tab {
  cursor: pointer;
}

.admin-page .admin-tabs .admin-tab:hover {
  color: var(--text) !important;
  background: color-mix(in srgb, var(--primary) 8%, var(--card)) !important;
}

.admin-page .admin-tabs .admin-tab.is-active,
.admin-page .admin-tabs .admin-tab.is-active:visited,
.admin-page .admin-tabs .admin-tab.is-active:hover,
.admin-page .admin-tabs .admin-tab.is-active:focus {
  color: var(--on-primary) !important;
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 22%, transparent) !important;
}

@media (max-width: 640px) {
  .admin-page .admin-tabs {
    display: flex;
    width: 100%;
    border-radius: 18px;
  }

  .admin-page .admin-tabs .admin-tab {
    flex: 1 1 auto;
  }
}

/* =========================================================
   Admin confirmation modal
   ========================================================= */

body.admin-confirm-open {
  overflow: hidden;
}

.admin-confirm-modal[hidden] {
  display: none !important;
}

.admin-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 22px;
}

.admin-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(4px);
}

.admin-confirm-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  width: min(560px, 100%);
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--border));
  border-radius: 24px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 28px 90px rgba(2, 6, 23, .28);
}

.admin-confirm-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 18px;
  background: color-mix(in srgb, var(--danger) 12%, var(--card));
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border));
  font-size: 24px;
  font-weight: 950;
}

.admin-confirm-kicker {
  margin-bottom: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-confirm-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: -.03em;
}

.admin-confirm-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  font-weight: 650;
}

.admin-confirm-user-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 58%, var(--card));
}

.admin-confirm-user-box strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.admin-confirm-user-box span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.admin-confirm-warning {
  margin-top: 12px;
  padding: 12px 13px;
  border: 1px solid color-mix(in srgb, var(--danger) 26%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--danger) 8%, var(--card));
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 750;
}

.admin-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.admin-confirm-actions .btn-secondary {
  width: auto;
  margin-top: 0;
}

.admin-danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 40px;
  margin-top: 0;
  padding: 0 15px;
  border-radius: 13px;
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.admin-danger-btn:hover {
  background: var(--danger-2);
  border-color: var(--danger-2);
}

.admin-danger-btn:disabled {
  opacity: .7;
  cursor: not-allowed;
}

@media (max-width: 560px) {
  .admin-confirm-card {
    grid-template-columns: 1fr;
  }

  .admin-confirm-actions {
    justify-content: stretch;
  }

  .admin-confirm-actions .btn-secondary,
  .admin-danger-btn {
    width: 100%;
  }
}

/* =========================================================
   Reconciliation Groups Management
   ========================================================= */


  .rg-page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }

  .rg-page-head h1 {
    margin: 0;
  }

  .rg-create-card {
    margin-bottom: 16px;
  }

  .rg-list-card {
    scroll-margin-top: 90px;
  }

  .rg-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }

  .rg-toolbar-left h3 {
    margin: 0;
  }

  .rg-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
  }

  .rg-filters input,
  .rg-filters select {
    margin-top: 0;
  }

  .rg-search {
    min-width: min(320px, 100%);
  }

  .rg-status-filter {
    width: 170px;
  }

  .rg-table-wrap {
    overflow: auto;
  }

  .rg-table {
    min-width: 1080px;
  }

  .rg-table th,
  .rg-table td {
    vertical-align: middle;
  }

  .rg-name-col {
    width: 24%;
  }

  .rg-desc-col {
    width: 27%;
  }

  .rg-actions-col {
    width: 330px;
  }

  .rg-inline-form {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .rg-inline-form input {
    margin-top: 0;
    min-height: 38px;
  }

  .rg-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .rg-row-actions form {
    display: inline-flex;
  }

  .rg-row-actions .btn-secondary,
  .rg-row-actions button {
    width: auto;
    margin-top: 0;
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .rg-delete-btn {
    border-color: var(--danger) !important;
    color: var(--danger) !important;
  }

  .rg-delete-btn:hover {
    background: color-mix(in srgb, var(--danger) 8%, var(--card)) !important;
  }

  .rg-row-hidden {
    display: none !important;
  }

  .rg-empty-filter {
    display: none;
    padding: 22px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
  }

  .rg-empty-filter.is-visible {
    display: block;
  }

  .rg-mini-note {
    font-size: 12px;
    line-height: 1.55;
    color: var(--muted);
    margin-top: 12px;
  }

  .rg-delete-modal[hidden] {
    display: none !important;
  }

  .rg-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 22px;
  }

  .rg-delete-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .58);
    backdrop-filter: blur(4px);
  }

  .rg-delete-card {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 16px;
    width: min(560px, 100%);
    padding: 22px;
    border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--border));
    border-radius: 24px;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 28px 90px rgba(2, 6, 23, .28);
  }

  .rg-delete-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 18px;
    background: color-mix(in srgb, var(--danger) 12%, var(--card));
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border));
    font-size: 24px;
    font-weight: 950;
  }

  .rg-delete-kicker {
    margin-bottom: 6px;
    color: var(--danger);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .rg-delete-card h2 {
    margin: 0;
    color: var(--text);
    font-size: 26px;
    line-height: 1.12;
    letter-spacing: -.03em;
  }

  .rg-delete-card p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
    font-weight: 650;
  }

  .rg-delete-box {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg) 58%, var(--card));
  }

  .rg-delete-box strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.35;
  }

  .rg-delete-warning {
    margin-top: 12px;
    padding: 12px 13px;
    border: 1px solid color-mix(in srgb, var(--danger) 26%, var(--border));
    border-radius: 14px;
    background: color-mix(in srgb, var(--danger) 8%, var(--card));
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
    font-weight: 750;
  }

  .rg-delete-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
  }

  .rg-delete-actions .btn-secondary {
    width: auto;
    margin-top: 0;
  }

  .rg-danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 40px;
    margin-top: 0;
    padding: 0 15px;
    border-radius: 13px;
    border: 1px solid var(--danger);
    background: var(--danger);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
  }

  .rg-danger-btn:hover {
    background: var(--danger-2);
    border-color: var(--danger-2);
  }

  .rg-danger-btn:disabled {
    opacity: .7;
    cursor: not-allowed;
  }

  body.rg-modal-open {
    overflow: hidden;
  }

  @media (max-width: 900px) {
    .rg-filters {
      width: 100%;
    }

    .rg-search,
    .rg-status-filter {
      width: 100%;
    }
  }

  @media (max-width: 560px) {
    .rg-delete-card {
      grid-template-columns: 1fr;
    }

    .rg-delete-actions {
      justify-content: stretch;
    }

    .rg-delete-actions .btn-secondary,
    .rg-danger-btn {
      width: 100%;
    }
  }
