/* ==========================================================================
   CRM de Proformas · hoja de estilos
   ========================================================================== */

:root {
  --navy: #12344f;
  --navy-dark: #0c2438;
  --navy-soft: #e8eef4;
  --gold: #c6923c;
  --gold-soft: #fbf3e4;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --text: #1b2733;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-soft: #edf1f5;
  --green: #0f7b4f;
  --green-soft: #e7f6ee;
  --red: #b42318;
  --red-soft: #fdeceb;
  --blue: #1d4ed8;
  --blue-soft: #e8f0fd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }

svg { flex: none; }

/* ------------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 252px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #143a58 0%, #0d283d 62%, #0a2033 100%);
  color: #d9e4ee;
  z-index: 60;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand:hover { color: #fff; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #d9a84f, #b77f28);
  color: #12293b;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
  font-size: 12.5px;
  line-height: 1.25;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.brand-text small { font-size: 10.5px; color: #9fb4c6; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }

.nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-caption {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #7d95a9;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  color: #c8d6e2;
  font-size: 13.2px;
  font-weight: 500;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, 0.1); color: #fff; font-weight: 600; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
}
.nav-item.active svg { color: var(--gold); opacity: 1; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 18px;
  font-size: 10.5px;
  color: #8fa7ba;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #45c184;
  box-shadow: 0 0 0 3px rgba(69, 193, 132, 0.18);
}

.overlay { display: none; }

.main { margin-left: 252px; flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ----------------------------------------------------------------- topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.page-heading { min-width: 0; flex: 1; }
.page-heading h1 { font-size: 20px; line-height: 1.2; }
.page-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 9px;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--navy);
  cursor: pointer;
}
.menu-btn svg { width: 20px; height: 20px; }

.content {
  padding: 22px 32px 54px;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  flex: 1;
}

/* ------------------------------------------------------------------ flash */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 32px 0;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid;
  animation: slide-in 0.25s ease;
}
.flash svg { width: 17px; height: 17px; flex: none; }
.flash.ok { background: var(--green-soft); border-color: #bde6d0; color: #0a6b43; }
.flash.error { background: var(--red-soft); border-color: #f4c9c5; color: var(--red); }
.flash-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 2px;
}
.flash-close:hover { opacity: 1; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}
.dash-grid > *, .detail-grid > *, .catalog-layout > *, .form-bottom > *, .stat-grid > * { min-width: 0; }
.content > .card, form > .card { margin-bottom: 18px; }
.content > .card:last-child, form > .card:last-of-type { margin-bottom: 0; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.card-head.wrap { flex-wrap: wrap; }
.card-head h2 { font-size: 15px; }
.card-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.card-title { font-size: 14.5px; margin-bottom: 12px; }

.link { font-size: 12.5px; font-weight: 600; color: var(--navy); white-space: nowrap; }
.link:hover { color: var(--gold); }

/* ------------------------------------------------------------------ stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--navy), #2c6a92);
  opacity: 0.9;
}
.stat:nth-child(2)::before { background: linear-gradient(90deg, #0f7b4f, #3aa876); }
.stat:nth-child(3)::before { background: linear-gradient(90deg, #b47818, var(--gold)); }
.stat:nth-child(4)::before { background: linear-gradient(90deg, #40546b, #7e93a9); }
.stat-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value { display: block; font-size: 25px; font-weight: 700; color: var(--navy); margin-top: 6px; letter-spacing: -0.02em; }
.stat-note { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.stat-icon { position: absolute; right: 16px; top: 40px; color: var(--navy); opacity: 0.09; }
.stat-icon svg { width: 38px; height: 38px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }

/* ------------------------------------------------------------------ table */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th {
  background: #f8fafc;
  color: #5c6b7c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #f9fbfd; }
table.data .right, .right { text-align: right; }
table.data .center, .center { text-align: center; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.6px; letter-spacing: -0.01em; }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.green { color: var(--green); }
.ellipsis { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-title { display: block; font-weight: 600; color: var(--text); }
.cell-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
.row-actions form { display: inline; }
.danger-text { color: var(--red); }
.unit-pill {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: #475569;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}

/* ----------------------------------------------------------------- badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.borrador { background: #eef2f7; color: #526273; }
.badge.enviada { background: var(--blue-soft); color: var(--blue); }
.badge.aprobada { background: var(--green-soft); color: var(--green); }
.badge.rechazada { background: var(--red-soft); color: var(--red); }

/* ----------------------------------------------------------------- button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 1px 2px rgba(18, 52, 79, 0.25); }
.btn-primary:hover { background: var(--navy-dark); color: #fff; }
.btn-secondary { background: #fff; border-color: #d6dfe8; color: #334155; }
.btn-secondary:hover { background: #f8fafc; border-color: #c3d0dd; color: var(--navy); }
.btn-ghost { background: transparent; color: #526273; }
.btn-ghost:hover { background: #f1f5f9; color: var(--navy); }
.btn-wa { background: #1fa855; color: #fff; box-shadow: 0 1px 2px rgba(31, 168, 85, 0.3); }
.btn-wa:hover { background: #178b45; color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #0b6640; color: #fff; }
.btn-danger { background: #fff; border-color: #f0c8c4; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn-block { width: 100%; }
.inline { display: inline; }

/* ------------------------------------------------------------------ forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 16px;
  padding: 20px;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 20px; }
.span-2 { grid-column: span 2; }

.field { display: flex; flex-direction: column; min-width: 0; }
.field > label {
  font-size: 11.8px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
}
.field input,
.field select,
.field textarea,
.search input,
.message-box {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid #d7dfe8;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-family: var(--font);
  font-size: 13.2px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.search input:focus,
.message-box:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(18, 52, 79, 0.1);
}
.field input:disabled { background: #f4f6f9; color: var(--muted); }
.hint { display: block; font-size: 11.3px; color: var(--muted); margin-top: 5px; }
.hint.pad-x { padding: 0 20px; margin: 8px 0 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 20px 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--navy); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 20px;
  border-top: 1px solid var(--border-soft);
  background: #fcfdfe;
}
.form-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 13px 6px;
  margin-top: 4px;
  background: rgba(243, 245, 249, 0.94);
  backdrop-filter: blur(8px);
}
.form-bar .hint { margin: 0 auto 0 8px; }

.search { position: relative; min-width: 240px; }
.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.search input { padding-left: 32px; font-size: 12.8px; }

.stack-form { display: flex; flex-direction: column; gap: 13px; padding: 18px 20px; }
.sticky { position: sticky; top: 88px; }

/* ------------------------------------------------------------------ empty */
.empty { padding: 46px 20px; text-align: center; }
.empty.compact { padding: 28px 20px; }
.empty-icon { font-size: 30px; display: block; margin-bottom: 10px; opacity: 0.8; }
.empty h3 { font-size: 16px; margin-bottom: 4px; }
.empty p { color: var(--muted); font-size: 12.8px; margin: 0 auto 15px; max-width: 380px; }

/* --------------------------------------------------------------- dashboard */
.quick-list { padding: 8px; display: flex; flex-direction: column; }
.quick { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--text); }
.quick:hover { background: #f8fafc; color: var(--text); }
.quick-ic {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 15px;
  flex: none;
}
.quick-ic svg { width: 17px; height: 17px; }
.quick strong { display: block; font-size: 12.8px; }
.quick small { display: block; font-size: 11px; color: var(--muted); }
.quick:hover .quick-ic { background: var(--gold-soft); color: #9a6d21; }

.empty-pad { padding: 0 20px 18px; margin: 0; }
.ranking { list-style: none; margin: 0; padding: 8px 14px 14px; }
.ranking li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border-soft); }
.ranking li:last-child { border-bottom: 0; }
.rank {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #526273;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  flex: none;
}
.ranking li:first-child .rank { background: var(--gold-soft); color: #986a1d; }
.rank-name { flex: 1; font-size: 12.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-total { font-size: 12px; font-weight: 600; }

/* ------------------------------------------------------------------ quotes */
.tabs { display: flex; gap: 3px; flex-wrap: wrap; background: #f1f5f9; padding: 4px; border-radius: 10px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 12.3px;
  font-weight: 600;
  color: #5c6b7c;
}
.tab:hover { color: var(--navy); }
.tab.active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1); }
.tab-count { font-size: 10.5px; background: #e2e8f0; color: #526273; border-radius: 999px; padding: 1px 6px; font-weight: 700; }
.tab.active .tab-count { background: var(--gold-soft); color: #8f631b; }

/* --------------------------------------------------------------- item form */
.items-editor { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 720px; }
.items-editor thead th {
  background: #f8fafc;
  color: #5c6b7c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 9px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.items-editor thead th:first-child { padding-left: 20px; }
.items-editor thead th:last-child { padding-right: 16px; }
.items-editor .col-qty { width: 82px; }
.items-editor .col-unit { width: 85px; }
.items-editor .col-price { width: 120px; }
.items-editor .col-total { width: 105px; }
.items-editor .col-x { width: 44px; }
.items-editor tbody td { padding: 6px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.items-editor tbody td:first-child { padding-left: 20px; }
.items-editor tbody td:last-child { padding-right: 16px; }
.items-editor input, .items-editor select { width: 100%; padding: 7px 8px; font-size: 12.8px; border-radius: 7px; }
.items-editor .line-total { font-size: 13px; font-weight: 600; padding-right: 2px; }
.icon-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: var(--red-soft); color: var(--red); }

.form-bottom { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.form-bottom > .card { margin-bottom: 0; }
.form-bottom .field { padding: 0 20px 20px; }
.form-bottom textarea { min-height: 150px; }

.totals-panel {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 6px 20px 20px;
  padding: 12px 14px;
}
.total-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 12.8px; padding: 3px 0; color: #475569; }
.total-line strong { color: var(--text); font-weight: 600; }
.total-line.grand { border-top: 1px solid var(--border); margin-top: 7px; padding-top: 9px; font-size: 16px; font-weight: 700; color: var(--navy); }
.total-line.grand strong { font-size: 19px; color: var(--navy); font-weight: 700; }
.total-line.soft { color: var(--muted); font-size: 12px; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 8px; }

/* ------------------------------------------------------------------ detail */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.detail-grid + .card { margin-top: 18px; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.stack > .card { margin-bottom: 0; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; padding: 18px 20px; }
.info-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.info-block.span-2 { grid-column: span 2; }
.info-label { font-size: 9.8px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.info-block strong { font-size: 13.4px; font-weight: 600; }
.info-block strong.normal { font-weight: 500; }
.info-block .muted { font-size: 11.8px; }

.note-box { margin: 0 20px 18px; background: #fffaf0; border: 1px solid #f2e2c3; border-radius: 10px; padding: 11px 13px; }
.note-box p { margin: 4px 0 0; font-size: 12.6px; color: #6b5738; white-space: pre-line; }

.summary-card { padding: 18px 20px; }
.summary-card > h2 { margin-bottom: 10px; font-size: 14.5px; }
.grand-total { font-size: 29px; font-weight: 700; color: var(--navy); letter-spacing: -0.03em; margin: 2px 0 10px; }
.summary-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; font-size: 12.8px; color: #526273; border-bottom: 1px dashed var(--border-soft); }
.summary-row:last-of-type { border-bottom: 0; }
.summary-row strong { color: var(--text); font-weight: 600; }
.summary-row.separated { border-top: 1px solid var(--border); border-bottom: 0; margin-top: 6px; padding-top: 10px; }
.summary-card .btn { margin-top: 14px; }
.summary-card > .hint { margin-top: 12px; }

.status-actions { display: flex; flex-direction: column; gap: 7px; }
.status-actions form { margin: 0; }
.status-actions .btn { justify-content: flex-start; }
.status-actions + .hint { margin-top: 12px; }

.alert-inline { margin-top: 12px; padding: 9px 11px; border-radius: 8px; background: var(--red-soft); color: #8f2b22; font-size: 12px; border: 1px solid #f3cbc7; }

.message-box { margin: 0 20px; width: calc(100% - 40px); font-size: 12.7px; line-height: 1.55; background: #f8fafc; resize: vertical; }
.card > .hint { margin: 10px 20px 18px; }

.pdf-frame {
  display: block;
  width: calc(100% - 40px);
  height: 760px;
  margin: 0 20px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #eef2f6;
}

.danger-zone p { margin: 0 0 12px; }
.danger-zone .btn { margin: 0; }

/* ------------------------------------------------------------------ misc */
.catalog-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.catalog-layout > .card { margin-bottom: 0; }
.catalog-layout .table-wrap { max-height: 620px; overflow-y: auto; }
.catalog-layout .sticky { top: 88px; }

.error-card { text-align: center; padding: 60px 24px; }
.error-code { display: block; font-size: 64px; font-weight: 800; color: var(--navy); opacity: 0.15; line-height: 1; }
.error-card h2 { font-size: 20px; margin: 12px 0 6px; }
.error-card p { color: var(--muted); margin: 0 0 20px; }

.page-sub .badge { transform: translateY(-1px); }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .detail-grid, .form-bottom, .catalog-layout { grid-template-columns: 1fr; }
  .catalog-layout .sticky { position: static; }
  .form-bottom .field { padding-bottom: 16px; }
}

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.24s ease; box-shadow: 20px 0 50px rgba(0, 0, 0, 0.25); }
  .sidebar.open { transform: none; }
  .overlay.open { display: block; position: fixed; inset: 0; background: rgba(12, 25, 38, 0.42); z-index: 50; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 20px; }
  .content { padding: 18px 20px 46px; }
  .flash { margin: 12px 20px 0; }
  .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .page-heading h1 { font-size: 18px; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; padding: 16px; }
  .span-2 { grid-column: span 1; }
  .info-grid { grid-template-columns: 1fr; padding: 16px; }
  .info-block.span-2 { grid-column: span 1; }
  .card-head { padding: 14px 16px; flex-wrap: wrap; }
  .search { width: 100%; min-width: 0; }
  .message-box { margin: 0 16px; width: calc(100% - 32px); }
  .card > .hint { margin-left: 16px; margin-right: 16px; }
  .pdf-frame { width: calc(100% - 32px); margin: 0 16px 16px; height: 560px; }
  .summary-card { padding: 16px; }
  .note-box { margin-left: 16px; margin-right: 16px; }
  .hint.pad-x { padding: 0 16px; }
  .form-bar { padding: 12px 0; }
  .form-bar .hint { display: none; }
  .form-bar .btn { flex: 1; }
  .grand-total { font-size: 26px; }
  table.data { font-size: 12.4px; min-width: 600px; }
  table.data thead th, table.data tbody td { padding: 10px 12px; }
  .items-editor tbody td:first-child { padding-left: 14px; }
}

@media (max-width: 460px) {
  .content { padding: 14px 14px 44px; }
  .topbar { padding: 10px 14px; }
  .flash { margin: 10px 14px 0; }
  .stat-value { font-size: 22px; }
  .btn { padding: 8px 11px; font-size: 12.5px; }
  .btn-lg { padding: 10px 16px; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; }
}
