/* =====================================================================
   Egytas — App stylesheet (palette from the Power App)
   ===================================================================== */
:root {
  --navy:        #1E3A6E;
  --navy-deep:   #00126B;
  --navy-line:   #34518A;
  --primary:     #3860B2;
  --primary-hov: #2C4F96;
  --blue-50:     #EFF6FF;
  --blue-100:    #E8F0FE;
  --blue-200:    #DBEAFE;
  --blue-300:    #BACAE2;
  --bg:          #F3F4F6;
  --surface:     #FFFFFF;
  --surface-2:   #F9FAFB;
  --line:        #E5E7EB;
  --line-strong: #D1D5DB;
  --text:        #111827;
  --text-2:      #374151;
  --muted:       #6B7280;
  --ok-bg:   #D1FAE5; --ok:   #065F46;
  --wait-bg: #FEF3C7; --wait: #92400E;
  --no-bg:   #FEE2E2; --no:   #991B1B;
  --draft-bg:#F3F4F6; --draft:#374151;
  --radius:    16px;
  --radius-sm: 10px;
  --sidebar-w: 260px;
  --font: 'IBM Plex Sans', 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); }
a:hover { color: var(--navy); }
h1, h2 { margin: 0; line-height: 1.25; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
code { font-family: var(--mono); font-size: 13px; background: var(--blue-100); padding: 1px 6px; border-radius: 6px; }
:focus-visible { outline: 3px solid #93C5FD; outline-offset: 2px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.strong { font-weight: 600; }
.num { text-align: right; }
.link { color: var(--primary); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: #fff; padding: 8px 12px; border-radius: 8px; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hov); color: #fff; }
.btn-lg { min-height: 52px; font-size: 16px; font-weight: 700; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: #BACAE2; font: inherit; cursor: pointer; text-decoration: underline; min-height: 44px; }
.icon-btn { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--blue-100); color: var(--navy); }
.icon-btn-dark { color: var(--blue-300); }
.icon-btn-dark:hover { background: rgba(255,255,255,.08); color: #fff; }
.icon-btn-amber { color: var(--wait); }
.icon-btn-amber:hover { background: #FDE68A; color: var(--wait); }

.form { display: flex; flex-direction: column; gap: 20px; }
.form-head { display: flex; flex-direction: column; gap: 6px; }
.form-head h1 { font-size: 24px; }
.form-head p { margin: 0; color: var(--muted); font-size: 14px; }
.form-note { margin: 0; text-align: center; color: var(--muted); font-size: 13px; }
.form-foot { display: flex; justify-content: center; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); }
.input { width: 100%; height: 50px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px; }
select.input { padding-right: 10px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(56,96,178,.18); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 52px; }
.input-group .icon-btn { position: absolute; right: 3px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.alert svg { flex: none; margin-top: 1px; }
.alert-error   { background: var(--no-bg); color: var(--no); }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-info    { background: var(--blue-200); color: var(--navy); }

/* ---------- Auth (login / setup) ---------- */
body.auth { background: var(--navy); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: max(40px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom)); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.auth-brand-name { font-size: 26px; font-weight: 700; color: #fff; }
.auth-brand-sub { font-size: 14px; color: var(--blue-300); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 20px; padding: 36px; }
body.auth .auth-card:has(.grid-3) { max-width: 560px; }
.auth-foot { font-size: 12px; color: var(--blue-300); }

.logo { width: 40px; height: 40px; flex: none; border-radius: 10px; background: #fff; color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; }
.logo-lg { width: 60px; height: 60px; border-radius: 16px; font-size: 30px; }
.logo-sm { width: 32px; height: 32px; border-radius: 9px; font-size: 16px; }

/* ---------- App shell ---------- */
body.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--navy); color: var(--blue-100); display: flex; flex-direction: column;
  gap: 24px; padding: 24px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-name { font-weight: 700; font-size: 18px; color: #fff; }
.brand-sub { font-size: 12px; color: var(--blue-300); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: .8px; color: #93A9D1; padding: 16px 12px 6px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 12px;
  border-radius: 10px; color: var(--blue-200); text-decoration: none; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.is-active { background: var(--primary); color: #fff; font-weight: 600; }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #fff; color: var(--navy);
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-user { margin-top: auto; border-top: 1px solid var(--navy-line); padding: 16px 4px 0; display: flex; flex-direction: column; gap: 12px; }
.user-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.user-actions form { margin: 0; display: flex; }
.side-btn { flex: 1; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px;
  border: 1px solid var(--navy-line); border-radius: 10px; background: transparent; color: var(--blue-200);
  font: inherit; font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; }
.side-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.user-meta { flex: 1; min-width: 0; }
.user-name { color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sub { font-size: 12px; color: var(--blue-300); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.avatar-sm { width: 36px; height: 36px; font-size: 13px; }

.main { flex: 1; min-width: 0; }
.page { max-width: 1180px; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 30px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-narrow { max-width: 480px; padding: 32px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.section { display: flex; flex-direction: column; gap: 14px; }
.section-card { display: flex; flex-direction: column; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }

.announce { display: flex; align-items: flex-start; gap: 14px; padding: 8px 8px 8px 20px; background: #FFFBEB;
  border: 1px solid #FCD34D; border-radius: 14px; color: var(--wait); }
.announce > svg { margin-top: 12px; flex: none; }
.announce-text { flex: 1; padding: 10px 0; font-size: 14px; }
.announce form { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 32px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.tone-amber { color: var(--wait); } .tone-blue { color: var(--primary); }
.tone-green { color: var(--ok); }   .tone-red  { color: var(--no); }

.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.tile { padding: 18px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); min-width: 0; }
a.tile:hover { border-color: var(--primary); color: var(--text); }
.tile.is-disabled { opacity: .55; }
.tile-code { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.tile-blue   { background: var(--blue-100); color: var(--primary); }
.tile-amber  { background: var(--wait-bg);  color: var(--wait); }
.tile-indigo { background: var(--blue-200); color: #1D4ED8; }
.tile-purple { background: #EDE9FE;         color: #5B21B6; }
.tile-green  { background: var(--ok-bg);    color: var(--ok); }
.tile-name { font-weight: 600; font-size: 15px; }
.tile-sub { font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
.table th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; padding: 12px; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child,  .table td:last-child  { padding-right: 20px; }
.table th.num { text-align: right; }
.table td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 14px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-wait { background: var(--wait-bg); color: var(--wait); }
.chip-no { background: var(--no-bg); color: var(--no); }
.chip-draft { background: var(--draft-bg); color: var(--draft); }
.progress-cell { display: flex; align-items: center; gap: 8px; }
.progress { -webkit-appearance: none; appearance: none; width: 90px; height: 6px; border: 0; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress::-webkit-progress-bar { background: var(--line); border-radius: 3px; }
.progress::-webkit-progress-value { background: var(--primary); border-radius: 3px; }
.progress::-moz-progress-bar { background: var(--primary); border-radius: 3px; }
.progress-label { font-size: 12px; color: var(--muted); }

/* ---------- Mobile ---------- */
.topbar-mobile, .nav-overlay, .only-mobile { display: none; }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  body.app { display: block; }
  .topbar-mobile { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 30; background: var(--navy); color: #fff;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px; }
  .topbar-mobile .icon-btn { color: #fff; }
  .brand-sm { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; z-index: 50; transform: translateX(-100%);
    transition: transform .2s ease; width: min(300px, 86vw); padding-top: max(24px, env(safe-area-inset-top)); }
  .only-mobile { display: inline-flex; margin-left: auto; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 40; }
  .page { padding: 20px 16px max(32px, env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 24px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-narrow { padding: 24px; }
}

@media (max-width: 520px) {
  .auth-card { padding: 24px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-value { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* =====================================================================
   Users & permissions
   ===================================================================== */
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.center { text-align: center !important; }
.page-wide { max-width: 1320px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.crumbs a { font-weight: 600; text-decoration: none; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.title-with-avatar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.title-with-avatar h1 { font-size: 26px; }

.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 36px; padding: 0; color: var(--muted); }
.btn-soft-green { background: #ECFDF5; border-color: #6EE7B7; color: var(--ok); }
.btn-soft-red { background: #FEF2F2; border-color: #FCA5A5; color: var(--no); }
.input-sm { height: 44px; font-size: 14px; border-radius: 10px; }
select.input-sm { width: auto; min-width: 160px; }
.input-static { display: flex; align-items: center; background: var(--surface-2); }
select[size] { height: auto; padding: 6px; }
select[size] option { padding: 8px 10px; border-radius: 6px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.search { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; font-size: 14px; color: var(--text); }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(56,96,178,.18); }

.user-cell { display: flex; align-items: center; gap: 12px; }
.avatar-soft { background: var(--blue-100); color: var(--navy); }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; font-weight: 700; }
.chip-admin { background: var(--blue-100); color: var(--navy); }
.chip-user { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions form { margin: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager-btns { display: flex; gap: 6px; }

.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin-top: 24px; }
.split-side { flex: 1 1 320px; max-width: 380px; }
.split-main { flex: 999 1 560px; min-width: 0; }
.card-pad { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.card-pad h2 { font-size: 17px; }
.card-head-wrap { flex-wrap: wrap; align-items: flex-start; }
.card-head-wrap h2 { font-size: 17px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; }
.switch { -webkit-appearance: none; appearance: none; flex: none; width: 48px; height: 28px; border-radius: 14px;
  background: var(--line-strong); position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch:checked { background: var(--primary); }
.switch:checked::after { left: 23px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }

.divider { height: 1px; background: var(--line); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.temp-pw { border-radius: 12px; background: var(--wait-bg); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.temp-pw-label { font-size: 12px; font-weight: 600; color: var(--wait); }
.temp-pw-value { font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: 1px; user-select: all; }
.temp-pw-note { font-size: 12px; color: var(--wait); }

.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.perm-table { min-width: 640px; }
.perm-table td, .perm-table th { padding-top: 10px; padding-bottom: 10px; }
.perm-table th.center { width: 76px; }
.group-row td { padding: 14px 20px 6px !important; font-size: 11px; font-weight: 600; letter-spacing: .8px; color: var(--muted); background: var(--surface); }
.check { width: 22px; height: 22px; accent-color: var(--primary); cursor: pointer; margin: 0; vertical-align: middle; }
.check:disabled { cursor: not-allowed; }

@media (max-width: 900px) {
  .split-side { max-width: none; }
  select.input-sm { flex: 1 1 140px; }
}

/* =====================================================================
   Documents (Expenses)
   ===================================================================== */
.stack { display: flex; flex-direction: column; gap: 24px; }
.textarea { height: auto; min-height: 64px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.doc-no { font-family: var(--mono); font-weight: 600; font-size: 15px; color: var(--primary); background: var(--blue-100);
  height: 32px; padding: 0 12px; border-radius: 8px; display: inline-flex; align-items: center; }
.btn-dashed { border-style: dashed; border-color: var(--primary); background: var(--blue-50); color: var(--primary); }
.btn-danger-ghost { color: var(--no); border-color: #FCA5A5; background: #fff; }
.btn-danger-ghost:hover { background: var(--no-bg); color: var(--no); }
.btn-icon-red:hover { color: var(--no); border-color: #FCA5A5; }
.btn-files { gap: 4px; color: var(--muted); }
.btn-files.has-files { color: var(--primary); border-color: var(--primary); background: var(--blue-50); }

.lines-table { min-width: 1560px; font-size: 13px; }
.lines-table td { padding: 8px 6px; vertical-align: middle; }
.lines-table th { padding: 10px 6px; }
.lines-table th:first-child, .lines-table td:first-child { padding-left: 16px; }
.w-num { width: 36px; } .w-type { width: 110px; } .w-gl { width: 230px; } .w-prj { width: 170px; }
.w-goto { width: 90px; } .w-dept { width: 150px; } .w-cc { width: 200px; } .w-desc { width: 220px; }
.w-amt { width: 120px; } .w-vat { width: 76px; } .w-files { width: 70px; } .w-act { width: 90px; }
.cell { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--text); font: inherit; font-size: 13px; }
.cell:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(56,96,178,.18); }
.cell:disabled { background: var(--surface-2); color: var(--muted); }
select.cell { padding-right: 4px; }
input.cell.num { text-align: right; font-family: var(--mono); }
.chip-goto { height: 24px; padding: 0 8px; font-size: 11px; background: var(--blue-200); color: #1D4ED8; }
.chip-type { height: 24px; padding: 0 8px; font-size: 11px; background: var(--blue-100); color: var(--navy); }
.chip-xs { height: 22px; padding: 0 8px; font-size: 11px; margin-left: 4px; }
.files-row td { background: var(--surface-2); padding: 0 !important; border-top: 0; }
.files-box { padding: 12px 16px 14px 52px; display: flex; flex-direction: column; gap: 8px; }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.file-remove { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--no); font-size: 12px; cursor: pointer; }
.file-input { font: inherit; font-size: 13px; }

.totals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 28px; padding: 18px 22px;
  border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.totals > div { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.totals span { font-size: 12px; color: var(--muted); }
.totals strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.totals .grand strong { font-size: 24px; color: var(--primary); }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.step { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.step:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--line-strong); }
.step-dot { width: 28px; height: 28px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: #fff; color: var(--muted); border: 2px solid var(--line-strong); }
.step-pending .step-dot { background: var(--wait-bg); color: var(--wait); border-color: #FCD34D; }
.step-approved .step-dot { background: var(--ok); color: #fff; border-color: var(--ok); }
.step-rejected .step-dot { background: var(--no); color: #fff; border-color: var(--no); }
.step-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-title { font-size: 14px; font-weight: 600; }
.step-cond { color: #9CA3AF; }
.step-comment { margin-top: 4px; font-size: 13px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.note { border-radius: 12px; background: var(--blue-50); color: var(--navy); padding: 12px 14px; font-size: 13px; }

.kv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kv-grid > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kv-grid span { font-size: 12px; color: var(--muted); }
.kv-grid strong { font-size: 14px; font-weight: 600; }
.pre { white-space: pre-wrap; font-weight: 500 !important; }
.table a.doc-link { font-family: var(--mono); font-weight: 600; text-decoration: none; }

@media (max-width: 900px) {
  .kv-grid { grid-template-columns: 1fr 1fr; }
}
.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .kpis-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Searchable select ---------- */
.ss { position: relative; width: 100%; }
.ss-native { position: absolute !important; opacity: 0; pointer-events: none; width: 1px !important; height: 1px !important; left: 0; bottom: 0; }
.ss-btn { width: 100%; height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px 0 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; color: var(--text);
  font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.ss-cell .ss-btn { height: 40px; padding: 0 8px 0 10px; border-radius: 8px; font-size: 13px; }
.ss-btn:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(56,96,178,.18); }
.ss-btn.is-empty .ss-text { color: var(--muted); }
.ss-btn:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.ss-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-chev { flex: none; color: var(--muted); }
.ss-panel { position: fixed; z-index: 80; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(17,24,39,.16); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.ss-search { height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 14px; }
.ss-search:focus { outline: none; border-color: var(--primary); }
.ss-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
.ss-item { padding: 9px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.ss-item:hover, .ss-item.is-active { background: var(--blue-100); }
.ss-item.is-selected { font-weight: 600; color: var(--primary); }
.ss-empty { padding: 12px 10px; color: var(--muted); font-size: 13px; }
.step-person { font-size: 14px; font-weight: 500; color: var(--text-2); }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.kv-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.w-veh { width: 150px; } .w-km { width: 100px; } .w-mt { width: 170px; }
.lines-table:has(.w-veh) { min-width: 2120px; }
@media (max-width: 1100px) { .grid-5, .kv-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .grid-5, .kv-5 { grid-template-columns: 1fr 1fr; } }

/* ---------- Approvals ---------- */
.btn-approve { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-approve:hover { background: #054d39; color: #fff; }
.btn-reject { background: #fff; border-color: #FCA5A5; color: var(--no); }
.btn-reject:hover { background: var(--no-bg); color: var(--no); }
.approve-box { border: 2px solid #FCD34D; background: #FFFBEB; }
.approve-box .input { background: #fff; }
.approve-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.w-comment { width: 220px; }
.empty-icon { color: var(--ok); margin-bottom: 8px; }
.pa-table { min-width: 1100px; }
.pa-table .row-actions { margin: 0; flex-wrap: nowrap; }

@media (max-width: 900px) {
  .pa-table { min-width: 0; }
  .pa-table thead { display: none; }
  .pa-table, .pa-table tbody, .pa-table tr, .pa-table td { display: block; width: 100%; }
  .pa-table tr { border-top: 1px solid var(--line); padding: 14px 16px; }
  .pa-table td { border: 0; padding: 4px 0 !important; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .pa-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .pa-table td[data-label="Document"] { display: block; text-align: left; }
  .pa-table td[data-label="Document"]::before, .pa-table td[data-label="Actions"]::before, .pa-table td[data-label="Comment"]::before { display: none; }
  .pa-table td[data-label="Comment"] .cell { height: 44px; }
  .pa-table td[data-label="Actions"] .row-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .pa-table td[data-label="Actions"] .btn { min-height: 44px; }
}

/* ---------- Purchasing ---------- */
.w-item { width: 240px; } .w-unit { width: 70px; } .w-qty { width: 80px; } .w-lock { width: 120px; }
.w-vend { width: 220px; } .w-note { width: 180px; } .w-loc { width: 140px; } .w-date { width: 150px; } .w-pm { width: 150px; } .w-pt { width: 210px; }
.lines-table:has(.w-item) { min-width: 2300px; }
.quote-table { min-width: 1750px; font-size: 13px; }
.quote-table td { padding: 8px 6px; }
.quote-table th:first-child, .quote-table td:first-child { padding-left: 16px; }
.lock-cell { height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); color: #9CA3AF; font-size: 12px; }
.lock-note { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 12px; }
.strike { text-decoration: line-through; font-size: 17px !important; }
.buyer-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 2px solid #FCD34D; background: #FFFBEB; border-radius: 14px; color: var(--wait); }
.buyer-banner strong { color: var(--text); font-size: 15px; }
.avatar-amber { background: var(--wait-bg); color: var(--wait); }
.approve-actions-wide { grid-template-columns: 2fr 1fr; }
.item-pick { position: relative; }
.item-pick .ss-btn { height: 40px; padding: 0 8px 0 10px; border-radius: 8px; font-size: 13px; }
.item-menu { position: fixed; z-index: 80; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(17,24,39,.16); padding: 8px; display: flex; flex-direction: column; gap: 6px; width: 340px; }

/* ---------- Document lists ---------- */
.doc-table { min-width: 1100px; }
.desc-cell { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-table .row-actions { margin: 0; flex-wrap: nowrap; }
@media (max-width: 900px) {
  .doc-table { min-width: 0; }
  .doc-table thead { display: none; }
  .doc-table, .doc-table tbody, .doc-table tr, .doc-table td { display: block; width: 100%; }
  .doc-table tr { border-top: 1px solid var(--line); padding: 14px 16px; }
  .doc-table td { border: 0; padding: 4px 0 !important; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .doc-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .doc-table td[data-label="Document"] { display: block; text-align: left; }
  .doc-table td[data-label="Document"]::before, .doc-table td[data-label="Actions"]::before { display: none; }
  .doc-table .desc-cell { max-width: none; white-space: normal; }
  .doc-table td[data-label="Actions"] .row-actions { width: 100%; justify-content: flex-start; }
  .doc-table td[data-label="Actions"] .btn { min-height: 44px; }
}

/* ---------- Reports ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 20px; align-items: flex-end; }
.filter { display: flex; flex-direction: column; gap: 6px; flex: 1 1 160px; }
.filter span { font-size: 12px; font-weight: 600; color: var(--muted); }
.filter select.input-sm { width: 100%; }
.kpi-money { font-size: 24px; }

/* ---------- Coding / masters ---------- */
.coding { display: flex; gap: 20px; align-items: flex-start; }
.coding-menu { width: 230px; flex: none; padding: 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.coding-link { display: flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: 14px; }
.coding-link:hover { background: var(--blue-50); color: var(--navy); }
.coding-link.is-active { background: var(--blue-100); color: var(--navy); font-weight: 600; }
.coding-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.coding-main { flex: 1; min-width: 0; }
.coding-title { margin: 0; font-size: 17px; margin-right: auto; }
.coding-search { flex: 0 1 320px; }
.coding-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.coding-head h2 { font-size: 18px; }
.coding-form { align-items: start; }
.coding-bool { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; min-height: 50px; align-self: end; }
.span-2 { grid-column: 1 / -1; }
.row-off td { color: var(--muted); }
.master .split-side { position: sticky; top: 16px; }
@media (max-width: 900px) {
  .coding { flex-direction: column; }
  .coding-menu { width: 100%; position: static; flex-direction: row; overflow-x: auto; }
  .coding-link { white-space: nowrap; }
  .coding-form { grid-template-columns: 1fr; }
}

/* ---------- View-mode line tables: one line per cell, scroll sideways ---------- */
.lines-view { width: max-content; min-width: 100%; font-size: 13px; }
.lines-view th, .lines-view td { white-space: nowrap; padding-left: 12px; padding-right: 12px; }
.lines-view td div { white-space: nowrap; }
.btn.is-off, .btn:disabled.is-off { opacity: .45; cursor: not-allowed; }

/* ---------- Two-step verification ---------- */
.code-input { font-size: 22px; letter-spacing: 4px; text-align: center; }
.mfa-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.mfa-grid { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.qr { width: 200px; height: 200px; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.stack-sm { flex: 1 1 280px; display: flex; flex-direction: column; gap: 10px; }
.secret-key { font-size: 16px; font-weight: 600; letter-spacing: 1px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 10px 12px; word-break: break-all; }
.codes-box { border: 2px solid #FCD34D; background: #FFFBEB; }
.codes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.codes span { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; font-size: 15px; font-weight: 600; user-select: all; }
.link-btn-dark { color: var(--muted); }
@media (max-width: 600px) { .codes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mfa-link { display: flex; align-items: center; gap: 14px; padding: 18px 22px; margin-top: 16px; text-decoration: none; color: var(--text); }
.mfa-link > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.mfa-link:hover { border-color: var(--primary); color: var(--text); }
.error-box { text-align: center; }
.error-box .form-head { align-items: center; }
.error-code { font-size: 64px; font-weight: 700; line-height: 1; color: var(--navy); font-variant-numeric: tabular-nums; }
.suspects { border: 2px solid #FCA5A5; }
.activity-details { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Brand ---------- */
.logo-img { width: 42px; height: 42px; border-radius: 10px; flex: none; background: #fff; object-fit: contain; }
.logo-img-sm { width: 34px; height: 34px; border-radius: 9px; }
.auth-logo { width: min(320px, 80vw); height: auto; display: block; }
.auth-brand { gap: 12px; }
