/* ===========================================================================
   Digital Ten X — Doha HR Portal · UI theme
   Brand tokens lifted from digital10x design-system.html
   =========================================================================== */

:root {
  --ink: #0C0B0A;
  --panel: #141210;
  --panel2: #1B1815;
  --line: #2A2620;
  --line2: #3A342B;
  --fg: #F5F0E8;
  --muted: #9B968C;
  --dim: #6B6761;
  --accent: #00D68F;
  --accent2: #5DECB3;
  --gold: #E8B94E;
  --danger: #F2715B;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 22px;
  --sans: 'Inter Tight', system-ui, -apple-system, sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }  /* native controls (date pickers, select popups, scrollbars) render dark */
html, body { margin: 0; padding: 0; }
body {
  background: var(--ink);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; display: block; }
hr.divider { border: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); margin: 24px 0; }

/* --- Typography ----------------------------------------------------------- */
.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); }
.label-mono { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
h1, h2, h3 { font-family: var(--sans); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
.serif { font-family: var(--serif); }
em.accent, .accent-em { font-family: var(--serif); font-style: italic; color: var(--accent); font-variation-settings: 'wght' 500, 'SOFT' 80; }
.text-muted { color: var(--muted); }
.text-dim { color: var(--dim); }
.text-accent { color: var(--accent); }

/* --- App shell ------------------------------------------------------------ */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.sidebar .brand img { height: 30px; width: auto; }
.sidebar .brand .tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); border-left: 1px solid var(--line); padding-left: 9px; }
.nav-group { font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm); color: var(--muted); font-size: 14px; transition: color .15s, background .15s; }
.nav-link svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; flex: 0 0 auto; }
.nav-link:hover { color: var(--fg); background: var(--panel); }
.nav-link.is-active { color: var(--accent); background: rgba(0,214,143,0.08); }
.sidebar .spacer { flex: 1; }
.sidebar .signout { margin-top: auto; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 30px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(12,11,10,0.85); backdrop-filter: blur(8px); z-index: 5; }
.topbar h1 { font-size: 20px; }
.topbar .who { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: right; }
.topbar .who b { color: var(--fg); font-weight: 500; }
.content { padding: 30px; max-width: 1180px; width: 100%; }

/* --- Mobile nav controls (hamburger drawer; shown only ≤920px) ------------ */
.topbar-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-r { display: flex; align-items: center; gap: 18px; }
.nav-burger, .nav-close { cursor: pointer; color: var(--fg); border-radius: 8px; transition: color .15s, background .15s; }
.nav-burger svg, .nav-close svg { display: block; width: 22px; height: 22px; }
.nav-toggle { display: none !important; }  /* keep the hidden checkbox hidden (the global checkbox style would otherwise show it) */
.nav-burger, .nav-close, .nav-backdrop { display: none; }

