/* ==========================================================================
   Droom Dazlean Solutions ERP - design system (one stylesheet for every page)
   Brand: ink navy + gold on warm neutrals. Compact, screen-fitting layouts.
   ========================================================================== */
@import url("../vendor/bootstrap-icons/bootstrap-icons.min.css");

:root {
  --ink: #1a1a2e; --ink-2: #2d3561; --ink-3: #3d4f7c;
  --gold: #c9a84c; --gold-2: #e8c96e; --gold-pale: #faf3e0;
  --bg: #f4f2ed; --surface: #ffffff; --surface-2: #faf9f6;
  --border: #e6e0d3; --border-strong: #d4cbb6;
  --text: #1f2333; --text-2: #4b5165; --muted: #7d7f8c;
  --success: #2d6a4f; --success-bg: #e6f2ec;
  --warning: #9c6400; --warning-bg: #fdf1dc;
  --danger: #a12b3c; --danger-bg: #fbe8eb;
  --info: #1e4d8c; --info-bg: #e5eefa;
  --radius: 9px; --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(26,26,46,.06), 0 1px 3px rgba(26,26,46,.05);
  --shadow: 0 4px 16px rgba(26,26,46,.08);
  --shadow-lg: 0 18px 50px rgba(26,26,46,.22);
  --sidebar-w: 236px; --sidebar-mini: 62px; --topbar-h: 52px;
  --control-h: 34px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Georgia, Cambria, "Times New Roman", serif;
  --mono: Consolas, "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45; min-height: 100vh; }
a { color: var(--ink-3); text-decoration: none; }
a:hover { color: var(--ink); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4rem; line-height: 1.25; color: var(--ink); }
h1 { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 .6rem; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .88em; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; } .text-center { text-align: center; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }
.hidden, [hidden] { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
::selection { background: var(--gold-2); color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layout shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--ink); color: #d9dbe6; position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; z-index: 40; transition: width .18s ease, transform .2s ease; }
.sidebar-brand { display: flex; align-items: center; gap: .65rem; padding: 0 .9rem; height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,.08); overflow: hidden; white-space: nowrap; }
.sidebar-brand img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); flex-shrink: 0; }
.sidebar-brand .name { font-family: var(--font-display); color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.1; }
.sidebar-brand .tag { color: var(--gold-2); font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-nav { overflow-y: auto; overflow-x: hidden; padding: .35rem 0 .8rem; flex: 1; scrollbar-width: thin; scrollbar-color: #3a3f5c transparent; }
.nav-section { padding: .7rem 1rem .25rem; font-size: .63rem; letter-spacing: .14em; text-transform: uppercase; color: #8d91ab; font-weight: 600; white-space: nowrap; }
.nav-link { display: flex; align-items: center; gap: .65rem; padding: .42rem .9rem; margin: 1px .5rem; border-radius: 7px; color: #d9dbe6; font-size: .88rem; white-space: nowrap; }
.nav-link i { font-size: 1rem; width: 1.15rem; text-align: center; color: #a9adc5; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-link.active { background: linear-gradient(90deg, rgba(201,168,76,.24), rgba(201,168,76,.06)); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-link.active i { color: var(--gold-2); }
.sidebar-foot { padding: .7rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .72rem; color: #8d91ab; white-space: nowrap; overflow: hidden; }

/* icon-only sidebar (toggle, or automatically on medium screens) */
body.nav-mini .sidebar { width: var(--sidebar-mini); }
body.nav-mini .sidebar .nav-link span, body.nav-mini .sidebar .nav-section, body.nav-mini .sidebar-brand div, body.nav-mini .sidebar-foot { display: none; }
body.nav-mini .sidebar .nav-link { justify-content: center; padding: .5rem 0; }
body.nav-mini .sidebar-nav { padding-top: .6rem; }
body.nav-mini .main { margin-left: var(--sidebar-mini); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .18s ease; }
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .75rem; padding: 0 1.1rem; position: sticky; top: 0; z-index: 30; }
.breadcrumb { display: flex; gap: .4rem; align-items: center; color: var(--muted); font-size: .84rem; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { opacity: .5; }
.breadcrumb .current { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.user-menu { position: relative; }
.user-chip { display: flex; align-items: center; gap: .5rem; padding: .2rem .45rem .2rem .2rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); }
.user-chip:hover { border-color: var(--border-strong); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink-2); color: var(--gold-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .74rem; flex-shrink: 0; }
.avatar.lg { width: 42px; height: 42px; font-size: .9rem; }
.user-chip .who { text-align: left; line-height: 1.1; max-width: 170px; }
.user-chip .who b { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 210px; padding: .3rem; display: none; z-index: 60; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; gap: .55rem; align-items: center; width: 100%; padding: .5rem .65rem; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: .25rem 0; }
/* notifications (bell) */
.notif-dropdown { width: min(340px, calc(100vw - 24px)); }
.notif-head { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .4rem .65rem .3rem; }
.notif-dropdown a { font-size: .86rem; line-height: 1.3; }
.notif-icon { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface-2); }
.notif-icon.warning { color: var(--warning); } .notif-icon.danger { color: var(--danger); } .notif-icon.info { color: var(--info, var(--text-2)); }
.notif-empty { padding: .9rem .65rem; color: var(--muted); font-size: .86rem; }
.list li[data-href]:hover { background: var(--surface-2); }
/* client portal pop-up after sign-in: big, bright, short messages */
.client-notice .modal-content { border: 3px solid var(--gold); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.client-notice .modal-head h2 { font-size: 1.35rem; display: flex; gap: .5rem; align-items: center; }
.client-notice .modal-head h2 i { color: var(--gold); animation: cn-ring 1.2s ease-in-out 2; }
.cn-item { display: flex; gap: .8rem; align-items: center; padding: .85rem .9rem; border-radius: 12px; margin-bottom: .65rem;
  background: var(--surface-2); border-left: 6px solid var(--gold); }
.cn-item.success { border-left-color: var(--success); } .cn-item.info { border-left-color: var(--info, #2563eb); }
.cn-item.warning { border-left-color: var(--warning); }
.cn-icon { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.35rem; background: var(--surface); color: var(--gold); }
.cn-item.success .cn-icon { color: var(--success); } .cn-item.info .cn-icon { color: var(--info, #2563eb); } .cn-item.warning .cn-icon { color: var(--warning); }
.cn-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.cn-text b { font-size: 1.05rem; } .cn-text span { font-size: .9rem; color: var(--text-2); }
@media (max-width: 520px) { .cn-item { flex-wrap: wrap; } .cn-item .btn { width: 100%; } }
@keyframes cn-ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-18deg); } 40% { transform: rotate(16deg); } 60% { transform: rotate(-10deg); } 80% { transform: rotate(6deg); } }
.pay-box { background: var(--surface-2); border-radius: 10px; padding: .8rem .9rem; white-space: pre-wrap; font-family: var(--font-mono, monospace); font-size: .92rem; }
/* line items: a line that cannot be saved (empty, no description or no amount) */
.items-table tr.line-error td { background: color-mix(in srgb, var(--danger) 7%, transparent); }
.items-table .is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 20%, transparent); }
.pay-amount { font-size: 1.6rem; font-weight: 800; color: var(--gold); }
.content { padding: 1rem 1.1rem 1.25rem; flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; }
.footer { padding: .6rem 1.1rem; color: var(--muted); font-size: .74rem; text-align: center; }
.scrim { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.page-title { min-width: 0; }
.page-head .eyebrow { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin-bottom: .1rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--text-2); margin: .1rem 0 0; font-size: .86rem; }
.actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }

/* ---------- Cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1rem; }
.card-body.flush { padding: 0; }
.card-foot { padding: .7rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.split-layout { grid-template-columns: 220px minmax(0, 1fr); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: .7rem .85rem; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; display: flex; gap: .7rem; align-items: flex-start; min-width: 0; color: inherit; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--kpi-accent, var(--gold)); }
.kpi > div:not(.kpi-icon):not(.kpi-body) { min-width: 0; }
.kpi-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--kpi-accent, var(--gold)) 12%, white); color: var(--kpi-accent, #8a6d1f); font-size: 1rem; flex-shrink: 0; }
.kpi-body { min-width: 0; flex: 1; }
.kpi:not(:has(.kpi-body)) { flex-direction: column; gap: .1rem; }
.kpi .label { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kpi .value { font-size: 1.3rem; font-weight: 700; color: var(--ink); line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kpi .hint { font-size: .75rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kpi.success { --kpi-accent: var(--success); } .kpi.danger { --kpi-accent: var(--danger); } .kpi.info { --kpi-accent: var(--info); } .kpi.warning { --kpi-accent: var(--warning); }
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: var(--control-h); padding: 0 .85rem; border-radius: 8px;
  border: 1px solid transparent; font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; line-height: 1; background: var(--ink); color: #fff;
  transition: background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-gold { background: var(--gold); color: var(--ink); } .btn-gold:hover { background: var(--gold-2); color: var(--ink); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-3); }
.btn-ghost { background: transparent; color: var(--text-2); } .btn-ghost:hover { background: rgba(26,26,46,.06); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; } .btn-danger:hover { background: #86202f; }
.btn-success { background: var(--success); color: #fff; } .btn-success:hover { background: #245a42; }
.btn-sm { height: 28px; padding: 0 .6rem; font-size: .78rem; border-radius: 6px; }
.btn-icon { width: var(--control-h); padding: 0; } .btn-sm.btn-icon { width: 28px; }
.btn-block { width: 100%; }
.spin { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); flex-shrink: 0; }
.seg button { border: 0; background: none; height: calc(var(--control-h) - 2px); padding: 0 .65rem; cursor: pointer; color: var(--text-2); font: inherit; font-size: .82rem; display: inline-flex; align-items: center; gap: .3rem; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--ink); color: #fff; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: .8rem 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-all, .form-grid > .check, .form-grid > p { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > label, .label { font-size: .78rem; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--danger); }
.field .help { font-size: .74rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url],
input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; height: var(--control-h); padding: 0 .65rem; border: 1px solid var(--border-strong); border-radius: 8px; background-color: var(--surface);
  color: var(--text); font: inherit; font-size: .88rem; transition: border-color .15s, box-shadow .15s; min-width: 0; }
select { padding-right: 1.8rem; appearance: none; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%237d7f8c' stroke-width='2' d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right .55rem center / 12px; }
textarea { height: auto; min-height: 76px; padding: .5rem .65rem; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(61,79,124,.15); }
input[readonly], input:disabled, select:disabled, textarea[readonly] { background-color: var(--surface-2); color: var(--text-2); }
.is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(161,43,60,.12) !important; }
.input-group { display: flex; } .input-group > * { border-radius: 0 !important; } .input-group > :first-child { border-radius: 8px 0 0 8px !important; } .input-group > :last-child { border-radius: 0 8px 8px 0 !important; }
.input-icon { position: relative; } .input-icon > i { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: .9rem; }
.input-icon input { padding-left: 2rem; }
.check { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .86rem; user-select: none; }
.check input { width: 1rem; height: 1rem; accent-color: var(--ink); margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; margin: 0; }
legend { font-weight: 650; padding: 0 .4rem; color: var(--ink); }
.form-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 700; grid-column: 1 / -1; margin-top: .3rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .6rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.toolbar .search { flex: 1 1 220px; max-width: 360px; }
.toolbar select { width: auto; min-width: 140px; max-width: 220px; }
.toolbar input[type=date] { width: 140px; }
.toolbar input[type=number] { width: 110px; }
.toolbar .label { white-space: nowrap; }
.chips { display: flex; gap: .3rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); height: 28px; padding: 0 .65rem; border-radius: 999px; cursor: pointer; font: inherit; font-size: .78rem; white-space: nowrap; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 290px); min-height: 160px; }
.table-wrap.short { max-height: 360px; min-height: 0; }
.table-wrap.free { max-height: none; min-height: 0; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; }
.table th, .table td { padding: .5rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--surface-2); color: var(--text-2); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; position: sticky; top: 0; z-index: 2; white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
/* anything with a page behind it opens with one click */
[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover td { background: var(--surface-2, rgba(0,0,0,.035)); }
.table th.sortable::after { content: "\2195"; opacity: .35; margin-left: .3rem; }
.table th.sort-asc::after { content: "\2191"; opacity: .9; } .table th.sort-desc::after { content: "\2193"; opacity: .9; }
.table tbody tr:hover td { background: #fcfaf5; }
.table tbody tr.qv { cursor: pointer; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.actions-cell { text-align: right; white-space: nowrap; width: 1%; }
.table tfoot td { font-weight: 700; background: var(--surface-2); position: sticky; bottom: 0; }
.table.compact th, .table.compact td { padding: .38rem .6rem; }
.table .primary-text { font-weight: 600; color: var(--ink); }
.table .sub-text { font-size: .76rem; color: var(--muted); }
.table .cell { max-width: var(--cell-max, 260px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .cell > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.empty i { font-size: 1.8rem; display: block; margin-bottom: .4rem; color: var(--border-strong); }
.loading-row td { text-align: center; color: var(--muted); padding: 1.5rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--text-2); border-top: 1px solid var(--border); }
.pager:empty { display: none; }
.pager .pages { display: flex; gap: .25rem; }
.pager .btn { height: 28px; min-width: 28px; padding: 0 .45rem; font-size: .78rem; }

/* ---------- Card (grid) view of lists ---------- */
.card-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); padding: .9rem; overflow: auto; max-height: calc(100vh - 290px); min-height: 160px; align-content: start; }
.card-grid .empty { grid-column: 1 / -1; }
.item-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .85rem; cursor: pointer; display: flex; flex-direction: column; gap: .45rem; min-width: 0; transition: border-color .15s, box-shadow .15s, transform .15s; }
.item-card:hover { border-color: var(--gold); box-shadow: var(--shadow); transform: translateY(-1px); }
.item-card .ic-title { font-weight: 650; color: var(--ink); min-width: 0; }
.item-card .ic-title * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .6rem; margin: 0; font-size: .8rem; }
.item-card dt { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; padding-top: .12rem; white-space: nowrap; }
.item-card dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.item-card dd * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-card dd .sub-text { display: none; }
.item-card .ic-actions { display: flex; gap: .3rem; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: .45rem; margin-top: auto; }
.mini-cards { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); padding: .8rem; max-height: 330px; overflow: auto; align-content: start; }
.mini-card { border: 1px solid var(--border); border-radius: var(--radius); padding: .55rem .65rem; display: flex; gap: .55rem; align-items: center; min-width: 0; cursor: pointer; background: var(--surface); color: inherit; }
.mini-card:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); text-decoration: none; }
.mini-card .mc-body { min-width: 0; flex: 1; }
.mini-card .mc-title { font-weight: 600; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.mini-card .mc-sub { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card .mc-right { text-align: right; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.mini-cards .empty { grid-column: 1 / -1; padding: 1.2rem; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.badge.success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge.warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.gold { background: var(--gold-pale); color: #8a6d1f; border-color: transparent; }
.badge.dark { background: var(--ink); color: #fff; border-color: transparent; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--border); padding: 0 1rem; overflow-x: auto; }
.tab { padding: .6rem .85rem; border: 0; background: none; font: inherit; font-size: .86rem; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); } .tab.active { color: var(--ink); border-bottom-color: var(--gold); }
.tab-panel { display: none; } .tab-panel.active { display: block; }

/* ---------- Detail lists ---------- */
.details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1rem; margin: 0; font-size: .86rem; }
.details dt { color: var(--muted); font-size: .8rem; }
.details dd { margin: 0; font-weight: 500; word-break: break-word; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 1rem; border-bottom: 1px solid var(--border); min-width: 0; }
.list li:last-child { border-bottom: 0; }

/* ---------- Alerts ---------- */
.alert { padding: .65rem .85rem; border-radius: var(--radius); border: 1px solid transparent; margin-bottom: .9rem; display: flex; gap: .55rem; align-items: flex-start; font-size: .86rem; }
.alert i { margin-top: .1rem; }
.alert.success { background: var(--success-bg); color: var(--success); }
.alert.danger, .alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.warning { background: var(--warning-bg); color: var(--warning); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert ul { margin: .25rem 0 0; padding-left: 1.1rem; }

/* ---------- Bootstrap 5 modals (data-bs-toggle / data-bs-dismiss) ---------- */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 1055; display: none; overflow-x: hidden; overflow-y: auto; outline: 0; }
.modal.fade { transition: opacity .16s linear; }
.modal.fade:not(.show) { opacity: 0; }
.modal.fade .modal-dialog { transition: transform .2s ease-out; transform: translateY(-14px) scale(.98); }
.modal.show .modal-dialog { transform: none; }
.modal-dialog { position: relative; width: auto; max-width: 620px; margin: .75rem auto; pointer-events: none; padding: 0 .75rem; }
.modal-dialog.wide { max-width: 980px; } .modal-dialog.narrow { max-width: 440px; } .modal-dialog.xwide { max-width: 1200px; }
.modal-dialog-centered { display: flex; align-items: center; min-height: calc(100% - 1.5rem); }
.modal-dialog-scrollable { height: calc(100% - 1.5rem); }
.modal-dialog-scrollable .modal-content { max-height: 100%; overflow: hidden; }
.modal-content { position: relative; display: flex; flex-direction: column; width: 100%; pointer-events: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); color: var(--text); outline: 0; }
.modal-content > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1050; background: rgba(18,18,32,.6); }
.modal-backdrop.fade { opacity: 0; transition: opacity .16s linear; } .modal-backdrop.show { opacity: 1; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-head h2 { margin: 0; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 1rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-body.flush { padding: 0; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: .45rem; padding: .65rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
.modal-icon { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: .6rem; background: var(--info-bg); color: var(--info); }
.modal-icon.danger { background: var(--danger-bg); color: var(--danger); } .modal-icon.success { background: var(--success-bg); color: var(--success); } .modal-icon.warning { background: var(--warning-bg); color: var(--warning); }
/* quick view: the zoomed detail of any clicked row or card */
.qv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem .8rem; }
.qv-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .65rem; min-width: 0; }
.qv-item.wide { grid-column: 1 / -1; }
.qv-item .qv-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: .15rem; }
.qv-item .qv-value { font-size: .92rem; word-break: break-word; }
.qv-item .qv-value, .qv-item .qv-value * { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; max-width: none !important; }
.qv-item .qv-value .sub-text { display: block; font-size: .8rem; color: var(--muted); }
.qv-title { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }
.qv-title .t { font-size: 1.1rem; font-weight: 700; color: var(--ink); min-width: 0; word-break: break-word; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .45rem; z-index: 1100; }
.toast { background: var(--ink); color: #fff; padding: .65rem .9rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; gap: .55rem; align-items: flex-start; max-width: 400px; animation: toast-in .2s ease; font-size: .86rem; }
.toast.success { background: var(--success); } .toast.error { background: var(--danger); } .toast.warning { background: var(--warning); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Line items editor ---------- */
.items-table td { vertical-align: top; padding: .4rem .5rem; }
.items-table textarea { min-height: var(--control-h); height: var(--control-h); padding: .4rem .6rem; }
.totals { margin-left: auto; width: min(340px, 100%); }
.totals .line { display: flex; justify-content: space-between; padding: .3rem 0; }
.totals .grand { border-top: 2px solid var(--ink); margin-top: .3rem; padding-top: .5rem; font-size: 1.08rem; font-weight: 700; color: var(--ink); }

/* ---------- Progress / charts ---------- */
.progress { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.chart-box { position: relative; height: 230px; }
.chart-box.tall { height: 290px; }
.chart-note { font-size: .74rem; color: var(--muted); padding: .1rem 1rem .7rem; }

/* ---------- Calendar ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.calendar .dow { padding: .35rem; font-size: .68rem; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.calendar .day { min-height: 82px; padding: .3rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: .74rem; min-width: 0; }
.calendar .day.other { background: var(--surface-2); color: var(--muted); }
.calendar .day.today { box-shadow: inset 0 0 0 2px var(--gold); }
.calendar .day .n { font-weight: 700; margin-bottom: .15rem; }
.calendar .ev { display: block; background: var(--info-bg); color: var(--info); border-radius: 4px; padding: 1px 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.calendar .ev.late { background: var(--danger-bg); color: var(--danger); }
.calendar .ev.done { background: var(--success-bg); color: var(--success); text-decoration: line-through; }

/* ---------- Auth pages ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth-hero { background: linear-gradient(160deg, rgba(26,26,46,.93), rgba(45,53,97,.88)), url("../img/dds_bg1.jpg") center/cover; color: #fff; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero .brand { display: flex; align-items: center; gap: .8rem; }
.auth-hero .brand img { width: 50px; height: 50px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; }
.auth-hero .brand b { font-family: var(--font-display); font-size: 1.3rem; display: block; }
.auth-hero .brand span { color: var(--gold-2); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; }
.auth-hero h2 { color: #fff; font-family: var(--font-display); font-size: 2rem; font-weight: 600; max-width: 30rem; }
.auth-hero p { color: #c9cce0; max-width: 30rem; }
.auth-hero ul { list-style: none; padding: 0; margin: 1.3rem 0 0; display: grid; gap: .55rem; color: #e3e5f0; }
.auth-hero li i { color: var(--gold-2); margin-right: .5rem; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: min(380px, 100%); }
.auth-card h1 { font-size: 1.7rem; }
.auth-card .field { margin-bottom: .9rem; }
.auth-card .btn { width: 100%; height: 42px; font-size: .95rem; }
.auth-card input { height: 40px; }
.password-wrap { position: relative; } .password-wrap input { padding-right: 2.5rem; }
.password-wrap button { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: .35rem; }
.pw-rules { list-style: none; padding: 0; margin: .35rem 0 0; font-size: .78rem; display: grid; gap: .15rem; }
.pw-rules li::before { content: "\2022"; margin-right: .4rem; color: var(--muted); }
.pw-rules li.ok { color: var(--success); } .pw-rules li.ok::before { content: "\2713"; color: var(--success); }

/* ---------- Documents (quotation / invoice / receipt / statement / reports) ---------- */
.doc { background: #fff; max-width: 860px; margin: 0 auto; padding: 2.2rem; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); color: #222; font-size: .9rem; }
.doc-head { display: flex; justify-content: space-between; gap: 2rem; border-bottom: 3px solid var(--ink); padding-bottom: 1.1rem; margin-bottom: 1.3rem; }
.doc-brand { display: flex; gap: .9rem; align-items: center; }
.doc-brand img { width: 66px; height: 66px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); }
.doc-brand h2 { font-family: var(--font-display); font-size: 1.4rem; margin: 0; }
.doc-brand p { margin: 0; font-size: .78rem; color: #555; }
.doc-title { text-align: right; }
.doc-title h1 { font-family: var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); font-size: 1.7rem; margin: 0; }
.doc-title .no { font-family: var(--mono); color: #555; font-size: .82rem; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 1.3rem; }
.doc-parties h4 { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); margin-bottom: .3rem; }
.doc table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: .86rem; }
.doc th { background: var(--ink); color: #fff; text-align: left; padding: .55rem .7rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.doc td { padding: .55rem .7rem; border-bottom: 1px solid #e8e8e8; vertical-align: top; }
.doc .num { text-align: right; white-space: nowrap; }
.doc h3.doc-section { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); border-bottom: 1px solid #eee; padding-bottom: .3rem; margin: 1.4rem 0 .6rem; }
.doc-foot { margin-top: 1.6rem; padding-top: .9rem; border-top: 1px solid #ddd; font-size: .76rem; color: #666; text-align: center; }
.doc-stamp { display: inline-block; border: 3px solid var(--success); color: var(--success); padding: .3rem 1rem; font-weight: 800; letter-spacing: .15em; transform: rotate(-6deg); border-radius: 6px; }
.doc-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: 1rem; }
.doc-kpis div { border: 1px solid #e6e0d3; border-radius: 8px; padding: .55rem .7rem; }
.doc-kpis > div > span { display: block; font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: #888; }
.doc-kpis b { font-size: 1.05rem; color: var(--ink); }
.doc-kpis small { display: block; font-size: .72rem; }
.doc .up { color: var(--success); } .doc .down { color: var(--danger); }
.doc tr.subtotal td { font-weight: 700; background: #faf9f6; }
.doc tr.total td { font-weight: 800; background: var(--gold-pale); font-size: .95rem; }
.doc .chart-box { height: 220px; }

/* ---------- Embedded office tools ---------- */
.tool-frame { width: 100%; height: calc(100vh - var(--topbar-h) - 7.2rem); min-height: 520px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); display: block; }

/* ---------- Error page ---------- */
.error-page { text-align: center; padding: 3.5rem 1rem; }
.error-page .code { font-family: var(--font-display); font-size: 4.5rem; color: var(--gold); line-height: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) and (min-width: 901px) {
  body:not(.nav-full) .sidebar { width: var(--sidebar-mini); }
  body:not(.nav-full) .sidebar .nav-link span, body:not(.nav-full) .sidebar .nav-section, body:not(.nav-full) .sidebar-brand div, body:not(.nav-full) .sidebar-foot { display: none; }
  body:not(.nav-full) .sidebar .nav-link { justify-content: center; padding: .5rem 0; }
  body:not(.nav-full) .main { margin-left: var(--sidebar-mini); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar, body.nav-mini .sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
  body.nav-open .sidebar { transform: none; }
  body.nav-mini .sidebar .nav-link span, body.nav-mini .sidebar .nav-section, body.nav-mini .sidebar-brand div { display: initial; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main, body.nav-mini .main { margin-left: 0; }
  .grid-2, .grid-3, .grid-4, .grid-main, .split-layout { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .auth-page { grid-template-columns: 1fr; } .auth-hero { display: none; }
  .user-chip .who { display: none; }
  .doc-parties { grid-template-columns: 1fr; } .doc-kpis { grid-template-columns: repeat(2, 1fr); }
  .table-wrap, .card-grid { max-height: none; }
  .toolbar .search { max-width: none; }
  .qv-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .content { padding: .75rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .kpi { padding: .55rem .6rem; } .kpi-icon { display: none; } .kpi .value { font-size: 1.1rem; }
  .doc { padding: 1rem; } .doc-head { flex-direction: column; } .doc-title { text-align: left; }
  .page-head .actions { width: 100%; }
  .toolbar select, .toolbar input[type=date] { flex: 1 1 130px; max-width: none; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .footer, .no-print, .page-head .actions, .toasts, .modal, .modal-backdrop { display: none !important; }
  .main { margin: 0 !important; } .content { padding: 0; max-width: none; } body { background: #fff; }
  .doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .card { box-shadow: none; } .table-wrap, .card-grid { max-height: none !important; overflow: visible !important; }
  .doc th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.topbar .menu-btn { display: none; }
@media (max-width: 900px) { .topbar .menu-btn { display: inline-flex; } .topbar .mini-btn { display: none; } }
.table:not([data-quickview=off]) tbody tr.qv { cursor: pointer; }
@media (max-width: 1100px) { .seg .seg-l { display: none; } }
/* element being captured to PDF */
.pdf-capture { box-shadow: none !important; border: 0 !important; border-radius: 0 !important; max-width: none !important; margin: 0 !important; }
.pdf-capture .no-print { display: none !important; }
.card-head { min-height: 46px; }
.kpi .label, .kpi .hint { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kpi .label { -webkit-line-clamp: 1; }
.pdf-capture.doc-promo { min-height: 1090px; display: flex; flex-direction: column; justify-content: center; padding: 3rem 2.5rem !important; }

/* ---------- Logo on documents: no gold ring, slightly larger ---------- */
.doc-brand img { width: 92px; height: 92px; border: 0; border-radius: 0; object-fit: contain; flex-shrink: 0; }

/* ---------- Digital seal (stamp) ---------- */
.doc-close { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: -.4rem; }
.doc-close .totals { margin-left: auto; }
.doc-seal { display: flex; align-items: center; gap: .9rem; color: var(--seal, #b5122b); position: relative; margin-top: -1.6rem; }
.doc-seal .seal-ring { width: 158px; height: 158px; transform: rotate(-9deg); mix-blend-mode: multiply; opacity: .93; flex-shrink: 0;
  filter: drop-shadow(0 0 .4px currentColor); }
.doc-seal .seal-info { display: flex; align-items: center; gap: .55rem; border: 1.5px dashed currentColor; border-radius: 8px; padding: .4rem .55rem; background: rgba(255,255,255,.75); }
.doc-seal .seal-qr { width: 70px; height: 70px; flex-shrink: 0; background: #fff; }
.doc-seal .seal-qr svg { width: 100%; height: 100%; display: block; }
.doc-seal .seal-qr svg path { fill: #111; }
.doc-seal .seal-text { display: flex; flex-direction: column; font-size: .68rem; line-height: 1.35; color: #333; max-width: 170px; }
.doc-seal .seal-text b { color: var(--seal, #b5122b); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 600px) { .doc-seal { margin-top: 0; } .doc-seal .seal-ring { width: 120px; height: 120px; } }

/* ---------- Full-height tool pages: no outer scrolling, the tool fills the screen ---------- */
body.tool-page { overflow: hidden; }
body.tool-page .content { padding: 0; max-width: none; }
body.tool-page .footer { display: none; }
body.tool-page .tool-frame { height: calc(100vh - var(--topbar-h)); min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
body.tool-page .breadcrumb .small { overflow: hidden; text-overflow: ellipsis; }

/* ---------- Letters ---------- */
.letter-to { margin: .2rem 0 1.1rem; line-height: 1.5; }
.letter-subject { font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; text-decoration: underline; margin: .9rem 0 .8rem; color: var(--ink); }
.letter-body p { margin: 0 0 .75rem; text-align: justify; white-space: pre-wrap; }
.letter-sign { margin-top: 1.2rem; }
.letter-sign .line { width: 200px; border-bottom: 1px solid #555; height: 2.2rem; }
.letter-steps .step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--gold-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; margin-right: .45rem; }
.letter-layout { display: grid; grid-template-columns: minmax(340px, 430px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.letter-layout .preview-pane { position: sticky; top: calc(var(--topbar-h) + .75rem); max-height: calc(100vh - var(--topbar-h) - 1.5rem); overflow: auto; border-radius: var(--radius-lg); }
.letter-layout .preview-pane .doc { box-shadow: var(--shadow-sm); }
.tpl-list { max-height: 230px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.tpl-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); padding: .45rem .65rem; cursor: pointer; font: inherit; }
.tpl-list button:hover { background: var(--surface-2); }
.tpl-list button.active { background: var(--gold-pale); box-shadow: inset 3px 0 0 var(--gold); }
.tpl-list button b { display: block; font-size: .84rem; } .tpl-list button small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .letter-layout { grid-template-columns: 1fr; } .letter-layout .preview-pane { position: static; max-height: none; } }

/* ---------- Sidebar search ---------- */
.nav-search { position: relative; padding: .6rem .7rem .3rem; }
.nav-search i { position: absolute; left: 1.35rem; top: 50%; transform: translateY(-35%); color: #8d91ab; font-size: .85rem; pointer-events: none; }
.nav-search input { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); color: #fff; height: 32px; padding-left: 2rem; font-size: .84rem; }
.nav-search input::placeholder { color: #8d91ab; }
.nav-search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,.18); background: rgba(255,255,255,.1); }
.nav-results { overflow-y: auto; flex: 1; padding: .2rem 0 .8rem; }
.nav-results .nav-link { flex-wrap: wrap; row-gap: 0; }
.nav-results .nav-link small { flex-basis: 100%; padding-left: 1.8rem; color: #8d91ab; font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-results .nav-link.sel { background: rgba(201,168,76,.22); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-results mark { background: none; color: var(--gold-2); font-weight: 700; }
.nav-results .none { color: #8d91ab; padding: .8rem 1rem; font-size: .84rem; }
body.nav-mini .nav-search input { display: none; }
body.nav-mini .nav-search { padding: .6rem 0 .2rem; text-align: center; cursor: pointer; }
body.nav-mini .nav-search i { position: static; transform: none; font-size: 1.05rem; color: #a9adc5; }
@media (max-width: 1100px) and (min-width: 901px) {
  body:not(.nav-full) .nav-search input { display: none; }
  body:not(.nav-full) .nav-search { text-align: center; } body:not(.nav-full) .nav-search i { position: static; transform: none; }
}
.topbar-bell { position: relative; }
.bell-badge { position: absolute; top: 1px; right: 0; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

/* ---------- Searchable select ---------- */
.ss-wrap { position: relative; min-width: 0; }
.toolbar .ss-wrap { min-width: 160px; max-width: 240px; }
.ss-native { position: absolute !important; opacity: 0 !important; pointer-events: none !important; height: 0 !important; width: 0 !important; }
.ss-input { padding-right: 1.8rem !important; cursor: text;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%237d7f8c' stroke-width='2' d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right .55rem center / 12px !important; }
.ss-list { left: 0; right: 0; min-width: 220px; max-height: 280px; overflow-y: auto; z-index: 1080; }
.ss-list button { padding: .4rem .6rem; font-size: .86rem; }
.ss-list button.sel { background: var(--gold-pale); }

/* ---------- Receipt book (formal, same letterhead and stamp as letters) ---------- */
.rb-page { padding: 1.4rem 1.8rem; }
.rb-slip { position: relative; }
.rb-page.per-2 .rb-slip { min-height: 488px; }
.rb-page.per-2 .rb-slip + .rb-slip { border-top: 2px dashed #bbb; margin-top: 1rem; padding-top: 1.2rem; }
.rb-page.per-1 .rb-slip { min-height: 1060px; }
.rb-slip .doc-head { padding-bottom: .7rem; margin-bottom: .8rem; }
.rb-page.per-2 .doc-brand img { width: 70px; height: 70px; }
.rb-page.per-2 .doc-brand h2 { font-size: 1.2rem; }
.rb-page.per-2 .doc-title h1 { font-size: 1.35rem; }
.rb-lines { display: grid; gap: .65rem; margin: .4rem 0 .9rem; }
.rb-line { display: flex; align-items: flex-end; gap: .6rem; font-size: .88rem; }
.rb-line span { white-space: nowrap; font-weight: 600; color: var(--ink); min-width: 0; }
.rb-line i { flex: 1; border-bottom: 1px solid #777; height: 1.25rem; }
.rb-bottom { display: flex; gap: 1rem; align-items: flex-end; justify-content: space-between; }
.rb-left { flex: 1; display: grid; gap: .7rem; }
.rb-amount { display: flex; align-items: center; gap: .5rem; border: 2px solid var(--ink); border-radius: 8px; padding: .45rem .7rem; max-width: 280px; }
.rb-amount span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #666; }
.rb-amount b { font-size: 1.2rem; color: var(--ink); }
.rb-amount i { flex: 1; border-bottom: 1px solid #777; height: 1.2rem; }
.rb-methods { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .82rem; align-items: center; }
.rb-methods span { font-weight: 600; }
.rb-methods label { display: inline-flex; gap: .3rem; align-items: center; }
.rb-box { width: 13px; height: 13px; border: 1.5px solid #555; border-radius: 2px; display: inline-block; }
.rb-sign { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.rb-seal .doc-seal { margin-top: 0; flex-direction: column; align-items: center; gap: .35rem; }
.rb-seal .doc-seal .seal-ring { width: 140px; height: 140px; }
.rb-seal .doc-seal .seal-info { padding: .3rem .4rem; }
.rb-seal .doc-seal .seal-qr { width: 54px; height: 54px; }
.rb-seal .doc-seal .seal-text { font-size: .6rem; max-width: 120px; }
.nav-results .nav-link > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Client files ---------- */
.cf-drop { display: flex; align-items: center; gap: .8rem; border: 2px dashed var(--border-strong); border-radius: 10px; padding: .8rem 1rem; background: var(--surface-2); transition: border-color .15s, background .15s; }
.cf-drop.over { border-color: var(--gold); background: var(--gold-pale); }
.cf-drop.busy { opacity: .6; pointer-events: none; }

/* PDFs always use the desktop A4 layout, even when generated on a phone */
.pdf-capture .doc-head { flex-direction: row !important; }
.pdf-capture .doc-title { text-align: right !important; }
.pdf-capture .doc-parties { grid-template-columns: 1fr 1fr !important; }
.pdf-capture .doc-kpis { grid-template-columns: repeat(4, 1fr) !important; }
.pdf-capture .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.pdf-capture.doc, .pdf-capture .doc { padding: 2.2rem !important; }
.pdf-capture.rb-page { padding: 1.4rem 1.8rem !important; }
.pdf-capture .doc-seal { margin-top: -1.6rem !important; }
.pdf-capture .doc-seal .seal-ring { width: 158px !important; height: 158px !important; }
.pdf-capture .rb-seal .doc-seal { margin-top: 0 !important; }
.pdf-capture .rb-seal .doc-seal .seal-ring { width: 140px !important; height: 140px !important; }

/* ------------------------------------------------------------------ client portal: personal appearance */
.clip { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-link { display: block; text-decoration: none !important; color: inherit; }
.prewrap { white-space: pre-wrap; }
html.font-small { font-size: 13px; } html.font-large { font-size: 15.5px; }
body.density-compact .content { padding-top: .8rem; } body.density-compact .card-body { padding: .7rem .8rem; }
body.density-compact .table td, body.density-compact .table th { padding-top: .35rem; padding-bottom: .35rem; } body.density-compact .kpis { gap: .5rem; }
.accent-dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; vertical-align: -4px; border: 2px solid rgba(0,0,0,.12); }
.accent-dot.accent-gold, body.accent-gold { --accent: #c9a84c; --accent-2: #e8c96e; }
.accent-dot.accent-blue, body.accent-blue { --accent: #2563eb; --accent-2: #60a5fa; }
.accent-dot.accent-green, body.accent-green { --accent: #15803d; --accent-2: #4ade80; }
.accent-dot.accent-purple, body.accent-purple { --accent: #7c3aed; --accent-2: #a78bfa; }
.accent-dot.accent-red, body.accent-red { --accent: #b91c1c; --accent-2: #f87171; }
.accent-dot.accent-teal, body.accent-teal { --accent: #0f766e; --accent-2: #2dd4bf; }
.accent-dot { background: var(--accent); }
body.portal { --gold: var(--accent); --gold-2: var(--accent-2); }
body.portal:not(.accent-gold) .btn-gold { color: #fff; } body.portal:not(.accent-gold) .btn-gold:hover { color: #fff; }
body.portal .doc { --gold: #c9a84c; --gold-2: #e8c96e; }      /* printed documents keep the company colours */
body.theme-dark {
  --bg: #12131c; --surface: #1c1e2b; --surface-2: #242737; --border: #31354a; --border-strong: #454a63;
  --text: #e4e6f0; --text-2: #b9bdd0; --muted: #8b90a8; --ink-3: #9fb0e0;
  --success-bg: #173226; --success: #6fd3a0; --warning-bg: #3a2c12; --warning: #f0c060;
  --danger-bg: #3c1a20; --danger: #f28b9b; --info-bg: #182945; --info: #8fb6ff; --gold-pale: #2f2a1a;
  color-scheme: dark;
}
body.theme-dark h1, body.theme-dark h2, body.theme-dark h3, body.theme-dark h4, body.theme-dark legend,
body.theme-dark .kpi .value, body.theme-dark .table .primary-text, body.theme-dark .item-card .ic-title,
body.theme-dark .breadcrumb .current, body.theme-dark .user-chip b { color: #f3f4fa; }
body.theme-dark .topbar { background: var(--surface); border-color: var(--border); }
body.theme-dark .kpi-icon { background: var(--surface-2) !important; color: var(--accent-2) !important; }
body.theme-dark .btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
body.theme-dark .btn-outline:hover, body.theme-dark .btn-ghost:hover { background: var(--surface-2); color: #fff; }
body.theme-dark input, body.theme-dark select, body.theme-dark textarea { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
body.theme-dark a { color: #9fb6ff; } body.theme-dark .dropdown, body.theme-dark .modal-content { background: var(--surface); color: var(--text); }
body.theme-dark .doc { --surface: #fff; --surface-2: #faf9f6; --border: #e6e0d3; --text: #1f2333; --text-2: #4b5165; --muted: #7d7f8c; color-scheme: light; }
body.theme-dark .doc :is(h1, h2, h3, h4) { color: #1a1a2e; } body.theme-dark .doc a { color: #3d4f7c; }
body.theme-dark .doc-parties h4, body.theme-dark .doc h3.doc-section { color: var(--gold); } body.theme-dark .doc-promo h2 { color: #fff; }
@media print { body.theme-dark { --bg: #fff; background: #fff; } }

/* ------------------------------------------------------------------ public pages (project request form) */
.public-page { background: var(--bg); }
.public-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1.4rem; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.public-head .brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.public-head .brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); }
.public-head .brand b { display: block; font-family: var(--font-display); font-size: 1.1rem; }
.public-head .brand span { color: var(--gold-2); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; }
.public-head .btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.public-main { max-width: 1040px; margin: 0 auto; padding: 1.4rem 1rem 3rem; }
.step { display: inline-flex; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--gold); color: var(--ink); align-items: center; justify-content: center; font-size: .82rem; margin-right: .35rem; }
.choice-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.choice { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.choice:hover { border-color: var(--ink-3); } .choice:has(input:checked) { border-color: var(--gold); background: var(--gold-pale); }
.choice input { margin-top: .2rem; width: 1rem; height: 1rem; accent-color: var(--ink); }
.choice small { display: block; color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.field.invalid input, .field.invalid textarea, .card.invalid { border-color: var(--danger) !important; }
.auth-request { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); text-align: center; }
.auth-request .btn { width: 100%; }

/* ------------------------------------------------------------------ "How your project will be done" + working terms */
.how-we-work h3 { font-size: .95rem; margin-bottom: .5rem; }
.hw-tile { display: flex; gap: .7rem; padding: .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.hw-tile i { font-size: 1.4rem; color: var(--gold); } .hw-tile span { display: block; color: var(--text-2); font-size: .85rem; margin-top: .15rem; }
.hw-steps { margin: 0; padding-left: 1.3rem; display: grid; gap: .55rem; } .hw-steps li { padding-left: .2rem; } .hw-steps li::marker { font-weight: 700; color: var(--gold); }
.hw-contact .details { margin: 0; }
.terms-list { list-style: none; margin: 0; display: grid; gap: .6rem; }
.terms-list li { display: flex; gap: .6rem; align-items: flex-start; font-size: .88rem; } .terms-list i { color: var(--gold); font-size: 1.05rem; margin-top: .05rem; }
.hero-how { margin: 1rem 0 .4rem; }
.auth-request .how-link { margin-top: .4rem; width: 100%; }

.type-part { border: 0; padding: 0; margin: 0; min-width: 0; }
.type-part[hidden], #afterType[hidden] { display: none !important; }
.type-choice .choice b i { color: var(--gold); margin-right: .25rem; }
.type-choice .choice { padding: 1rem; }
.login-help { margin-top: 1rem; padding: .75rem .85rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); font-size: .82rem; }
.login-help b.mono { background: var(--gold-pale); padding: 0 .3rem; border-radius: 4px; }
.login-help ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.req-steps { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .35rem; }
.req-steps span { font-size: .7rem; padding: .1rem .45rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.req-steps span.done { background: var(--success-bg); color: var(--success); border-color: transparent; }
.req-steps span.now { background: var(--gold); color: var(--ink); border-color: transparent; font-weight: 600; }

/* sign-in page on phones: the brand panel is hidden, so show a compact brand header above the form */
.auth-mobile-brand { display: none; }
@media (max-width: 900px) {
  .auth-panel { align-items: flex-start; padding: 0 1rem 2rem; }
  .auth-mobile-brand { display: flex; align-items: center; gap: .7rem; margin: 0 -1rem 1.4rem; padding: 1rem 1.1rem;
    background: linear-gradient(135deg, var(--ink), var(--ink-2)); color: #fff; }
  .auth-mobile-brand img { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; flex-shrink: 0; }
  .auth-mobile-brand b { display: block; font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .02em; text-transform: uppercase; }
  .auth-mobile-brand span { color: var(--gold-2); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; }
  .auth-card { width: 100%; max-width: 440px; }
}

/* what a quotation / invoice is for, printed on the document */
.doc-subject { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .7rem; margin: 0 0 1rem; padding: .6rem .8rem;
  border-left: 4px solid var(--gold); background: #faf6ea; border-radius: 0 6px 6px 0; }
.doc-subject span { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #8a6d1f; font-weight: 700; }
.doc-subject b { font-size: 1rem; color: #1a1a2e; }
.doc-subject small { color: #555; }
.sub-text.subject { color: var(--text-2); }

/* referral claims: tall enough to work in, and room for the client search dropdown */
.claims-wrap { min-height: 520px; max-height: none; }
.claims-wrap td { vertical-align: top; padding-top: .75rem; padding-bottom: .75rem; }
.claims-wrap .claim-search { width: 100%; }
@media (max-width: 900px) { .claims-wrap { min-height: 420px; } }

.earn-rules ol { margin: 0; padding-left: 2rem; display: grid; gap: .5rem; font-size: .87rem; }
.earn-rules li::marker { font-weight: 700; color: var(--gold); }
