/* =========================================================
   TrueBalance — 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;
}

/* ===========================
   TrueBalance 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);
}

/* -------------------------
   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);
}

/* -------------------------
   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);
}

/* =========================================================
   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; /* slightly nicer side padding */
}

/* 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:block;
  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); }

.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(auto-fit, minmax(220px, 1fr));
  gap: 18px 16px;
  align-items: start;
}
.advanced-grid > div{ display:flex; flex-direction:column; }
.advanced-grid label{ font-weight: 700; margin-bottom: 4px; }
.advanced-grid .muted{ font-size: 12px; margin-top: 4px; line-height: 1.4; }
.advanced-grid input, .advanced-grid select{ min-height: 38px; }

.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 - 260px);
  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: top;
  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:0;
  margin: 10px 0 14px;
  padding:12px 14px;
  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;
}

.tb-step-link{
  display:inline-flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:inherit;
  min-width:0;
}

.tb-step-link.is-disabled{
  opacity:.75;
  cursor:default;
}

.tb-step-dot{
  width:30px;
  height:30px;
  min-width:30px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:800;
  border:1px solid var(--border);
  background:var(--card-2);
  color:var(--muted);
}

.tb-step-text{
  font-size:13px;
  font-weight:700;
  color:var(--muted);
  white-space:nowrap;
}

.tb-step-line{
  height:2px;
  flex:1 1 auto;
  min-width:28px;
  margin:0 12px;
  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;
}

.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; }
.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: 50;
  width: 280px;
  max-height: 260px;
  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{
  display:flex;
  gap:8px;
  margin-bottom:8px;
}

.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;
}

/* =========================================================
   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;
  align-items:center;
  justify-content:center;
  padding: 34px 16px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.06), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.05), transparent 30%),
    var(--bg);
}

.auth-card{
  width: 100%;
  max-width: 480px;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(4px);
}

.auth-card.auth-card-wide{
  max-width: 560px;
}

.auth-logo{
  display:flex;
  justify-content:center;
  margin-bottom: 18px;
}

.auth-logo img{
  max-height: 58px;
  width: auto;
  display: block;
}

.auth-kicker{
  margin: 0 0 8px 0;
  text-align:center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-title{
  margin: 0 0 8px 0;
  text-align: center;
  font-size: clamp(28px, 4vw, 34px);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: -.02em;
}

.auth-sub{
  margin: 0 0 20px 0;
  text-align:center;
  color: var(--muted);
  font-size: 14px;
  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;
  margin-top: 8px;
  margin-bottom: 2px;
}

.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-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;
}

@media (max-width: 640px){
  .auth-shell{
    padding: 20px 12px;
  }

  .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: -5px;
  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-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-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;
  }
}


/* ============================
   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;
}

.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);
}


/* =========================================
   TrueBalance 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:10px;
  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;
}

.tb-step-note-block{
  margin-bottom:14px;
}

.tb-step-note-title{
  font-weight:800;
  margin-bottom:4px;
}

/* =========================================
   TrueBalance 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;
  }
}

/* =========================================================
   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: -15px 0 0px;
  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;
}
  
/* =========================================
   TrueBalance 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;
  }
}

/* =========================================
   TrueBalance 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-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:repeat(5, minmax(0, 1fr));
  gap:12px;
  align-items:start;
}

.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;
}

@media (max-width: 1100px){
  .tb-map-rule-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .tb-map-rule-grid .tb-map-field-wide{
    grid-column:span 1;
  }
}

@media (max-width: 760px){
  .tb-template-top,
  .tb-map-grid-2,
  .tb-map-rule-grid{
    grid-template-columns:1fr;
  }

  .tb-map-rules-header,
  .tb-map-rule-head{
    align-items:flex-start;
    flex-direction:column;
  }
}

/* =========================================
   TrueBalance Review Step
   ========================================= */

.tb-review-workbench{
  margin-bottom:12px;
}

.tb-review-top-tabs{
  margin-bottom:0;
}

.tb-review-first-run{
  margin-bottom:14px;
}

.tb-review-summary-strip{
  display:grid;
  grid-template-columns:repeat(6, minmax(0, 1fr));
  gap:10px;
  margin-top:12px;
}

.tb-review-mini{
  border:1px solid var(--border);
  background:var(--bg-2);
  border-radius:14px;
  padding:10px 12px;
  min-width:0;
}

.tb-review-mini-label{
  font-size:12px;
  color:var(--muted);
  margin-bottom:4px;
}

.tb-review-mini-value{
  font-size:18px;
  font-weight:800;
  line-height:1.2;
  color:var(--text);
}

.tb-review-mini-sub{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
}

.tb-review-panel{
  margin-bottom: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.2;
  color:var(--text);
  margin:0;
}

.tb-section-subtitle{
  margin-top:4px;
  font-size:13px;
  color:var(--muted);
  line-height:1.45;
}

.tb-sticky-actionbar{
  position:sticky;
  bottom:0;
  z-index:15;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  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{
  color:var(--muted);
  font-size:13px;
}

.tb-sticky-actionbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.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-report-note-row{
  margin-top:12px;
}

.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;
}

@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{
    flex-direction:column;
    align-items:flex-start;
  }

  .tb-sticky-actionbar-right{
    width:100%;
  }

  .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;
}

/* =========================================
   TrueBalance 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{
  gap: 16px;
  margin-bottom: 14px;
}

.tb-step-head-kicker{
  margin-bottom: 5px;
}

.tb-step-head-title{
  font-size: var(--tb-title-size);
  line-height: var(--tb-title-line);
  margin: 0 0 8px;
}

.tb-step-head-text{
  line-height: var(--tb-subtext-line);
  max-width: 860px;
}

.tb-step-meta-row{
  gap: 8px;
  margin-bottom: 12px;
}

.tb-step-note-block,
.tb-step-note,
.tb-review-first-run{
  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;
}

/* =========================================================
   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:top;
  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:14px;
}

.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:top;
  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-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{
    color:#000 !important;
    background:#fff !important;
  }

  #tbFinalStatement .tb-final-signoff{
    page-break-inside:avoid;
  }
}

@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:14px;
}

.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;
}

.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;
  }
}