/* =====================================================================
   Ezaris AMC — design system (from design_handoff_ezaris_amc/README.md)
   Plus Jakarta Sans for UI · IBM Plex Mono for every number, date, ID.
   No shadows anywhere — 1px borders only.
   ===================================================================== */
:root {
  --teal: #0F766E; --teal-hover: #115E59; --teal-bright: #14B8A6; --teal-deep: #134E4A;
  --teal-tint: #CCFBF1; --teal-50: #F0FDFA; --teal-200: #99F6E4; --yellow: #FCD34D;
  --sidebar: #0B0F0E; --sidebar-border: #232926; --sidebar-text: #A8B0AE; --sidebar-label: #6E7673; --sidebar-muted: #7F8785;
  --ink: #11182A; --text-2: #5B667A; --muted: #8A94A6; --label: #7A8699; --faint: #A0A9B8;
  --canvas: #F6F8FB; --surface: #FFFFFF; --border: #E4E8EF; --border-inner: #EEF1F6;
  --input-border: #D7DEE9; --input-bg: #F8FAFC; --head-bg: #FAFBFD; --hover-border: #9FB0C8;
  --success: #067A54; --success-bg: #E6F5EF; --warning: #B45309; --warning-bg: #FDF3E3;
  --danger: #B42318; --danger-bg: #FEECEB; --neutral-bg: #EEF1F6;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-hover); text-decoration: underline; }
table { border-collapse: collapse; width: 100%; }
input, select, textarea, button { font-family: inherit; }
h1, h2, h3 { letter-spacing: -0.02em; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-muted   { color: var(--text-2); }
.text-faint   { color: var(--muted); }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 2px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 26px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #fff; }
.brand:hover { text-decoration: none; color: #fff; }
.brand img { width: 28px; height: 28px; border-radius: 8px; display: block; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-name span { color: var(--teal-bright); font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--sidebar-label); font-weight: 700; padding: 0 8px 8px; }
.nav-label.spaced { padding-top: 18px; }
.nav a { display: block; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--sidebar-text); text-decoration: none; }
.nav a:hover { color: #fff; background: #151B19; }
.nav a.active { background: var(--teal); color: #fff; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--sidebar-border); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--teal); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.sidebar-user { min-width: 0; flex: 1; }
.sidebar-user .n { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .r { font-size: 11px; color: var(--sidebar-muted); }
.signout { background: none; border: 0; color: var(--sidebar-muted); font-size: 11px; font-weight: 600; cursor: pointer; padding: 4px; }
.signout:hover { color: #fff; }

.topbar { background: #fff; border-bottom: 1px solid var(--border); padding: 0 28px; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 20px; position: sticky; top: 0; z-index: 5; }
.page-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.search { height: 36px; width: 280px; max-width: 34vw; border: 1px solid var(--input-border); border-radius: 8px; padding: 0 12px; font-size: 13px; background: var(--input-bg); color: var(--ink); }
.content { padding: 26px 28px 56px; max-width: 1320px; }
.narrow { max-width: 1000px; }

/* ---------- Buttons & chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--input-border); background: #fff; color: var(--ink); border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--hover-border); color: var(--ink); text-decoration: none; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-hover); border-color: var(--teal-hover); color: #fff; }
.btn-sm { height: 30px; padding: 0 11px; border-radius: 7px; font-size: 12px; }
.btn-md { height: 38px; padding: 0 15px; }
.btn-lg { height: 44px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-muted { color: var(--text-2); }
.btn-danger { color: var(--danger); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-danger { color: var(--danger); font-weight: 600; font-size: 13px; background: none; border: 0; cursor: pointer; padding: 0; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .push { margin-left: auto; display: flex; gap: 8px; }
.chip { height: 34px; padding: 0 13px; border: 1px solid var(--input-border); background: #fff; color: var(--text-2); border-radius: 8px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; cursor: pointer; }
.chip:hover { border-color: var(--hover-border); color: var(--text-2); text-decoration: none; }
.chip.active { border-color: var(--teal); background: var(--teal-tint); color: var(--teal); }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.card.flush { overflow: hidden; }
.card.pad { padding: 18px; }
.card.pad-lg { padding: 22px; }
.card + .card { margin-top: 16px; }
.stack > .card + .card { margin-top: 0; }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 14px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--text-2); }
.card-body-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--label); font-weight: 700; margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }

/* ---------- KPIs & stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 18px; display: block; color: inherit; }
a.kpi:hover { border-color: var(--hover-border); text-decoration: none; color: inherit; }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 10px; }
.kpi-value { font-family: var(--mono); font-size: 30px; font-weight: 500; letter-spacing: -0.02em; }
.kpi-delta { font-size: 12px; margin-top: 6px; font-weight: 600; color: var(--text-2); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.mini-stat { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.mini-stat .kpi-label { margin-bottom: 8px; }
.mini-stat .v { font-family: var(--mono); font-size: 24px; font-weight: 500; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-inner); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--label); font-weight: 700; margin-bottom: 5px; }
.stat-value { font-family: var(--mono); font-size: 17px; font-weight: 500; white-space: nowrap; }

/* ---------- Layout grids ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--label); font-weight: 700; padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--head-bg); white-space: nowrap; }
table.data th.right { text-align: right; }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border-inner); font-size: 13px; vertical-align: middle; }
table.data.inset td, table.data.inset th { padding-left: 18px; padding-right: 18px; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr[data-href] { cursor: pointer; }
table.data tbody tr[data-href]:hover { background: var(--head-bg); }
td.num, .num { text-align: right; font-family: var(--mono); font-weight: 500; white-space: nowrap; }
.t-strong { font-weight: 600; font-size: 14px; }
.t-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.t-code { font-family: var(--mono); font-size: 13px; font-weight: 500; white-space: nowrap; }
.table-foot { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--border-inner); }
.table-foot .pager { display: flex; gap: 6px; }
.empty { padding: 36px 18px; text-align: center; color: var(--text-2); font-size: 13px; line-height: 1.6; }

/* ---------- Status pills ---------- */
.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-danger  { background: var(--danger-bg);  color: var(--danger); }
.pill-neutral { background: var(--neutral-bg); color: var(--text-2); }
.pill-info    { background: var(--teal-tint);  color: var(--teal); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-grid.cols-200 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.field.span-all { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .req { color: var(--danger); }
.input, .select, .textarea { width: 100%; height: 40px; border: 1px solid var(--input-border); border-radius: 8px; padding: 0 12px; font-size: 14px; background: #fff; color: var(--ink); }
.select { padding: 0 10px; }
.textarea { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20, 184, 166, .18); }
.input.mono { font-family: var(--mono); }
.input.has-error, .select.has-error { border-color: var(--danger); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 5px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.check input { accent-color: var(--teal); width: 15px; height: 15px; }
.preview-panel { background: var(--teal-50); border: 1px dashed var(--teal-200); border-radius: 9px; padding: 15px; }
.preview-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.preview-sub { font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.gen-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.gen-chip { background: #fff; border: 1px solid var(--input-border); border-radius: 8px; padding: 9px 12px; font-size: 12px; }
.gen-chip b { display: block; font-weight: 700; }
.gen-chip span { font-family: var(--mono); color: var(--text-2); margin-top: 3px; display: block; }
.sticky-footer { position: sticky; bottom: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; z-index: 4; }
.sticky-footer .actions { display: flex; gap: 8px; }
.error-summary { background: var(--danger-bg); color: var(--danger); border: 1px solid #F8C9C5; border-radius: 8px; padding: 11px 14px; font-size: 13px; margin-bottom: 16px; }
.error-summary ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Flash ---------- */
.flash { padding: 11px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-bottom: 16px; border: 1px solid; }
.flash-success { background: var(--success-bg); color: var(--success); border-color: #BFE6D6; }
.flash-error   { background: var(--danger-bg);  color: var(--danger);  border-color: #F8C9C5; }
.flash-info    { background: var(--teal-50);    color: var(--teal);    border-color: var(--teal-200); }

/* ---------- Feeds, details ---------- */
.back { font-size: 13px; font-weight: 600; display: inline-block; margin-bottom: 12px; }
.feed-item { display: flex; gap: 11px; padding-bottom: 13px; margin-bottom: 13px; border-bottom: 1px solid var(--border-inner); }
.feed-item:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); margin-top: 6px; flex: none; }
.dot.muted { background: var(--input-border); }
.feed-title { font-size: 13px; font-weight: 600; }
.feed-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.feed-date { font-family: var(--mono); font-size: 12px; color: var(--muted); width: 74px; flex: none; }
.feed-text { font-size: 13px; min-width: 0; }
.detail-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.detail-code { font-family: var(--mono); font-size: 13px; color: var(--text-2); font-weight: 500; }
.detail-name { margin: 0 0 4px; font-size: 24px; font-weight: 700; }
.detail-sub { font-size: 14px; color: var(--text-2); }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.kv .k { color: var(--label); font-weight: 600; margin-bottom: 2px; }
.kv-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.divider-top { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-inner); }
.tile { width: 46px; height: 46px; border-radius: 11px; background: var(--teal-tint); color: var(--teal); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; margin-bottom: 14px; }
.note-text { font-size: 13px; color: var(--text-2); line-height: 1.65; white-space: pre-line; }
.note-meta { font-size: 11px; color: var(--faint); margin-top: 10px; }

/* ---------- Timeline (asset history) ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 3px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: -18px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.tl-item.muted::before { background: var(--input-border); }
.tl-date { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tl-title { font-size: 13px; font-weight: 600; margin-top: 2px; }
.tl-detail { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }

/* ---------- Bar chart ---------- */
.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: end; height: 150px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; height: 100%; }
.bar-pair { display: flex; gap: 5px; align-items: flex-end; justify-content: center; height: 100%; }
.bar { width: 14px; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.billed { background: var(--teal-200); }
.bar.paid { background: var(--teal); }
.bar-month { font-size: 11px; color: var(--muted); text-align: center; font-weight: 600; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Import wizard ---------- */
.steps { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 99px; font-size: 13px; font-weight: 600; background: #fff; color: var(--muted); border: 1px solid var(--border); }
.step .n { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: #C9D1DC; color: #fff; align-items: center; justify-content: center; font-size: 11px; }
.step.done { background: var(--teal-tint); color: var(--teal); border-color: var(--teal); }
.step.done .n { background: var(--teal); }
.step.current { color: var(--ink); border-color: var(--input-border); }
.step.current .n { background: var(--ink); }
.dropzone { border: 2px dashed var(--teal-200); background: var(--teal-50); border-radius: 10px; padding: 30px; text-align: center; }
.dropzone.drag { border-color: var(--teal); }
.dz-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.dz-sub { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.file-strip { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding: 11px 14px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap; font-size: 13px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-brand { background: var(--teal-deep); color: #fff; padding: 56px 56px 44px; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; }
.login-logo { display: flex; align-items: center; gap: 10px; }
.login-logo img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.login-logo .brand-name { font-size: 17px; }
.login-kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-bright); font-weight: 600; margin-bottom: 18px; }
.login-headline { font-size: 40px; line-height: 1.12; letter-spacing: -0.03em; margin: 0 0 18px; font-weight: 700; text-wrap: pretty; }
.login-copy { font-size: 15px; line-height: 1.6; color: #A7D5CE; margin: 0; }
.login-facts { display: flex; gap: 32px; font-size: 13px; color: #A7D5CE; flex-wrap: wrap; }
.login-facts b { display: block; font-family: var(--mono); font-size: 22px; color: #fff; font-weight: 500; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--canvas); }
.login-form { width: 100%; max-width: 380px; }
.login-form h2 { font-size: 26px; margin: 0 0 6px; font-weight: 700; }
.login-form .lead { font-size: 14px; color: var(--text-2); margin: 0 0 28px; }
.login-form .input { height: 42px; padding: 0 13px; margin-bottom: 18px; }
.login-row { display: flex; justify-content: space-between; align-items: center; margin: -8px 0 22px; font-size: 13px; }
.login-foot { font-size: 12px; color: var(--muted); margin: 22px 0 0; line-height: 1.6; }

/* ---------- Home: guided steps, choices, "more options" ---------- */
.step-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 8px; }
.step-tile { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px; color: var(--ink); }
.step-tile:hover { border-color: var(--teal); background: var(--teal-50); text-decoration: none; color: var(--ink); }
.step-no { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.step-tile.attention .step-no { background: var(--warning); }
.step-title { font-size: 14.5px; font-weight: 700; }
.step-sub { font-size: 12px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.flow-hint { font-size: 12.5px; color: var(--text-2); margin: 0 0 18px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--input-border); border-radius: 9px; padding: 12px 14px; cursor: pointer; background: #fff; }
.choice:has(input:checked) { border-color: var(--teal); background: var(--teal-50); }
.choice input { accent-color: var(--teal); margin-top: 3px; }
.choice b { display: block; font-size: 13.5px; }
.choice span { display: block; font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
details.more { margin-top: 4px; }
details.more > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--teal); padding: 6px 0; }
details.more[open] > summary { margin-bottom: 12px; }

/* ---------- Quotation items editor ---------- */
.item-row { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; }
.item-row + .item-row { margin-top: 10px; }
.item-main { display: grid; grid-template-columns: 22px minmax(0, 3fr) 70px 110px 70px 86px 110px 24px; gap: 10px; align-items: end; }
.item-extra { display: grid; grid-template-columns: 22px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.5fr) 100px 24px; gap: 10px; margin-top: 10px; }
.item-row label { display: block; font-size: 10.5px; font-weight: 700; color: var(--label); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.item-row .input, .item-row .select { height: 36px; font-size: 13px; }
.item-row .textarea { min-height: 36px; font-size: 13px; padding: 8px 10px; }
.item-seq { font-family: var(--mono); font-weight: 600; color: var(--muted); padding-bottom: 10px; }
.item-amount { font-family: var(--mono); font-weight: 600; text-align: right; padding-bottom: 10px; white-space: nowrap; }
.item-remove { background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 0 8px; }
.item-remove:hover { color: var(--danger); }
.totals-box { margin-left: auto; max-width: 380px; font-size: 13px; }
.totals-box .kv-line { padding: 4px 0; }
.totals-box .grand { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 15px; }

/* ---------- Printable quotation / contract document ---------- */
.doc { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 36px 40px; max-width: 880px; margin: 0 auto; font-size: 12.5px; line-height: 1.5; color: #11182A; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 14px; border-bottom: 2px solid var(--teal); margin-bottom: 16px; }
.doc-org { font-size: 11.5px; color: var(--text-2); line-height: 1.55; }
.doc-org-name { font-size: 18px; font-weight: 800; color: var(--teal); letter-spacing: -.01em; margin-bottom: 2px; }
.doc-title { font-size: 15px; font-weight: 700; text-align: right; margin-bottom: 6px; }
.doc-meta table { margin-left: auto; width: auto; }
.doc-meta td { padding: 1px 0 1px 14px; font-size: 12px; white-space: nowrap; }
.doc-meta td:first-child { color: var(--text-2); text-align: right; }
.doc-row { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 14px; }
.doc-charges { width: 250px; flex: none; align-self: flex-start; border: 1px solid #CBD5E1; }
.doc-charges th { background: var(--teal); color: #fff; text-align: left; padding: 6px 10px; font-size: 12px; }
.doc-charges td { padding: 5px 10px; border-top: 1px solid #E2E8F0; font-size: 12px; }
.doc-charges td:last-child, .doc-num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.doc-charges tr.grand td { font-weight: 700; background: var(--teal-50); }
.doc-h { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--teal); margin: 14px 0 4px; }
.doc-text div + div { margin-top: 2px; }
.doc ul { margin: 3px 0 0; padding-left: 18px; }
.doc-items { border: 1px solid #CBD5E1; margin-top: 12px; }
.doc-items th { background: #F1F5F9; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid #CBD5E1; text-align: left; }
.doc-items th.doc-num { text-align: right; }
.doc-items td { padding: 8px; border-bottom: 1px solid #E2E8F0; vertical-align: top; font-size: 12px; }
.doc-items .sub { color: var(--text-2); font-size: 11.5px; }
.doc-totals { width: 300px; margin: 8px 0 0 auto; }
.doc-totals td { padding: 2px 8px; font-size: 12px; }
.doc-totals tr.grand td { border-top: 1px solid #94A3B8; font-weight: 700; font-size: 13px; padding-top: 6px; }
.doc-words { font-size: 11.5px; margin-top: 4px; text-align: right; font-style: italic; color: var(--text-2); }
.doc-bank { border: 1px solid #CBD5E1; border-radius: 6px; padding: 10px 14px; margin-top: 16px; max-width: 520px; }
.doc-bank table { width: auto; }
.doc-bank td { padding: 1px 10px 1px 0; font-size: 12px; }
.doc-terms { white-space: pre-line; font-size: 10.5px; line-height: 1.55; text-align: justify; }
.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 20px; }
.doc-sign-box { border: 1px solid #CBD5E1; border-radius: 6px; padding: 12px 14px; font-size: 12px; line-height: 1.7; }
.doc-sign-box .line { border-bottom: 1px solid #94A3B8; height: 44px; margin: 4px 0 6px; }
.doc-note { margin-top: 14px; font-size: 11.5px; padding: 10px 12px; background: #F8FAFC; border-left: 3px solid var(--teal); }
.doc-footer { margin-top: 18px; font-size: 10px; color: var(--muted); text-align: center; }

/* Letterhead (title + reference left, logo right) and footer — repeated on every printed page */
.doc-frame { width: 100%; border-collapse: collapse; }
.doc-frame > thead > tr > td, .doc-frame > tbody > tr > td, .doc-frame > tfoot > tr > td { padding: 0; vertical-align: top; }
.doc-frame-next { margin-top: 30px; }
.doc-letterhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 12px; border-bottom: 2px solid var(--teal); margin-bottom: 16px; }
.lh-meta .doc-title { text-align: left; font-size: 16px; margin-bottom: 6px; }
.lh-meta table { width: auto; }
.lh-meta td { padding: 1px 12px 1px 0; font-size: 12px; white-space: nowrap; }
.lh-meta td:first-child { color: var(--text-2); }
.doc-logo { flex: none; text-align: right; }
.doc-logo img { display: block; max-height: 70px; max-width: 250px; margin-left: auto; }
.doc-logo-text { font-size: 20px; font-weight: 800; color: var(--teal); letter-spacing: -.01em; }
.doc-footer-space { height: 0; }
.doc-footer-fixed { margin-top: 24px; padding-top: 8px; border-top: 2px solid var(--teal); text-align: center; background: #fff; }
.doc-footer-address { font-size: 10.5px; color: #334155; line-height: 1.5; white-space: pre-line; font-weight: 600; }
.doc-footer-generated { font-size: 9px; color: var(--muted); margin-top: 2px; }

@media print {
  @page { size: A4; margin: 10mm 12mm 8mm; }
  html, body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .flash { display: none !important; }
  .app { display: block; }
  .content { padding: 0 !important; max-width: none !important; }
  .doc { border: 0; border-radius: 0; padding: 0; max-width: none; }
  .doc-frame > thead { display: table-header-group; }
  .doc-frame > tfoot { display: table-footer-group; }
  .doc-frame-next { margin-top: 0; break-before: page; }
  .doc-footer-space { height: 20mm; }
  .doc-footer-fixed { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; }
  .doc-items tr, .doc-sign, .doc-bank, .doc-totals { break-inside: avoid; }
  a { color: inherit !important; text-decoration: none !important; }
}

/* ---------- Responsive (desktop-first) ---------- */
@media (max-width: 1000px) {
  .detail-grid, .profile-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  /* On a phone the search needs a line of its own, or the buttons squeeze it to nothing. */
  .top-actions { flex-wrap: wrap; gap: 8px; }
  .top-actions .search { flex: 1 1 100%; width: 100%; min-width: 0; order: -1; }
  .top-actions .btn { flex: 1 1 auto; justify-content: center; }
  .sidebar { padding: 10px 14px; gap: 8px; }
  .nav a { padding: 6px 10px; }
  .kpis { gap: 10px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label { display: none; }
  .sidebar-foot { margin-top: 0; margin-left: auto; border-top: 0; padding: 0; }
  .topbar { padding: 10px 16px; height: auto; min-height: 60px; flex-wrap: wrap; position: static; }
  .top-actions { width: 100%; }
  .search { width: 100%; max-width: none; flex: 1; }
  .content { padding: 18px 16px 40px; }
  .login { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; padding: 28px 24px; gap: 28px; }
  .login-headline { font-size: 28px; }
  .login-panel { padding: 32px 16px; }
}
