/* elavra — Purchase Order Dashboard. Brand: navy #153957, teal #087f8c, gold #e5ad45. */
:root {
  --navy: #153957; --navy-d: #0e2a43; --teal: #087f8c; --teal-l: #0b9aa5; --gold: #e5ad45;
  --green: #1f7a52; --amber: #b7811d; --red: #b8353f; --violet: #6a4cab; --blue: #2b5f9e;
  --ink: #17324b; --muted: #5d7488; --line: #dde7ef; --line-2: #edf2f6; --bg: #f2f6fa; --card: #fff;
  --radius: 16px; --shadow: 0 1px 2px rgba(21,57,87,.04), 0 8px 24px rgba(21,57,87,.06);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
code { background: #eef4f8; padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.ic { width: 18px; height: 18px; flex: none; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; line-height: 1.55; }
.hint.grow { flex: 1; min-width: 200px; margin: 0; }
.pre { white-space: pre-wrap; }
.err { color: var(--red); font-size: 12.5px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #d4e3ec; border-top-color: var(--teal); animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Login ---------------- */
.login-body { background: #f4f8fb; }
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.login-art { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background: radial-gradient(circle at 85% 12%, color-mix(in srgb, var(--lt-accent, #e5ad45) 22%, transparent), transparent 32%), radial-gradient(circle at 10% 90%, color-mix(in srgb, var(--lt-to, #0b7480) 55%, transparent), transparent 40%), linear-gradient(145deg, var(--lt-from, #12304a) 0%, var(--lt-via, #154a63) 55%, var(--lt-to, #0b7480) 100%); }
.login-art::after { content: ''; position: absolute; inset: auto -120px -160px auto; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255,255,255,.04); }
.art-top { display: flex; align-items: center; gap: 14px; }
.art-top .logo { width: 52px; height: 52px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); }
.art-top b { display: block; font-size: 26px; letter-spacing: .5px; }
.art-top small { color: #a9d3dc; font-size: 13px; }
.art-mid h1 { font-size: clamp(28px, 3.2vw, 42px); line-height: 1.15; letter-spacing: -1px; margin: 0 0 14px; max-width: 560px; }
.art-mid > p { color: #cfe6ec; font-size: 16px; margin: 0 0 30px; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 520px; position: relative; z-index: 1; }
.feature-list li { display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 12px 16px; color: #e3f1f4; }
.feature-list .ic { width: 22px; height: 22px; color: var(--lt-accent, var(--gold)); }
.art-foot { color: #a9d3dc; font-size: 13px; position: relative; z-index: 1; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: min(420px, 100%); display: grid; gap: 16px; }
.login-card h2 { margin: 0; font-size: 28px; color: var(--navy); letter-spacing: -.5px; }
.login-card > p { margin: -6px 0 4px; }
.login-mobile-brand { display: none; align-items: center; gap: 10px; font-size: 22px; color: var(--navy); }
.login-mobile-brand .logo { width: 40px; height: 40px; }
.login-error { background: #fdecee; border: 1px solid #f2c4c9; color: #8d2532; border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 13.5px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; }
.pw-toggle:hover { color: var(--teal); background: #eef6f8; }
.btn-block { width: 100%; padding: 12px 16px; font-size: 15px; }
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.role-chips span { font-size: 11.5px; color: #4f6a80; background: #e8f0f6; border-radius: 20px; padding: 3px 10px; }
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-mobile-brand { display: flex; }
  .login-panel { min-height: 100vh; background: linear-gradient(180deg, #e7f2f5, #f4f8fb 40%); }
}

/* ---------------- Shell ---------------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; padding: 20px 14px; display: flex; flex-direction: column; color: #d9eaf0;
  background: radial-gradient(circle at 0 100%, rgba(11,154,165,.28), transparent 45%), linear-gradient(185deg, #153957 0%, #11405c 60%, #0d4f5e 100%); }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 6px; }
.brand .logo { width: 42px; height: 42px; }
.brand b { display: block; font-size: 21px; letter-spacing: .4px; color: #fff; }
.brand small { color: #9fc6d1; font-size: 11.5px; }
.nav-group { font-size: 10.5px; letter-spacing: 1.3px; text-transform: uppercase; color: #7fa9b8; padding: 16px 12px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: #cfe3ea; text-decoration: none; font-weight: 600; margin: 2px 0; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(229,173,69,.24), rgba(255,255,255,.06)); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav a.active .ic { color: var(--gold); }
.side-foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 11.5px; color: #8fb4c2; display: grid; gap: 8px; line-height: 1.5; }
.side-foot .org { color: #c4dde5; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.greet b { display: block; font-size: 15px; color: var(--navy); }
.greet small { color: var(--muted); }
.spacer { flex: 1; }
.user-chip { position: relative; display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border: 1px solid var(--line); border-radius: 40px; background: #fff; cursor: pointer; }
.user-chip:hover { border-color: #b9cfdd; }
.uname { font-weight: 650; font-size: 13.5px; line-height: 1.2; }
.uname small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--navy)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(21,57,87,.16); min-width: 220px; padding: 6px; display: none; z-index: 50; }
.menu-pop.open { display: grid; gap: 2px; }
.menu-pop .btn { justify-content: flex-start; border: 0; background: none; box-shadow: none; width: 100%; }
.menu-pop .btn:hover { background: #f0f6fa; }
.role-pill { font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 20px; white-space: nowrap; }
.role-admin { background: #ece6f8; color: #553a8f; }
.role-ceo { background: #fbefd5; color: #835911; }
.role-purchase { background: #def1f3; color: #066670; }
.role-accounts { background: #e1f3e9; color: #1d6644; }
.role-delivery { background: #e4ecf9; color: #2a5591; }
.role-developer { background: #1f2937; color: #f5d27a; }
.content { padding: 26px 28px 60px; width: 100%; max-width: 1480px; margin: 0 auto; }
.foot { padding: 16px 28px 26px; color: var(--muted); font-size: 12px; text-align: center; }
.hamburger { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(10,30,45,.45); z-index: 35; display: none; }
@media (max-width: 1020px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: none; box-shadow: 20px 0 50px rgba(0,0,0,.25); }
  .scrim.open { display: block; }
  .hamburger { display: inline-grid; }
}
@media (max-width: 640px) {
  .content { padding: 18px 14px 50px; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .greet, .uname, .topbar .role-pill { display: none; }
  .user-chip { padding: 3px; }
}

/* ---------------- Page building blocks ---------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 27px; letter-spacing: -.6px; color: var(--navy); }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 760px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card h3 { margin: 0; font-size: 16.5px; color: var(--navy); display: flex; align-items: center; gap: 9px; letter-spacing: -.2px; }
.card h3 .ic { color: var(--teal); }
.card-head a.small { font-weight: 650; text-decoration: none; }
.form-sub { margin: 20px 0 10px; color: #3e5c74; font-size: 13.5px; text-transform: uppercase; letter-spacing: .6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2.align-start { align-items: start; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
.section-label { font-size: 11.5px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 750; color: #6b8296; margin: 4px 0 12px; display: flex; align-items: center; gap: 12px; }
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.kpi::after { content: ''; position: absolute; right: -34px; top: -34px; width: 116px; height: 116px; border-radius: 50%; background: var(--tone-soft); opacity: .65; }
.kpi-ic { position: relative; z-index: 1; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); margin-bottom: 12px; }
.kpi > span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; position: relative; z-index: 1; }
.kpi > b { display: block; font-size: 23px; letter-spacing: -.5px; color: var(--navy); margin: 3px 0; position: relative; z-index: 1; overflow-wrap: anywhere; line-height: 1.25; }
.kpi > small { color: var(--muted); font-size: 12.5px; position: relative; z-index: 1; display: block; }
.tone-teal { --tone: #087f8c; --tone-soft: #ddf2f3; }
.tone-navy { --tone: #153957; --tone-soft: #e2eaf3; }
.tone-gold { --tone: #a8741a; --tone-soft: #fbefd6; }
.tone-violet { --tone: #6a4cab; --tone-soft: #ece6f8; }
.tone-green { --tone: #1f7a52; --tone-soft: #dff3e8; }
.tone-amber { --tone: #a36c12; --tone-soft: #fcefd8; }
.tone-red { --tone: #b8353f; --tone-soft: #fbe3e5; }
.tone-blue { --tone: #2b5f9e; --tone-soft: #e2ebf8; }

/* Dashboard */
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.dash-grid > .card { margin-bottom: 0; }
.dash-grid .span-2 { grid-column: span 2; }
@media (max-width: 1250px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } .dash-grid .span-2 { grid-column: auto; } }
.lists .card { margin-bottom: 0; }
.admin-links { display: grid; gap: 10px; }
.admin-links a { display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); transition: .15s; }
.admin-links a:hover { border-color: #9fc3d3; background: #f5fafc; }
.admin-links .ic { width: 22px; height: 22px; color: var(--violet); }
.admin-links small { display: block; color: var(--muted); }
.empty-state { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty-state > .ic { width: 44px; height: 44px; color: #9db6c6; }
.empty-state h4 { color: var(--navy); margin: 10px 0 4px; font-size: 17px; }
.empty-state p { margin: 0 auto; max-width: 520px; }

/* Charts */
.bars { display: flex; gap: 6px; height: 250px; padding-top: 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bar-val { font-size: 10.5px; color: var(--muted); height: 16px; white-space: nowrap; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent 49px, #f1f5f8 49px, #f1f5f8 50px); }
.bar { width: min(32px, 76%); background: linear-gradient(180deg, #13a4ae, #153957); border-radius: 7px 7px 2px 2px; transition: height .5s ease; }
.bar-col:hover .bar { background: linear-gradient(180deg, #f1c871, #d99a2b); }
.bar-label { font-size: 11px; color: var(--muted); margin-top: 7px; white-space: nowrap; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 168px; height: 168px; flex: none; transform: rotate(0deg); }
.donut-c { font-size: 7.5px; font-weight: 800; fill: var(--navy); text-anchor: middle; font-family: var(--font); }
.donut-s { font-size: 3.2px; fill: var(--muted); text-anchor: middle; text-transform: uppercase; letter-spacing: .3px; font-family: var(--font); }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; flex: 1; min-width: 150px; }
.legend li { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; color: var(--navy); }
.hbars { display: grid; gap: 13px; }
.hbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.hbar-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-top b { white-space: nowrap; color: var(--navy); font-weight: 650; }
.hbar-track { height: 9px; background: #edf2f6; border-radius: 9px; overflow: hidden; }
.hbar-track div { height: 100%; border-radius: 9px; background: linear-gradient(90deg, #153957, #0b9aa5); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
.form-grid.three { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid + .form-grid { margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full, .form-grid > .full { grid-column: 1 / -1; }
.field > span { font-size: 12.5px; font-weight: 650; color: #3b566e; }
.field > small { color: var(--muted); font-size: 12px; }
.field.end { justify-content: flex-end; }
input, select, textarea { font: inherit; color: var(--ink); background: #fbfdff; border: 1px solid #c9d8e4; border-radius: 10px; padding: 9px 12px; width: 100%; min-height: 40px; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: #9fbdd0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(8,127,140,.13); background: #fff; }
textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
textarea.code { min-height: 320px; font: 12px/1.4 ui-monospace, Consolas, monospace; }
input[readonly] { background: #e9f5f6; color: #075d69; font-weight: 700; border-color: #b8d8dd; }
input:disabled, select:disabled, textarea:disabled { background: #f4f7fa; color: #24425c; opacity: 1; cursor: default; border-color: #dbe5ec; }
select { cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--teal); }
.check-field { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13.5px; color: #3b566e; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 650; font-size: 14px; padding: 9px 15px; min-height: 40px; border-radius: 10px; border: 1px solid #c6d7e4; background: #fff; color: #21496a; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .08s; box-shadow: 0 1px 2px rgba(21,57,87,.06); }
.btn:hover { border-color: #86afc6; background: #f3f9fd; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #0c929c, #076d75); border-color: #076d75; color: #fff; box-shadow: 0 4px 12px rgba(8,127,140,.25); }
.btn-primary:hover { background: linear-gradient(135deg, #0d9fa9, #065f66); color: #fff; border-color: #065f66; }
.btn-primary-soft { background: #e2f3f4; border-color: #b2dbde; color: #065f68; }
.btn-primary-soft:hover { background: #d3edee; }
.btn-danger { background: #b8353f; border-color: #a62e37; color: #fff; }
.btn-danger:hover { background: #9d2b34; color: #fff; border-color: #9d2b34; }
.btn-danger-soft { background: #fff3f4; border-color: #f0c9ce; color: #a33840; }
.btn-danger-soft:hover { background: #ffe5e8; border-color: #e4a2aa; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-sm { padding: 5px 11px; min-height: 32px; font-size: 13px; border-radius: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: #eef4f8; color: var(--navy); }
.icon-btn.danger:hover { background: #fdeaec; color: var(--red); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }
.btn-row.tight { margin: 0; }
.btn-row.center { justify-content: center; }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { background: #f3f7fa; color: #4a6378; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8fbfd; }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.strong { font-weight: 700; color: var(--navy); }
td.empty { text-align: center; color: var(--muted); padding: 30px; }
.lines td { padding: 7px 8px; vertical-align: middle; }
.lines input { min-height: 36px; padding: 7px 9px; }
.lines td.desc { min-width: 240px; }
.lines td.uom input { min-width: 80px; }
.lines td.num input { min-width: 96px; text-align: right; }
.lines td.vat input { min-width: 74px; }
.result-meta { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }
.link { font-weight: 700; text-decoration: none; white-space: nowrap; }
.link:hover { text-decoration: underline; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.access-matrix td, .access-matrix th { text-align: center; }
.access-matrix td:first-child, .access-matrix th:first-child { text-align: left; }
.check { color: var(--green); } .check .ic { width: 18px; height: 18px; }
.dash { color: #b8c6d2; }

/* Badges & chips */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; background: #edf1f5; color: #4f6579; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-paid, .b-active, .b-ready { background: #e0f4e9; color: #1b6b47; }
.b-partially-paid, .b-duplicate { background: #fcf0d8; color: #8a5d0e; }
.b-unpaid { background: #edf1f5; color: #4f6579; }
.b-overdue, .b-disabled, .b-needs-correction { background: #fde6e8; color: #a52f39; }
.b-overpaid { background: #eee8fa; color: #5a3d95; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 12px; border-radius: 20px; background: #eef4f8; font-size: 12.5px; font-weight: 650; color: #35546d; }
.chip.ok { background: #e0f4e9; color: #1b6b47; } .chip.bad { background: #fde6e8; color: #a52f39; }
.chip-sm { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #eaf2f7; color: #4d6a82; vertical-align: middle; }
.totals-chips { margin-bottom: 12px; }

/* Notices, filters, tabs */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin: 0 0 18px; border: 1px solid; font-size: 13.5px; }
.notice.info { background: #edf6fc; border-color: #c4dcee; color: #1f4d72; }
.notice.warn { background: #fff6e8; border-color: #efd29e; color: #7b4c0f; }
#impMsg .notice { margin: 14px 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { flex: 1 1 170px; }
.filters .field.grow { flex: 2 1 280px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid #c9d8e4; border-radius: 10px; padding: 0 12px; background: #fbfdff; flex: 1 1 300px; max-width: 540px; color: var(--muted); }
.search:focus-within { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(8,127,140,.13); }
.search input { border: 0; background: transparent; box-shadow: none !important; padding: 9px 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); padding: 6px; border-radius: 14px; margin-bottom: 20px; box-shadow: var(--shadow); }
.tab { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 650; color: #4a6378; cursor: pointer; }
.tab:hover { background: #f1f6f9; }
.tab.active { background: linear-gradient(135deg, #153957, #0f6170); color: #fff; }
.tab .count { font-size: 11px; background: rgba(127,150,170,.2); padding: 1px 8px; border-radius: 10px; }
.tab.active .count { background: rgba(255,255,255,.2); }

/* Purchase order editor */
.adder { background: #f6fafc; border: 1px dashed #c3d7e3; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.adder .btn-row { margin-top: 12px; }
.totals-box { margin: 16px 0 0 auto; max-width: 440px; background: linear-gradient(135deg, #eef8f8, #f5faf6); border: 1px solid #c5e2e2; border-left: 5px solid var(--teal); border-radius: 12px; padding: 14px 18px; }
.totals-box div { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.totals-box .grand { border-top: 1px solid #b9dcdc; margin-top: 6px; padding-top: 10px; font-size: 17px; color: #075c64; }
.totals-box .words { margin: 8px 0 0; font-size: 12.5px; color: #466e75; font-style: italic; }
.action-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(21,57,87,.14); }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat span { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.stat b { font-size: 15.5px; color: var(--navy); }
.progress { height: 8px; background: #e7eef4; border-radius: 8px; overflow: hidden; flex: 1; min-width: 70px; }
.progress > div { height: 100%; background: linear-gradient(90deg, #d39a2c, #0b9aa5); border-radius: 8px; }
.progress.done > div { background: linear-gradient(90deg, #22a06b, #1f7a52); }
.prog-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.prog-cell small { color: var(--muted); min-width: 36px; text-align: right; font-weight: 650; }

/* Payments & deliveries */
.balance-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 16px 0; padding: 14px; background: linear-gradient(135deg, #edf8f2, #f3f9fb); border: 1px solid #c3e2d2; border-radius: 12px; }
.balance-panel span { display: block; font-size: 11px; font-weight: 700; color: #4b6d62; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.balance-panel b { font-size: 15.5px; color: #155c3e; }
.balance-panel b.neg { color: #8a5d0e; }
.balance-panel.empty { display: flex; align-items: center; gap: 10px; background: #f5f8fb; border-color: var(--line); color: var(--muted); }
.due-row { margin-bottom: 14px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 18px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.info-grid span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; letter-spacing: .4px; }
.info-grid b { font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.item-progress { display: grid; gap: 14px; margin-top: 16px; }
.ip-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.ip-top em { font-style: normal; color: #8a5d0e; font-weight: 650; }
.ip-top em.ok { color: var(--green); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; border: 2px dashed #9cc0d2; border-radius: 14px; background: #f3f9fc; padding: 26px 18px; cursor: pointer; transition: .15s; color: #3f6480; }
.dropzone:hover, .dropzone.over { border-color: var(--teal); background: #e6f5f6; }
.dropzone.small { padding: 18px 14px; }
.dropzone input { display: none; }
.dropzone > .ic { width: 30px; height: 30px; color: var(--teal); }
.dropzone small { color: var(--muted); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: #eef3f7; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb button { position: absolute; top: 5px; right: 5px; width: 27px; height: 27px; border-radius: 50%; border: 0; background: rgba(12,32,50,.78); color: #fff; cursor: pointer; display: grid; place-items: center; }
.thumb button .ic { width: 15px; height: 15px; }
.thumb .tag { position: absolute; left: 5px; bottom: 5px; background: var(--teal); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.thumb .tag.saved { background: rgba(12,32,50,.7); }
.thumb.removed img { opacity: .3; filter: grayscale(1); }
.thumb.removed .tag { background: var(--red); }
.thumb.removed .tag::after { content: ' · will be removed'; }
.no-photos { margin: 4px 0 0; grid-column: 1 / -1; }
.mini-thumbs { display: flex; gap: 5px; align-items: center; }
.mini-thumbs img { width: 40px; height: 40px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); cursor: zoom-in; }
.mini-thumbs .more { width: 40px; height: 40px; border-radius: 7px; border: 1px solid var(--line); background: #eef4f8; font-weight: 700; color: #4a6378; cursor: pointer; }
.lightbox { position: fixed; inset: 0; background: rgba(6,18,30,.93); z-index: 1500; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 70px 24px; gap: 14px; animation: fade .15s; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px #000; background: #fff; }
.lb-bar { display: flex; gap: 14px; align-items: center; color: #dce9f0; flex-wrap: wrap; justify-content: center; font-size: 13px; }
.lb-bar .muted-l { color: #93aebf; }
.lb-close, .lb-nav { position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff; width: 46px; height: 46px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 16px; right: 16px; }
.lb-nav.prev { left: 14px; top: 50%; } .lb-nav.next { right: 14px; top: 50%; }
@media (max-width: 640px) { .lightbox { padding: 60px 12px 20px; } .lb-nav { top: auto !important; bottom: 18px; } }

/* Import */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 20px; }
.step { display: flex; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.step > span { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--teal), var(--navy)); color: #fff; font-weight: 800; }
.step b { color: var(--navy); } .step small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.sample { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: #f8fbfd; }
.sample summary { cursor: pointer; font-weight: 650; color: var(--navy); }
.sample[open] summary { margin-bottom: 10px; }
.field.req > span { color: var(--navy); }

/* Exports */
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.export-tile { display: flex; align-items: flex-start; gap: 12px; text-align: left; font: inherit; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfe; cursor: pointer; color: var(--ink); transition: .15s; }
.export-tile:hover { border-color: #8fbccb; background: #f1f9fb; box-shadow: var(--shadow); }
.export-tile > .ic { width: 22px; height: 22px; color: var(--teal); margin-top: 2px; }
.export-tile small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.backup-card { border-top: 4px solid var(--violet); }

/* Modal & toasts */
.modal-back { position: fixed; inset: 0; background: rgba(12,32,50,.52); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 1000; overflow: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: min(560px, 100%); box-shadow: 0 30px 80px rgba(12,32,50,.35); animation: pop .18s; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; color: var(--navy); font-size: 18px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #f8fbfd; border-radius: 0 0 18px 18px; }
.confirm-text { margin: 0; font-size: 15px; line-height: 1.55; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
#toasts { position: fixed; top: 16px; right: 16px; z-index: 2000; display: grid; gap: 10px; width: min(430px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-left: 5px solid #3776a3; border-radius: 12px; padding: 12px 10px 12px 14px; box-shadow: 0 12px 32px rgba(21,57,87,.2); font-weight: 600; font-size: 13.5px; animation: pop .2s; transition: opacity .5s; color: #1f4d72; }
.toast.success { border-left-color: #238057; background: #f2fbf6; color: #155c3b; }
.toast.warning { border-left-color: #c18b27; background: #fff8ec; color: #784811; }
.toast-ic { display: grid; padding-top: 1px; }
.toast-msg { flex: 1; white-space: pre-wrap; }
.toast button { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; padding: 0 4px; }
.toast.fade { opacity: 0; }

@media print {
  .sidebar, .topbar, .action-bar, #toasts, .foot { display: none !important; }
  .app { display: block; }
  .card { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi > b { font-size: 17px; }
  .kpi-ic { width: 34px; height: 34px; margin-bottom: 8px; }
  .page-head h1 { font-size: 23px; }
}

/* ---------- searchable pickers, paging, loading ---------- */
.picker { position: relative; }
.picker-input { padding-right: 34px; }
.picker-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: #e8eff5; color: #4a6378; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; display: grid; place-items: center; }
.picker-clear:hover { background: #d7e4ee; color: var(--navy); }
.picker-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid #c9d8e4; border-radius: 10px; box-shadow: 0 14px 34px rgba(21,57,87,.18); max-height: 300px; overflow: auto; min-width: 240px; }
.picker-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.picker-list li small { display: block; color: var(--muted); font-size: 12px; }
.picker-list li.active, .picker-list li:hover { background: #e9f5f6; color: #064f58; }
.picker-list li.none { color: var(--muted); cursor: default; background: none; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.pager-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pager-jump { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.pager-jump input { width: 74px; min-height: 32px; padding: 4px 8px; text-align: center; }
.loading { padding: 34px 0; }
.busy { opacity: .55; transition: opacity .15s; pointer-events: none; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--teal); cursor: pointer; text-align: left; white-space: nowrap; }
.link-btn:hover { text-decoration: underline; }
.form-grid.two { grid-template-columns: 2fr 1fr; }
.setup-card .hint code { font-size: 12px; }

/* ---------- branding ---------- */
.logo-img { object-fit: contain; border-radius: 10px; flex: none; }
.brand .logo-img { width: 42px; height: 42px; }
.art-top .logo-img { width: 52px; height: 52px; }
.login-mobile-brand .logo-img { width: 40px; height: 40px; }
.logo-edit { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; margin-bottom: 14px; }
.logo-preview { width: 120px; height: 120px; border-radius: 18px; display: grid; place-items: center; background: repeating-conic-gradient(#eef3f7 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); }
.logo-preview .logo, .logo-preview .logo-img { width: 92px; height: 92px; }
.preview-card { position: sticky; top: 84px; }
.pv-label { font-size: 11px; font-weight: 750; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }
.pv-label:first-of-type { margin-top: 0; }
.pv-side { border-radius: 14px; padding: 14px; color: #d9eaf0; background: linear-gradient(185deg, #153957 0%, #11405c 60%, #0d4f5e 100%); }
.pv-side .brand { border-bottom: 1px solid rgba(255,255,255,.1); padding: 0 0 12px; margin: 0 0 10px; }
.pv-side .side-foot { border-top: 0; padding: 0; margin: 0; }
.pv-login { border-radius: 14px; padding: 18px; color: #fff; background: linear-gradient(145deg, #12304a 0%, #154a63 55%, #0b7480 100%); }
.pv-login .art-top b { font-size: 20px; }
.pv-login h4 { font-size: 19px; line-height: 1.25; margin: 16px 0 6px; }
.pv-login p { color: #cfe6ec; margin: 0; font-size: 13px; }
.pv-credit { color: #a9d3dc; font-size: 12px; margin-top: 14px; }
.pv-print { border: 1px solid var(--line); border-top: 5px solid var(--teal); border-radius: 10px; padding: 14px; background: #fff; }
.pv-pbrand { display: flex; align-items: center; gap: 12px; color: #153957; font-size: 13px; }
.pv-pbrand .logo, .pv-pbrand .logo-img { width: 44px; height: 44px; }
.pv-print small { display: block; color: var(--muted); margin-top: 10px; border-top: 2px solid var(--gold); padding-top: 6px; }
@media (max-width: 1100px) { .preview-card { position: static; } }
@media (max-width: 520px) { .logo-edit { grid-template-columns: 1fr; } }

/* ---------- login colour theme (set in Branding) ---------- */
.login-body .btn-primary { background: linear-gradient(135deg, var(--lt-to, #0c929c), var(--lt-via, #076d75)); border-color: var(--lt-via, #076d75); box-shadow: 0 4px 12px color-mix(in srgb, var(--lt-to, #087f8c) 30%, transparent); }
.login-body .btn-primary:hover { background: linear-gradient(135deg, var(--lt-via, #0d9fa9), var(--lt-from, #065f66)); border-color: var(--lt-from, #065f66); }
.login-body .login-card h2 { color: var(--lt-from, var(--navy)); }
.login-body input:focus { border-color: var(--lt-to, var(--teal)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lt-to, #087f8c) 15%, transparent); }
@media (max-width: 900px) { .login-panel { background: linear-gradient(180deg, color-mix(in srgb, var(--lt-to, #0b7480) 12%, #fff), #f4f8fb 40%); } }
.theme-sidebar .sidebar { background: radial-gradient(circle at 0 100%, color-mix(in srgb, var(--lt-to) 40%, transparent), transparent 45%), linear-gradient(185deg, var(--lt-from) 0%, var(--lt-via) 60%, var(--lt-to) 100%); }
.theme-sidebar .nav a.active { background: linear-gradient(90deg, color-mix(in srgb, var(--lt-accent) 28%, transparent), rgba(255,255,255,.06)); box-shadow: inset 3px 0 0 var(--lt-accent); }
.theme-sidebar .nav a.active .ic { color: var(--lt-accent); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.theme-opt { border: 2px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; cursor: pointer; text-align: left; font: inherit; }
.theme-opt:hover { border-color: #9fc3d3; }
.theme-opt.active { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,127,140,.15); }
.theme-swatch { height: 46px; border-radius: 8px; position: relative; }
.theme-swatch i { position: absolute; right: 7px; bottom: 7px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.theme-opt span { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink); margin: 6px 2px 2px; }
.color-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.color-row input[type=color] { padding: 3px; height: 40px; cursor: pointer; }
@media (max-width: 640px) { .color-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pv-login { background: linear-gradient(145deg, var(--lt-from) 0%, var(--lt-via) 55%, var(--lt-to) 100%) !important; }
.pv-login .pv-accent { color: var(--lt-accent); }

/* ---------- approvals and signatories ---------- */
.b-approved, .b-accepted { background: #e0f4e9; color: #1b6b47; }
.b-pending { background: #fcf0d8; color: #8a5d0e; }
.b-rejected { background: #fde6e8; color: #a52f39; }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.sig-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; background: #fbfdfe; border-top: 4px solid #d6e2ea; }
.sig-card.st-accepted { border-top-color: #2a9a64; }
.sig-card.st-rejected { border-top-color: var(--red); background: #fff8f8; }
.sig-role { font-weight: 750; color: var(--navy); font-size: 13.5px; }
.sig-box { height: 74px; border: 1px dashed #c3d4df; border-radius: 10px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.sig-box img { max-height: 66px; max-width: 92%; object-fit: contain; }
.sig-box.empty span { color: #9aaebd; font-size: 12px; }
.sig-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sig-status { padding: 6px 0; }
.sig-meta { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.reject-banner { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 14px; margin-bottom: 18px; background: linear-gradient(135deg, #fdecee, #fff5f5); border: 1px solid #f0c3c8; border-left: 6px solid var(--red); color: #7d1f29; }
.reject-banner > .ic { width: 26px; height: 26px; color: var(--red); flex: none; margin-top: 2px; }
.reject-banner b { font-size: 15px; }
.reject-banner p { margin: 4px 0 0; font-size: 13.5px; }

/* ---------- cheque details ---------- */
.cheque-box { border: 1px solid #cfe0ea; background: linear-gradient(180deg, #f6fbfd, #fff); border-radius: 14px; padding: 14px 16px; }
.cheque-box[hidden] { display: none; }
.cheque-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cheque-head b { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); }
.cheque-box .chq-only[hidden] { display: none; }
.cheque-box .chq-only { min-width: 0; }
.btn-ai { background: linear-gradient(135deg, #6a4cab, #2b5f9e); border-color: #4b4fa3; color: #fff; }
.btn-ai:hover { background: linear-gradient(135deg, #5b3e9a, #22508a); color: #fff; border-color: #3d4190; }
.scan-result { border: 1px solid #d9d2ef; background: #f8f6fe; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; display: grid; gap: 10px; }
.scan-ok { display: flex; align-items: center; gap: 8px; color: #46307e; font-size: 13.5px; }
.flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.flags li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; }
.flags li .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.flag-crit { background: #fde6e8; color: #8d2532; }
.flag-warn { background: #fcf0d8; color: #7b4c0f; }
.flag-info { background: #e8f1fb; color: #1f4d72; }
.flags-none { margin: 0; color: var(--green); font-weight: 600; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.ic-sm { width: 14px; height: 14px; vertical-align: -2px; color: var(--muted); }
.ai-working { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #f3f0fc; color: #46307e; font-weight: 600; font-size: 13px; margin-bottom: 12px; }

/* ---------- Ask AI ---------- */
.ai-fab { position: fixed; right: 22px; bottom: 22px; z-index: 900; display: inline-flex; align-items: center; gap: 10px; padding: 13px 20px 13px 16px; border: 0; border-radius: 40px; cursor: pointer; color: #fff; font: inherit; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, #6a4cab 0%, #2b5f9e 55%, #0b9aa5 100%); box-shadow: 0 12px 30px rgba(43,52,120,.35), 0 0 0 4px rgba(255,255,255,.7); transition: transform .15s, opacity .2s; }
.ai-fab:hover { transform: translateY(-2px); }
.ai-fab .ic { width: 20px; height: 20px; }
.ai-fab.hide { opacity: 0; pointer-events: none; }
.ai-panel { position: fixed; right: 18px; bottom: 18px; top: 84px; width: min(440px, calc(100vw - 36px)); z-index: 950; display: flex; flex-direction: column; background: #fff; border-radius: 20px; border: 1px solid #dcd6ef;
  box-shadow: 0 30px 80px rgba(30,30,80,.28); overflow: hidden; transform: translateY(16px) scale(.98); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.ai-panel.open { transform: none; opacity: 1; }
.ai-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; color: #fff; background: linear-gradient(135deg, #3c2a78 0%, #2b5f9e 60%, #0b8a95 100%); }
.ai-head b { display: block; font-size: 16px; }
.ai-head small { color: #d6dcf6; font-size: 12px; }
.ai-head > div:nth-child(2) { flex: 1; }
.ai-head .icon-btn { color: #dfe4fb; }
.ai-head .icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.ai-badge { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.16); }
.ai-body { flex: 1; overflow-y: auto; padding: 16px; background: linear-gradient(180deg, #faf9ff, #f6f9fc); display: flex; flex-direction: column; gap: 12px; }
.ai-empty { text-align: center; margin: auto 0; padding: 10px 4px; }
.ai-orb { width: 58px; height: 58px; border-radius: 18px; margin: 0 auto 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #6a4cab, #0b9aa5); box-shadow: 0 10px 26px rgba(106,76,171,.35); }
.ai-orb .ic { width: 28px; height: 28px; }
.ai-empty h4 { margin: 0 0 4px; color: var(--navy); font-size: 17px; }
.ai-empty p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.ai-suggest { display: grid; gap: 8px; text-align: left; }
.ai-suggest button { border: 1px solid #ddd6f3; background: #fff; border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 13.5px; color: #3b2d6e; cursor: pointer; text-align: left; transition: .15s; }
.ai-suggest button:hover { border-color: #9c8ad6; background: #f5f2fe; }
.ai-msg { display: flex; gap: 8px; align-items: flex-start; }
.ai-msg.user { justify-content: flex-end; }
.ai-msg .bubble { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 13.8px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-msg.user .bubble { background: linear-gradient(135deg, #2b5f9e, #0b8a95); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.bot .bubble { background: #fff; border: 1px solid #e3e8f0; border-bottom-left-radius: 4px; color: var(--ink); box-shadow: 0 2px 6px rgba(21,57,87,.05); }
.ai-msg.error .bubble { background: #fff6f6; border-color: #f0c9ce; color: #8d2532; }
.ai-av { width: 28px; height: 28px; border-radius: 9px; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #6a4cab, #0b9aa5); }
.ai-av .ic { width: 15px; height: 15px; }
.ai-msg .bubble p { margin: 0 0 6px; } .ai-msg .bubble p:last-child { margin-bottom: 0; }
.ai-msg .bubble .ai-h { font-weight: 750; color: var(--navy); }
.ai-msg .bubble ul, .ai-msg .bubble ol { margin: 4px 0 6px; padding-left: 20px; }
.ai-msg .bubble code { background: #eef2f7; padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.ai-po { font-weight: 700; color: #4b36a0; text-decoration: none; border-bottom: 1px dashed #a898dd; }
.ai-po:hover { color: #2b5f9e; border-bottom-style: solid; }
.ai-table { overflow-x: auto; margin: 6px 0; border: 1px solid #e3e8f0; border-radius: 9px; }
.ai-table table { font-size: 12.5px; }
.ai-table th { padding: 7px 8px; font-size: 10.5px; }
.ai-table td { padding: 7px 8px; }
.ai-steps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e3e8f0; }
.ai-steps span { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #6b5fa0; background: #f3f0fc; border-radius: 10px; padding: 2px 8px; }
.ai-steps .ic { width: 11px; height: 11px; }
.ai-input { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid #ebeef3; background: #fff; }
.ai-input textarea { flex: 1; min-height: 44px; max-height: 140px; resize: none; border-radius: 14px; padding: 11px 14px; background: #f7f8fc; border-color: #dde3ec; }
.ai-send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 14px; cursor: pointer; color: #fff; display: grid; place-items: center; background: linear-gradient(135deg, #6a4cab, #2b5f9e); }
.ai-send:hover { filter: brightness(1.1); }
.ai-foot { font-size: 11px; color: var(--muted); text-align: center; padding: 0 14px 10px; background: #fff; }
.ai-dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: #8c7bcf; animation: aidot 1.1s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; } .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aidot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
@media (max-width: 640px) { .ai-panel { right: 0; left: 0; bottom: 0; top: 0; width: 100%; border-radius: 0; } .ai-fab { right: 14px; bottom: 14px; padding: 12px; } .ai-fab span { display: none; } }

/* ---------- AI settings ---------- */
.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.switch-row input { margin-top: 3px; }
.switch-row small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.role-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.info-list { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: #35546d; font-size: 13.5px; line-height: 1.55; }
.ok-text { color: var(--green); font-weight: 650; display: inline-flex; gap: 6px; align-items: center; }
.b-active { background: #e0f4e9; color: #1b6b47; }

.cheque-box #chqFields[hidden], .cheque-box .chq-hint[hidden] { display: none; }
.chq-hint { margin: 0; }

/* ---------- export to accounting ---------- */
.b-sent { background: #e0f4e9; color: #1b6b47; }
.b-cancelled { background: #edf1f5; color: #6b7c8d; }
.b-not-sent { background: #fff3dc; color: #8a5a00; }
.b-changed-after-sending { background: #fde6e8; color: #a52f39; }
.acc-filters .field { min-width: 150px; }
.acc-summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #f1f7f8; color: #24435a; margin: 6px 0 10px; }
.acc-summary .ic { color: var(--teal, #0b7480); flex: none; }
.acc-preview table td, .acc-preview table th { white-space: nowrap; font-size: 12.5px; }
.acc-preview table th { text-transform: none; letter-spacing: 0; }
.acc-preview { max-height: 380px; overflow: auto; }
.col-list { display: flex; flex-direction: column; gap: 6px; }
.col-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #e3eaf0; border-radius: 10px; background: #fff; }
.col-row.off { background: #f7f9fb; }
.col-row.off .col-main input { color: #8a9aa9; }
.col-row .col-on input { width: 18px; height: 18px; }
.col-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.col-main small { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: #6b7f91; }
.col-main input { width: 100%; padding: 7px 10px; border: 1px solid #d6e0e8; border-radius: 8px; font: inherit; font-size: 13.5px; }
.col-move { display: flex; gap: 2px; }
.col-move .btn { padding: 4px 8px; min-width: 0; }
.acc-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.acc-tag.sent { background: #e0f4e9; color: #1b6b47; }
.acc-tag.not-sent { background: #fff3dc; color: #8a5a00; }
.acc-tag.changed { background: #fde6e8; color: #a52f39; }
@media (max-width: 640px) { .col-row { grid-template-columns: 24px 1fr; } .col-move { grid-column: 2; } }