/* --- Cards ----------------------------------------------------------------- */
.card { background: linear-gradient(180deg, rgba(245,240,232,0.02), rgba(245,240,232,0)); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card:hover { border-color: var(--line2); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 16px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* --- Stat cells ------------------------------------------------------------ */
.stat { padding: 22px; background: #0E0D0C; border: 1px solid var(--line); border-radius: var(--r-lg); }
.stat .v { font-family: var(--serif); font-style: italic; font-variation-settings: 'wght' 500, 'SOFT' 80; color: var(--accent); font-size: 44px; line-height: 1; letter-spacing: -0.03em; }
.stat .k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }

/* --- Buttons --------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 14px; font-weight: 500; padding: 10px 18px; border-radius: var(--r-md); border: 1px solid transparent; cursor: pointer; transition: all .18s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.btn-primary { background: var(--accent); color: var(--ink); }
.btn-primary:hover { background: var(--accent2); box-shadow: 0 10px 30px -12px rgba(0,214,143,0.5); }
.btn-secondary { background: var(--panel); color: var(--fg); border-color: var(--line2); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--fg); background: var(--panel); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(242,113,91,0.4); }
.btn-danger:hover { background: rgba(242,113,91,0.12); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Forms ----------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.input, .select, textarea.input {
  width: 100%; background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 11px 13px; color: var(--fg); font-family: inherit; font-size: 14px; outline: none;
  transition: border-color .2s; box-sizing: border-box;
}
.input:hover, .select:hover { border-color: var(--line2); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); }
.input[dir="rtl"] { text-align: right; }
.field .hint { font-size: 12px; color: var(--dim); margin-top: 6px; }
.field .err { font-size: 12px; color: var(--danger); margin-top: 6px; }
.field.has-err .input, .field.has-err .select { border-color: var(--danger); }

/* Select — themed for the dark UI (custom chevron + dark option list) */
.select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239B968C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 16px;
}
.select:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300D68F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.select option { background: #15120E; color: var(--fg); }
.select option:disabled { color: var(--dim); }
[dir="rtl"] .select { background-position: left 13px center; padding-right: 13px; padding-left: 40px; }

/* Radios & checkboxes — custom dark/green controls */
input[type="radio"], input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  width: 18px; height: 18px; margin: 0; flex: 0 0 auto; vertical-align: middle;
  border: 1.5px solid var(--line2); background: var(--ink); cursor: pointer;
  display: inline-grid; place-content: center; transition: border-color .15s, background .15s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"] { border-radius: 5px; }
input[type="radio"]:hover, input[type="checkbox"]:hover { border-color: var(--accent); }
input[type="radio"]:checked, input[type="checkbox"]:checked { border-color: var(--accent); background: var(--accent); }
input[type="radio"]:checked::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
input[type="checkbox"]:checked::before {
  content: ''; width: 12px; height: 12px; background-repeat: no-repeat; background-position: center; background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230C0B0A' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}
input[type="radio"]:focus-visible, input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Highlight a selectable card when its radio/checkbox is chosen */
label.card:has(input:checked) { border-color: var(--accent); background: rgba(0,214,143,0.05); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-section { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin: 26px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.form-actions { display: flex; gap: 12px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }

/* --- Tables ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--fg); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover { background: var(--panel); }
table.data .muted { color: var(--muted); }
table.data .mono { font-family: var(--mono); font-size: 12.5px; }

/* --- Badges ---------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); }
.badge.ok { color: var(--accent); border-color: rgba(0,214,143,0.4); background: rgba(0,214,143,0.07); }
.badge.bad { color: var(--danger); border-color: rgba(242,113,91,0.4); background: rgba(242,113,91,0.07); }
.badge.warn { color: var(--gold); border-color: rgba(232,185,78,0.4); background: rgba(232,185,78,0.07); }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* --- Flash ----------------------------------------------------------------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.flash.success { color: var(--accent); border-color: rgba(0,214,143,0.4); background: rgba(0,214,143,0.06); }
.flash.error { color: var(--danger); border-color: rgba(242,113,91,0.4); background: rgba(242,113,91,0.07); }

/* --- Empty state ----------------------------------------------------------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .ic { width: 46px; height: 46px; margin: 0 auto 16px; opacity: .5; }
.empty h3 { font-family: var(--serif); font-size: 20px; color: var(--fg); margin-bottom: 8px; }

/* --- Page header ----------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { position: relative; }
.search .input { padding-left: 36px; min-width: 240px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--dim); fill: none; stroke-width: 1.7; }

.pill-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.pill-tabs a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; padding: 6px 14px; border-radius: 999px; color: var(--muted); }
.pill-tabs a.is-active { background: var(--accent); color: var(--ink); }

/* --- Pagination ------------------------------------------------------------ */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px; }
.pager-info { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--muted); }

/* --- Language switch ------------------------------------------------------- */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-switch a { padding: 4px 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); transition: background .15s, color .15s; }
.lang-switch a.is-active { background: var(--accent); color: var(--ink); }
.lang-switch a:not(.is-active):hover { color: var(--fg); }

/* --- RTL (Arabic UI) ------------------------------------------------------- */
[dir="rtl"] body { font-family: 'Cairo', 'Inter Tight', system-ui, sans-serif; }
[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .nav-link, [dir="rtl"] .sidebar .brand { flex-direction: row-reverse; }
[dir="rtl"] .stat .k, [dir="rtl"] .label-mono, [dir="rtl"] .eyebrow { letter-spacing: 0; }
[dir="rtl"] table.data th, [dir="rtl"] table.data td { text-align: right; }
[dir="rtl"] .page-head, [dir="rtl"] .card-head, [dir="rtl"] .form-actions { flex-direction: row-reverse; }

/* =========================================================================
   Standalone pages (login + public verification) — no app shell
   ========================================================================= */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(0,214,143,0.10), transparent 55%),
    var(--ink); }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 28px; }
