/* =====================================================================
   Safa Marwa Traders ERP — light blue theme
   ===================================================================== */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --sky: #2e8bd8;
  --sky-strong: #1f72bb;
  --sky-tint: #e3f0fb;
  --sky-wash: #f2f8fd;
  --mist: #eaf4fc;
  --mist-hover: #d9eaf8;
  --ink: #12324a;
  --ink-soft: #2a4a63;
  --slate: #5a7489;
  --line: #d6e6f3;
  --line-soft: #e7f0f8;
  --paper: #ffffff;
  --page: #f5f9fd;
  --green: #16805f;
  --green-bg: #e2f4ec;
  --red: #c0412c;
  --red-bg: #fcebe7;
  --amber: #a86c12;
  --amber-bg: #fcf1dc;
  --radius: 10px;
  --radius-sm: 7px;
  --focus: 0 0 0 3px rgba(46, 139, 216, 0.28);
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --sidebar-w: 252px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  font-feature-settings: "tnum" 0;
}
a { color: var(--sky-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: 23px; font-weight: 750; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 10px; }
small, .small { font-size: 12.5px; }
.muted { color: var(--slate); }
.num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.strong { font-weight: 700; }
.ic { width: 18px; height: 18px; flex-shrink: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Shell ---------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--mist);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 0 12px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 8px 16px;
  margin: 0 -12px 8px;
  padding-left: 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  /* woven-bag texture */
  background-color: #dcecfa;
  background-image:
    repeating-linear-gradient(0deg, rgba(46,139,216,.09) 0 5px, transparent 5px 10px),
    repeating-linear-gradient(90deg, rgba(46,139,216,.09) 0 5px, transparent 5px 10px);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--sky);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: .02em;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}
.brand-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 800; line-height: 1.2; }
.brand-text small { color: var(--slate); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 12px; font-weight: 700; color: var(--slate); padding: 16px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13.5px;
}
.nav-link .ic { color: var(--sky-strong); width: 17px; height: 17px; }
.nav-link:hover { background: var(--mist-hover); text-decoration: none; }
.nav-link.active { background: var(--sky); color: #fff; }
.nav-link.active .ic { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 62px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
}
.quick { display: flex; gap: 8px; flex: 1; }
.menu-btn { display: none; }
.content { padding: 24px 28px 40px; flex: 1; }
.footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 28px; color: var(--slate); font-size: 12.5px; border-top: 1px solid var(--line);
}

/* user menu */
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 5px 8px; border-radius: var(--radius-sm); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--sky-wash); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--sky-tint); color: var(--sky-strong); display: grid; place-items: center; font-weight: 800; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13.5px; }
.user-meta small { color: var(--slate); font-size: 12px; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 200px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px; box-shadow: 0 12px 28px rgba(18,50,74,.12);
}
.user-dropdown a, .user-dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 6px; border: 0; background: none;
  font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--sky-wash); text-decoration: none; }
.user-dropdown form { margin: 0; }