.auth-brand img { height: 42px; }
.auth-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 32px; }
.auth-box h1 { font-size: 24px; margin-bottom: 6px; }
.auth-box h1 em { font-family: var(--serif); font-style: italic; color: var(--accent); }
.auth-box .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 22px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }

/* Verification result */
.verify-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 50% -10%, rgba(0,214,143,0.08), transparent 55%), var(--ink); }
.verify-card { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; }
.verify-status { padding: 40px 32px 28px; text-align: center; border-bottom: 1px solid var(--line); }
.verify-status .seal { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; border: 2px solid; }
.verify-status .seal svg { width: 38px; height: 38px; stroke-width: 2.4; fill: none; }
.verify-status h1 { font-family: var(--serif); font-style: italic; font-size: 30px; margin-bottom: 6px; }
.verify-status p { color: var(--muted); font-size: 14px; }
.v-valid .seal { border-color: var(--accent); color: var(--accent); background: rgba(0,214,143,0.08); }
.v-valid h1 { color: var(--accent); }
.v-bad .seal { border-color: var(--danger); color: var(--danger); background: rgba(242,113,91,0.08); }
.v-bad h1 { color: var(--danger); }
.v-warn .seal { border-color: var(--gold); color: var(--gold); background: rgba(232,185,78,0.08); }
.v-warn h1 { color: var(--gold); }
.verify-rows { padding: 8px 32px 24px; }
.v-row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.v-row:last-child { border-bottom: 0; }
.v-row .k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.v-row .val { color: var(--fg); text-align: right; }
.verify-foot { padding: 18px 32px; background: var(--ink); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; justify-content: center; }
.verify-foot img { height: 22px; }
.verify-foot span { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .nav-burger { display: inline-flex; align-items: center; padding: 6px; margin: -6px 2px -6px -6px; }
  .nav-burger:hover { background: var(--panel); color: var(--accent); }
  /* Sidebar becomes an off-canvas drawer toggled by the hamburger */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 274px; max-width: 84vw;
    height: auto; flex-direction: column; z-index: 60; overflow-y: auto;
    border-right: 1px solid var(--line); border-bottom: 0;
    transform: translateX(-104%); transition: transform .26s ease;
  }
  .nav-toggle:checked ~ .sidebar { transform: translateX(0); box-shadow: 30px 0 60px -25px rgba(0,0,0,.85); }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(8,7,6,0.62); opacity: 0; pointer-events: none; transition: opacity .26s; }
  .nav-toggle:checked ~ .nav-backdrop { opacity: 1; pointer-events: auto; }
  .nav-close { display: inline-flex; position: absolute; top: 22px; right: 14px; color: var(--muted); padding: 4px; }
  .nav-close:hover { color: var(--fg); }
  .topbar { padding: 14px 18px; flex-wrap: wrap; row-gap: 10px; }
  .topbar h1 { font-size: 18px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  /* Bare .grid elements with an inline 2-col template — collapse to one column. */
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .content { padding: 20px; }
  /* RTL: drawer slides in from the right */
  [dir="rtl"] .sidebar { left: auto; right: 0; border-left: 1px solid var(--line); border-right: 0; transform: translateX(104%); }
  [dir="rtl"] .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
  [dir="rtl"] .nav-close { right: auto; left: 14px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .topbar .who { font-size: 10px; }
  .content { padding: 16px; }
}

/* ===== Letterhead editor (dedicated page) ===== */
.lhe-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.lhe-tb-l { display: flex; align-items: center; gap: 14px; }
.lhe-tb-r { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lhe-back { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--r-md); border: 1px solid var(--line2); color: var(--muted); font-size: 18px; text-decoration: none; }
.lhe-back:hover { color: var(--accent); border-color: var(--accent); }
.lhe-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.lhe-scope { font-size: 15px; color: var(--fg); margin-top: 2px; }
.lhe-applies { display: inline-flex; align-items: center; gap: 9px; }
.lhe-applies span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.lhe-applies select { font-family: var(--sans); font-size: 13.5px; color: var(--fg); background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r-md); padding: 9px 12px; cursor: pointer; min-width: 220px; }
.lhe-applies select:hover { border-color: var(--accent); }
.lhe-applies select option { background: #15120E; color: var(--fg); }
.lhe-note { background: rgba(0,214,143,0.06); border: 1px solid rgba(0,214,143,0.22); border-radius: var(--r-md); padding: 11px 15px; font-size: 13px; color: var(--muted); margin-bottom: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lhe-note strong { color: var(--fg); }
.lhe-reset { margin-left: auto; background: transparent; border: 1px solid rgba(242,113,91,0.4); color: var(--danger); border-radius: var(--r-sm); padding: 6px 12px; font-family: var(--sans); font-size: 13px; cursor: pointer; }
.lhe-reset:hover { background: rgba(242,113,91,0.12); }

.lhe-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.08fr); gap: 22px; align-items: start; }
.lhe-controls { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lhe-card { background: linear-gradient(180deg, rgba(245,240,232,0.02), rgba(245,240,232,0)); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 20px; }
.lhe-card h3 { display: flex; align-items: center; gap: 9px; font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--fg); margin: 0 0 6px; }
.lhe-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

.lhe-field { display: grid; grid-template-columns: 142px minmax(0,1fr); gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.lhe-card h3 + .lhe-field { border-top: 0; }
.lhe-flabel { font-size: 13px; color: var(--fg); display: flex; flex-direction: column; }
.lhe-hint { font-size: 11px; color: var(--dim); margin-top: 2px; }
.lhe-fctrl { display: flex; align-items: center; justify-content: flex-end; min-width: 0; }

.lhe-seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.lhe-seg input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lhe-seg label { padding: 7px 13px; font-size: 12.5px; color: var(--muted); cursor: pointer; background: var(--panel); border-right: 1px solid var(--line2); transition: background .14s, color .14s; margin: 0; }
.lhe-seg label:last-of-type { border-right: 0; }
.lhe-seg input:checked + label { background: var(--accent); color: var(--ink); font-weight: 600; }

.lhe-rngwrap { display: flex; align-items: center; gap: 12px; width: 100%; }
.lhe-range { flex: 1; accent-color: var(--accent); cursor: pointer; height: 22px; min-width: 80px; }
.lhe-val { font-family: var(--mono); font-size: 12px; color: var(--accent); min-width: 48px; text-align: right; }

.lhe-tog { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; }
.lhe-tog input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lhe-knob { width: 40px; height: 22px; border-radius: 11px; background: var(--line2); position: relative; transition: background .16s; flex: none; }
.lhe-knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #ECE7DE; transition: transform .16s; }
.lhe-tog input:checked + .lhe-knob { background: var(--accent); }
.lhe-tog input:checked + .lhe-knob::after { transform: translateX(18px); background: #06281F; }
.lhe-tog-lbl { font-size: 12.5px; color: var(--muted); }

.lhe-color { width: 44px; height: 34px; padding: 3px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); cursor: pointer; }
.lhe-hex { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: 10px; }

.lhe-actions { display: flex; gap: 12px; align-items: center; padding-top: 4px; }

.lhe-preview { position: sticky; top: 14px; }
.lhe-preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.lhe-live { font-size: 12px; color: var(--accent); font-weight: 500; }
.lhe-preview-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.lhe-preview-frame { background: #52565A; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
#lh-preview { width: 100%; height: 78vh; min-height: 540px; border: 0; display: block; }

@media (max-width: 1024px) {
  .lhe-grid { grid-template-columns: 1fr; }
  .lhe-preview { position: static; order: -1; }
  #lh-preview { height: 70vh; }
}
@media (max-width: 560px) {
  .lhe-field { grid-template-columns: 1fr; gap: 8px; }
  .lhe-fctrl { justify-content: flex-start; }
  .lhe-tb-r { width: 100%; }
  .lhe-applies, .lhe-applies select { flex: 1; }
}

/* ===== Email-templates editor ===== */
#em-preview { width: 100%; height: 80vh; min-height: 560px; border: 0; display: block; background: #F1EEE8; }
.eme-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.eme-chip { font-family: var(--mono); font-size: 12px; color: var(--accent); background: rgba(0,214,143,0.08); border: 1px solid rgba(0,214,143,0.28); border-radius: 7px; padding: 5px 9px; cursor: pointer; transition: background .14s; }
.eme-chip:hover { background: rgba(0,214,143,0.18); }
.lhe-card .field code, .field .hint code { font-family: var(--mono); font-size: 11.5px; color: var(--accent); background: rgba(0,214,143,0.08); padding: 1px 5px; border-radius: 4px; }
@media (max-width: 1024px) { #em-preview { height: 70vh; } }

/* ===== Billing (quotations · invoices · credit notes) ===== */
.sidebar { overflow-y: auto; }   /* three nav groups — keep every link reachable on short screens */
.fin-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: -6px 0 16px; }
.fin-tabs a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; padding: 6px 13px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line); }
.fin-tabs a:hover { color: var(--fg); border-color: var(--line2); }
.fin-tabs a.is-active { background: rgba(0,214,143,0.1); color: var(--accent); border-color: rgba(0,214,143,0.4); }