/* ---- Page head --------------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--slate); margin-bottom: 6px; }
.back-link .ic { width: 15px; height: 15px; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit; font-size: 13.5px; font-weight: 700;
  line-height: 1.2; cursor: pointer; white-space: nowrap;
  text-decoration: none !important;
  transition: background .12s, border-color .12s, color .12s;
}
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--sky); color: #fff; }
.btn-primary:hover { background: var(--sky-strong); }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-light:hover { border-color: #b9d4ea; background: var(--sky-wash); }
.btn-danger { background: #fff; color: var(--red); border-color: #f0c9c1; }
.btn-danger:hover { background: var(--red-bg); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #106b4f; }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn-xs { padding: 5px 8px; font-size: 12.5px; gap: 5px; }
.btn-xs .ic { width: 14px; height: 14px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.inline-form { display: inline; margin: 0; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }

/* ---- Panels -------------------------------------------------------------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head p { margin: 2px 0 0; font-size: 12.5px; }
.panel-body { padding: 18px; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3-1 { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); gap: 20px; }
.grid-2 > .panel, .grid-3-1 > .panel, .grid-3-1 > div > .panel:last-child { margin-bottom: 0; }
.stack > * + * { margin-top: 20px; }

/* ---- KPI strip ---------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.kpi { padding: 16px 18px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.kpi:nth-child(4n) { border-right: 0; }
.kpi:nth-last-child(-n+4) { border-bottom: 0; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--slate); display: flex; align-items: center; gap: 7px; }
.kpi-label .ic { width: 15px; height: 15px; color: var(--sky); }
.kpi-value { font-size: 21px; font-weight: 780; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi-value small { font-size: 12.5px; font-weight: 600; color: var(--slate); margin-right: 3px; }
.kpi-note { font-size: 12px; color: var(--slate); margin-top: 2px; }
.kpi-note a { font-weight: 600; }

/* Position band: receivable vs payable */
.position {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px;
  padding: 18px 22px; margin-bottom: 20px;
  border: 1px solid #c6def2; border-radius: 12px;
  background: linear-gradient(180deg, #eaf5fd, #f6fbff);
}
.position-side h3 { font-size: 13px; font-weight: 650; color: var(--slate); }
.position-side .amount { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.position-side .amount small { font-size: 14px; font-weight: 650; color: var(--slate); margin-right: 4px; }
.position-side.right { text-align: right; }
.position-meter { width: 260px; }
.meter { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line); }
.meter span:first-child { background: var(--sky); }
.meter span:last-child { background: #9cc3e4; }
.meter-caption { display: flex; justify-content: space-between; font-size: 12px; color: var(--slate); margin-top: 6px; }
.position-net { text-align: center; font-size: 12.5px; color: var(--slate); margin-top: 6px; }
.position-net strong { color: var(--ink); }

/* ---- Bar chart ----------------------------------------------------------- */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding: 6px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.chart-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.chart-bar { width: 38%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.chart-bar.sales { background: var(--sky); }
.chart-bar.purchases { background: #a9cdea; }
.chart-label { font-size: 12px; color: var(--slate); margin-top: 6px; white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--slate); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .l-sales { background: var(--sky); }
.legend .l-purchases { background: #a9cdea; }

/* ---- Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12.5px; font-weight: 700; color: var(--slate);
  background: var(--sky-wash); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover td { background: #f8fbfe; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { padding: 11px 14px; border-top: 1px solid var(--line); font-weight: 750; background: var(--sky-wash); }
.table .cell-title { font-weight: 650; color: var(--ink); }
.table .cell-sub { font-size: 12.5px; color: var(--slate); }
.table-compact td, .table-compact th { padding: 8px 12px; }
.table tr.row-opening td { background: #f7fafd; font-style: italic; color: var(--ink-soft); }
.empty-row td { text-align: center; color: var(--slate); padding: 32px 14px !important; }

/* ---- Toolbar & filters ---------------------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar .field { margin: 0; }
.toolbar .grow { flex: 1; min-width: 200px; }
.search-input { position: relative; }
.search-input .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--slate); width: 16px; height: 16px; }
.search-input input, .search-input input[type=search] { padding-left: 34px; }

/* ---- Forms ------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 650; color: var(--ink-soft); }
.field .hint { font-size: 12px; color: var(--slate); }
.req { color: var(--red); }
.input, input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=tel], input[type=search], select, textarea {
  width: 100%;
  font: inherit; font-size: 14px; color: var(--ink);
  background: #fff;
  border: 1px solid #c9dcec;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  min-height: 40px;
  transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 76px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a7489' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: var(--focus); }
input[readonly] { background: var(--sky-wash); }
input.num-input { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--sky); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); background: #fbfdff; border-radius: 0 0 12px 12px; }
.field-error input, .field-error select { border-color: var(--red); }
.section-title { font-size: 13px; font-weight: 750; color: var(--sky-strong); margin: 4px 0 -4px; grid-column: 1 / -1; }

/* line items editor */
.lines th { white-space: nowrap; }
.lines td { padding: 7px 8px; vertical-align: top; }
.lines input, .lines select { min-height: 38px; padding: 8px 9px; }
.lines .col-item { min-width: 240px; }
.lines .col-qty { width: 110px; }
.lines .col-rate { width: 130px; }
.lines .col-amt { width: 140px; }
.lines .col-x { width: 44px; }
.line-meta { font-size: 12px; color: var(--slate); margin-top: 4px; min-height: 16px; }
.line-meta.low { color: var(--red); font-weight: 600; }
.line-amount { padding-top: 9px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.remove-line { border: 0; background: none; color: var(--slate); cursor: pointer; padding: 8px; border-radius: 6px; }
.remove-line:hover { color: var(--red); background: var(--red-bg); }
.totals { width: 100%; max-width: 380px; margin-left: auto; }
.totals .t-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.totals .t-row input { max-width: 150px; text-align: right; }
.totals .t-row.grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-size: 17px; font-weight: 800; }
.totals .t-row.balance { color: var(--red); font-weight: 750; }
.totals .t-val { font-variant-numeric: tabular-nums; font-weight: 650; }
.split { display: grid; grid-template-columns: 1fr 380px; gap: 24px; padding: 18px; border-top: 1px solid var(--line); }

/* ---- Badges & alerts -------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--sky-tint); color: var(--sky-strong); }
.badge-gray { background: #edf1f5; color: var(--slate); }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; font-weight: 600; }
.alert .ic { margin-top: 1px; }
.alert span { flex: 1; }
.alert-success { background: var(--green-bg); border-color: #b9e3d1; color: #0f6047; }
.alert-error { background: var(--red-bg); border-color: #f2c4ba; color: #9a2f1e; }
.alert-warning { background: var(--amber-bg); border-color: #f0d79f; color: #7f520c; }
.alert-info { background: var(--sky-tint); border-color: #bcd8f0; color: #17598f; }
.alert-close { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; opacity: .7; }
.alert-close .ic { width: 16px; height: 16px; }

/* ---- Pager ---------------------------------------------------------------- */
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 11px; border-radius: 6px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink); background: #fff; }
.pager a:hover { background: var(--sky-wash); text-decoration: none; }
.pager .current { background: var(--sky); border-color: var(--sky); color: #fff; }
.pager .disabled { color: #a8b9c7; }
.pager .gap { border: 0; background: none; }

/* ---- Detail lists ---------------------------------------------------------- */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 9px 14px; margin: 0; }
.dl dt { color: var(--slate); font-size: 13px; font-weight: 600; }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }
.summary-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.summary-row > div { padding: 14px 18px; border-right: 1px solid var(--line-soft); }
.summary-row > div:last-child { border-right: 0; }
.summary-row .label { font-size: 12.5px; color: var(--slate); font-weight: 600; }
.summary-row .value { font-size: 18px; font-weight: 780; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---- Document preview (invoice / purchase) ------------------------------- */
.doc { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.doc-top { display: flex; justify-content: space-between; gap: 24px; padding: 26px 30px 22px; border-top: 6px solid var(--sky); flex-wrap: wrap; }
.doc-company h2 { font-size: 21px; font-weight: 800; }
.doc-company p { margin: 2px 0; color: var(--slate); font-size: 13px; }
.doc-title { text-align: right; }
.doc-title .kind { font-size: 26px; font-weight: 800; color: var(--sky); letter-spacing: .02em; }
.doc-title table { margin-left: auto; margin-top: 8px; border-collapse: collapse; font-size: 13px; }
.doc-title td { padding: 2px 0 2px 16px; }
.doc-title td:first-child { color: var(--slate); text-align: right; }
.doc-title td:last-child { font-weight: 700; text-align: right; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 0 30px 20px; }
.doc-box { background: var(--sky-wash); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.doc-box h4 { font-size: 12.5px; color: var(--sky-strong); font-weight: 750; margin-bottom: 6px; }
.doc-box p { margin: 1px 0; font-size: 13.5px; }
.doc-box .name { font-weight: 800; font-size: 15px; }
.doc .table th { background: var(--sky); color: #fff; border-bottom: 0; }
.doc .table tbody tr:nth-child(even) td { background: #f6fafe; }
.doc-items { padding: 0 30px; }
.doc-items .table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.doc-bottom { display: grid; grid-template-columns: 1fr 340px; gap: 24px; padding: 20px 30px 26px; }
.doc-words { font-weight: 700; margin-bottom: 10px; }
.doc-notes { font-size: 13px; color: var(--slate); }
.doc-totals { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.doc-totals div { display: flex; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.doc-totals div:last-child { border-bottom: 0; }
.doc-totals .grand { background: var(--sky); color: #fff; font-weight: 800; font-size: 15px; }
.doc-totals .due { font-weight: 800; color: var(--red); }

/* ---- Empty state ---------------------------------------------------------------- */
.empty-state { text-align: center; padding: 48px 20px; max-width: 520px; margin: 30px auto; }
.empty-state h2 { margin: 12px 0 6px; }
.empty-state p { color: var(--slate); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 14px; background: var(--sky-tint); color: var(--sky-strong); display: grid; place-items: center; }
.empty-icon .ic { width: 26px; height: 26px; }
.error-state .empty-icon { background: var(--red-bg); color: var(--red); }

/* ---- Login --------------------------------------------------------------------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.login-art {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 48px; color: var(--ink); overflow: hidden;
  background-color: #d7eafa;
  background-image:
    repeating-linear-gradient(0deg, rgba(46,139,216,.11) 0 9px, transparent 9px 18px),
    repeating-linear-gradient(90deg, rgba(46,139,216,.11) 0 9px, transparent 9px 18px);
}
.login-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(234,245,253,.15), rgba(214,233,250,.85) 70%); pointer-events: none; }
.login-art > * { position: relative; z-index: 1; }
.login-art .brand-row { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 16px; }
.login-art h1 { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; max-width: 13ch; }
.login-art .lede { font-size: 15.5px; color: var(--ink-soft); max-width: 42ch; margin-top: 14px; }
.login-art .stamp { display: inline-flex; gap: 22px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.login-card .field { margin-top: 16px; }
.login-card .btn { width: 100%; margin-top: 22px; padding: 12px; font-size: 14.5px; }
.login-card .alert { margin-top: 16px; }
.login-foot { margin-top: 26px; font-size: 12.5px; color: var(--slate); display: flex; align-items: center; gap: 7px; }
.login-foot .ic { width: 15px; height: 15px; color: var(--green); }

/* ---- Responsive ------------------------------------------------------------------ */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(4n) { border-right: 1px solid var(--line-soft); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-last-child(-n+4) { border-bottom: 1px solid var(--line-soft); }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .grid-3-1 { grid-template-columns: 1fr; }
  .grid-3-1 > div > .panel:last-child { margin-bottom: 20px; }
}
@media (max-width: 980px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(18,50,74,.2); }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar-backdrop { display: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(18,50,74,.35); z-index: 40; }
  .menu-btn { display: inline-grid; }
  .form-grid, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: span 2; }
  .grid-2, .split, .doc-bottom, .doc-parties { grid-template-columns: 1fr; }
  .position { grid-template-columns: 1fr; text-align: left; }
  .position-side.right { text-align: left; }
  .position-meter { width: 100%; }
  .summary-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px; min-height: 220px; }
  .login-art h1 { font-size: 28px; }
  .login-art .stamp { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 0 16px; }
  .hide-sm, .user-meta { display: none; }
  .form-grid, .form-grid.cols-2, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .kpis { grid-template-columns: 1fr; }
  .kpi { border-right: 0 !important; border-bottom: 1px solid var(--line-soft) !important; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .doc-top, .doc-items, .doc-bottom, .doc-parties { padding-left: 16px; padding-right: 16px; }
  .footer { padding: 14px 16px; }
}

/* ---- Print ---------------------------------------------------------------------- */
@media print {
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .footer, .page-actions, .toolbar, .no-print, .pager, .alert, .back-link, .row-actions { display: none !important; }
  .content { padding: 0; }
  .panel, .doc { border: 0; }
  .table th { background: #eef5fb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* ---- Small layout refinements ---------------------------------------------- */
#customers-table td:first-child { min-width: 170px; }
@media (max-width: 1380px) { .dash-grid { grid-template-columns: 1fr; } .dash-grid > div > .panel:last-child { margin-bottom: 20px; } }
.btn-icon { padding-left: 8px; padding-right: 8px; }
.toolbar > .btn { min-height: 40px; }
.field .hint.text-red, .hint.text-red { color: var(--red); font-weight: 600; }