table.fin-lines { width: 100%; border-collapse: collapse; }
table.fin-lines th { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.fin-lines td { padding: 6px; vertical-align: top; }
table.fin-lines .input { padding: 9px 10px; }
table.fin-lines textarea.input { resize: vertical; min-height: 40px; line-height: 1.45; overflow: hidden; }
.ln-no { font-family: var(--mono); font-size: 12px; color: var(--dim); padding-top: 16px !important; }
.ln-amt, .ms-amt { text-align: right; padding-top: 16px !important; font-size: 13px; color: var(--fg); white-space: nowrap; }
.ln-del { width: 30px; height: 30px; margin-top: 5px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--dim); font-size: 18px; line-height: 1; cursor: pointer; }
.ln-del:hover { color: var(--danger); border-color: rgba(242,113,91,0.4); background: rgba(242,113,91,0.08); }

.fin-totals { margin: 18px 0 0 auto; max-width: 460px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 16px; background: #0E0D0C; }
.ft-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.ft-row:last-child { border-bottom: 0; }
.ft-row > span:first-child { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ft-sel { width: auto; padding: 6px 34px 6px 10px; font-size: 13px; }
.ft-in { width: 86px; padding: 6px 9px; font-size: 13px; }
.ft-total { color: var(--fg); font-size: 16px; }
.ft-total .mono { color: var(--accent); font-size: 17px; }

.fin-plan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fin-plan-opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; cursor: pointer; }
.fin-plan-opt input[type="radio"] { margin-top: 2px; }
.fin-plan-opt b { display: block; font-weight: 600; font-size: 14px; color: var(--fg); }
.fin-plan-opt small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.fin-plan-opt small .ft-in { width: 64px; display: inline-block; margin-right: 4px; }

.fin-issue { display: flex; gap: 22px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; border-color: rgba(232,185,78,0.4); }
.fin-issue > div { flex: 1 1 320px; }
.fin-issue-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.fin-issue-form .field { margin: 0; }
.fin-issue-form .input { padding: 9px 11px; }
.fin-issue-btns { display: flex; gap: 10px; }
.fin-stage, .fin-pay { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.fin-stage:last-child, .fin-pay:last-of-type { border-bottom: 0; }

/* Public verification — bank block on invoices */
.v-bank { padding: 18px 32px 22px; border-top: 1px solid var(--line); background: rgba(0,214,143,0.03); }
.v-bank .v-row { align-items: center; }
.v-copy { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.v-copy-btn { margin-left: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); background: transparent; border: 1px solid rgba(0,214,143,0.35); border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.v-copy-btn:hover { background: rgba(0,214,143,0.1); }
.v-warn-note { font-size: 12.5px; color: var(--gold); margin: 14px 0 0; line-height: 1.55; }

@media (max-width: 920px) {
  .fin-plan { grid-template-columns: 1fr; }
  .fin-totals { max-width: none; }
  table.fin-lines th:first-child, table.fin-lines td.ln-no { display: none; }
}
@media (max-width: 560px) {
  .v-bank { padding: 16px 20px 20px; }
  .v-bank .v-row { flex-direction: column; gap: 4px; align-items: flex-start; }
  .v-bank .v-row .val { text-align: left; }
}
table.data td.mono, table.data td.nowrap { white-space: nowrap; }   /* reference numbers + amounts never break mid-token */

/* ===== Leads ===== */
.nav-count { margin-inline-start: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: rgba(232,185,78,0.14); border: 1px solid rgba(232,185,78,0.4); color: var(--gold); font-family: var(--mono); font-size: 10.5px; line-height: 16px; text-align: center; }
.fin-tabs a .tab-n { margin-inline-start: 6px; color: var(--dim); }
.fin-tabs a.is-active .tab-n { color: inherit; opacity: .75; }
.lead-msg { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.65; color: var(--fg); margin: 0; }
.lead-slot { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid rgba(232,185,78,0.4); background: rgba(232,185,78,0.06); border-radius: var(--r-md); color: var(--fg); font-size: 14px; }
.lead-slot svg { width: 18px; height: 18px; stroke: var(--gold); fill: none; stroke-width: 1.7; flex: 0 0 auto; }
.lead-who { font-size: 12px; color: var(--muted); margin-top: 2px; }
.v-row .val a { color: var(--fg); }
.v-row .val a:hover { color: var(--accent); }

/* ===== Two-step login (Users page) ===== */
.tfa-setup { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.tfa-setup img { background: #fff; padding: 10px; border-radius: var(--r-md); flex: none; }
.tfa-steps { margin: 0 0 14px; padding-left: 18px; font-size: 13.5px; color: var(--muted); line-height: 1.7; max-width: 520px; }
.tfa-steps b { color: var(--fg); }
.tfa-key { color: var(--accent); font-size: 12.5px; word-break: break-all; }
.tfa-codes { border: 1px solid rgba(232,185,78,0.45); background: rgba(232,185,78,0.06); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 16px; }
.tfa-code-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tfa-code-grid span { font-family: var(--mono); font-size: 14px; background: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; text-align: center; letter-spacing: 0.06em; }
.tfa-act { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.tfa-act b { font-size: 13.5px; font-weight: 600; }
.tfa-act span { font-size: 12px; color: var(--dim); }
.tfa-act .input { padding: 8px 10px; font-size: 13px; }
.tfa-act .btn { align-self: flex-start; }
@media (max-width: 920px) { .tfa-code-grid { grid-template-columns: repeat(2, 1fr); } #security .grid { grid-template-columns: 1fr !important; } }

/* ===== Home (dashboard) ===== */
a.stat-link { display: block; color: inherit; transition: border-color .15s; }
a.stat-link:hover { border-color: var(--line2); }
.attn-list { display: flex; flex-direction: column; }
.attn { display: flex; align-items: center; gap: 14px; padding: 13px 22px; border-bottom: 1px solid var(--line); color: var(--fg); transition: background .15s; }
.attn:last-child { border-bottom: 0; }
.attn:hover { background: var(--panel); }
.attn-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dim); }
.attn-bad .attn-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(242,113,91,0.15); }
.attn-warn .attn-dot { background: var(--gold); }
.attn-todo .attn-dot { background: var(--accent); }
.attn-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.attn-body b { font-weight: 500; font-size: 14px; }
.attn-body span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-go { color: var(--dim); font-size: 15px; }
.attn:hover .attn-go { color: var(--accent); }

/* Sidebar: red counter for overdue invoices; the user block links to their account */
.nav-count.bad { background: rgba(242,113,91,0.14); border-color: rgba(242,113,91,0.45); color: var(--danger); }
a.who { color: var(--muted); text-decoration: none; border-radius: 8px; padding: 2px 6px; margin: -2px -6px; transition: background .15s; }
a.who:hover { background: var(--panel); }

/* ===== Settings tabs ===== */
.set-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: -4px 0 18px; max-width: 880px; border-bottom: 1px solid var(--line); }
.set-tabs a { font-size: 14px; color: var(--muted); padding: 9px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.set-tabs a:hover { color: var(--fg); }
.set-tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.set-code { display: flex; align-items: center; gap: 10px; background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.set-code code { font-family: var(--mono); font-size: 12px; color: var(--accent); word-break: break-all; flex: 1; }
.set-code .v-copy-btn { margin-left: 0; flex: none; }
