/* --- Reset / base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: #111827;
  background: #f9fafb;
  line-height: 1.45;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2ff; padding: 1px 5px; border-radius: 3px; font-size: 0.92em; }
small.muted, .muted { color: #6b7280; }
h1 { margin: 0 0 0.5rem; }
h2 { margin: 0 0 0.75rem; font-size: 1.15rem; color: #374151; }

/* --- Navbar ------------------------------------------------------------ */
.navbar {
  background: linear-gradient(90deg, #0f172a 0%, #1e3a8a 60%, #2563eb 100%);
  color: #fff;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  position: sticky; top: 0; z-index: 100;
}
/* Bigger navbar variant — more prominent strip for the brand + user */
.navbar.navbar-lg {
  padding: 1.35rem 1.75rem;
}
.navbar .brand {
  color: #fff; font-weight: 700; font-size: 1.35rem;
  display: inline-flex; align-items: center; gap: 0.7rem;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.navbar.navbar-lg .brand { font-size: 1.55rem; }
.navbar .brand-name {
  white-space: nowrap;
}
/* On narrow screens let the brand wrap and stay readable. */
@media (max-width: 600px) {
  .navbar .brand-name {
    white-space: normal;
    line-height: 1.1;
  }
}
.navbar .brand-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.35rem;
}
.navbar.navbar-lg .brand-icon {
  width: 52px; height: 52px; font-size: 1.55rem;
}
.navbar .brand-user {
  margin-left: 1.25rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  letter-spacing: 0;
}
.navbar.navbar-lg .brand-user {
  font-size: 1.35rem;
  padding: 0.4rem 1.1rem;
}
.navbar .nav-links {
  display: flex; align-items: center; gap: 0.2rem;
}
.navbar .nav-links a {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.98rem; font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: 7px;
  transition: background 0.15s ease, color 0.15s ease;
}
.navbar .nav-links a:hover {
  color: #fff; background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}
.navbar .nav-user {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.95rem;
  padding: 0 0.75rem 0 0.9rem;
}
.navbar .nav-logout {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.navbar .nav-logout:hover { background: rgba(255, 255, 255, 0.22); }

/* Compact the brand title on narrow screens so the navbar stays usable. */
@media (max-width: 900px) {
  .navbar .brand { font-size: 1.1rem; gap: 0.5rem; flex: 1 1 auto; min-width: 0; }
  .navbar.navbar-lg .brand { font-size: 1.15rem; }
  .navbar .brand-icon { width: 36px; height: 36px; font-size: 1.1rem; }
  .navbar.navbar-lg .brand-icon { width: 40px; height: 40px; font-size: 1.2rem; }
  .navbar .brand-user {
    margin-left: 0.5rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
  }
  .navbar.navbar-lg .brand-user {
    font-size: 0.9rem;
    padding: 0.2rem 0.65rem;
  }
  .navbar.navbar-lg { padding: 0.85rem 1rem; }
}
/* On actual phones (<600px) hide the username pill entirely — space is too
   tight. The user still sees their name on the dashboard hero. */
@media (max-width: 520px) {
  .navbar .brand-user { display: none; }
}

/* Impersonation banner — highly visible so admins don't forget. */
.impersonation-banner {
  background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
  color: #fff;
  padding: 0.55rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.impersonation-banner .impersonation-stop {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.impersonation-banner .impersonation-stop:hover {
  background: rgba(255,255,255,0.35);
}

/* --- Layout ------------------------------------------------------------ */
main { max-width: 1520px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
footer { text-align: center; padding: 1rem; color: #9ca3af; border-top: 1px solid #e5e7eb; background:#fff; }
.breadcrumb { display: inline-block; margin-bottom: 0.5rem; font-size: 0.9rem; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.page-header .actions { display: flex; gap: 0.5rem; align-items: center; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.link-list { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; }
.link-list li { padding: 0.35rem 0; border-bottom: 1px solid #f3f4f6; }
.link-list li:last-child { border-bottom: 0; }

/* --- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-block;
  background: #fff;
  border: 1px solid #d1d5db;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  color: #111827;
  text-decoration: none;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn-primary {
  background: #2563eb; border-color: #2563eb; color: #fff;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; border-color: transparent; }
.link-btn {
  background: none; border: 0; padding: 0; color: #2563eb; cursor: pointer; font-size: 0.9rem;
}
.link-btn.danger { color: #dc2626; }

/* Dropdown ------------------------------------------------------------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0; top: 100%;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  z-index: 10;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 0.45rem 0.85rem; color: #111827; }
.dropdown-menu a:hover { background: #f3f4f6; text-decoration: none; }

/* --- Forms ------------------------------------------------------------- */
.form { background: #fff; padding: 1rem 1.25rem; border: 1px solid #e5e7eb; border-radius: 8px; }
.field { margin-bottom: 0.85rem; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; color: #374151; }
.field input, .field select, .field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 0.95rem;
  font-family: inherit;
}
.field textarea { font-family: monospace; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.form-actions .btn { white-space: nowrap; }

.search-form { display: flex; gap: 0.5rem; margin: 0.75rem 0 1rem; }
.search-form input[type="search"] {
  flex: 1; padding: 0.45rem 0.6rem;
  border: 1px solid #d1d5db; border-radius: 5px; font-size: 0.95rem;
}

/* --- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table thead th {
  background: #f9fafb;
  position: sticky; top: 0;
  border-bottom: 2px solid #e5e7eb;
  font-weight: 600;
}
.data-table thead a { color: #111827; }
.data-table .col-type { font-weight: normal; font-size: 0.7rem; color: #9ca3af; }
.data-table tbody tr:hover { background: #f9fafb; }
.data-table .pk { color: #dc2626; font-size: 0.75em; }
.data-table.compact th, .data-table.compact td { padding: 0.35rem 0.55rem; }
.row-actions { white-space: nowrap; }
.row-actions a, .row-actions form { margin-right: 0.5rem; }

/* --- Pager ------------------------------------------------------------- */
.pager {
  margin: 1rem 0;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

/* --- Flash ------------------------------------------------------------- */
.flash-wrap { margin-bottom: 1rem; }
.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  border: 1px solid;
  margin-bottom: 0.5rem;
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* --- Dashboard --------------------------------------------------------- */
.hero {
  background:
    radial-gradient(1200px 200px at 10% -10%, rgba(255,255,255,0.15), transparent 60%),
    radial-gradient(900px 180px at 95% 120%, rgba(255,255,255,0.12), transparent 55%),
    linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0ea5e9 100%);
  color: #fff;
  padding: 1.75rem 1.5rem;
  border-radius: 14px;
  margin-bottom: 1.5rem;
  text-align: center;
  box-shadow: 0 10px 30px -8px rgba(30, 58, 138, 0.35),
              0 2px 6px rgba(15, 23, 42, 0.06);
  position: relative;
  overflow: hidden;
}
.hero h1 {
  margin: 0 0 0.3rem;
  font-size: 1.75rem;
  letter-spacing: 0.015em;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.hero-sub { margin: 0; opacity: 0.92; font-size: 0.98rem; font-weight: 500; }

.dash-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 250px;
  gap: 1.25rem;
  align-items: start;
}
/* Non-admin users never see the Sales Overview column, so collapse the
   layout to two columns (invoice form + quick actions). */
.dash-grid.dash-grid-no-kpi {
  grid-template-columns: minmax(0, 1fr) 250px;
}
.dash-col-wide { grid-column: span 1; }
.dash-h {
  margin: 0 0 0.85rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #475569;
  font-weight: 800;
  text-align: center;
  padding: 0.45rem 0.5rem;
  background: linear-gradient(90deg, transparent 0%, #e0e7ff 50%, transparent 100%);
  border-radius: 6px;
  position: relative;
}

/* KPI tiles — stacked label/number layout so long labels + long numbers
   never fight for the same line. Per-tile color accents give the panel
   a more modern, colorful feel while keeping the numbers readable. */
.kpi {
  --accent: #94a3b8;
  --accent-tint: #f1f5f9;
  --number-color: #0f172a;
  background: linear-gradient(135deg, var(--accent-tint) 0%, #ffffff 75%);
  border: 1px solid #e5e7eb;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.55rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  min-height: 74px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(15, 23, 42, 0.12),
              0 2px 4px rgba(15, 23, 42, 0.05);
}
.kpi-label {
  color: #64748b;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  line-height: 1.25;
}
.kpi-number {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--number-color);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Per-tile accents — keyed to how Jo reads each metric */
.kpi-primary  { --accent: #2563eb; --accent-tint: #eff6ff; --number-color: #1d4ed8; }
.kpi-accent-sky    { --accent: #0891b2; --accent-tint: #ecfeff; --number-color: #0e7490; }
.kpi-accent-amber  { --accent: #d97706; --accent-tint: #fffbeb; --number-color: #b45309; }
.kpi-accent-purple { --accent: #7c3aed; --accent-tint: #f5f3ff; --number-color: #6d28d9; }
.kpi-accent-indigo { --accent: #4f46e5; --accent-tint: #eef2ff; --number-color: #4338ca; }
.kpi-month    { --accent: #059669; --accent-tint: #ecfdf5; --number-color: #047857; }
.kpi-warn     { --accent: #dc2626; --accent-tint: #fef2f2; --number-color: #b91c1c; }

.kpi-error {
  display: inline-block; background: #fef2f2; color: #991b1b;
  width: 1.4em; height: 1.4em; line-height: 1.4em; text-align: center;
  border-radius: 50%; font-weight: 700;
}

.card-invoice { text-align: center; }
.invoice-actions { display: flex; gap: 0.75rem; justify-content: center; margin-top: 0.75rem; flex-wrap: wrap; }
/* On narrow screens, stack and give each action room for a finger. */
@media (max-width: 720px) {
  .invoice-actions { gap: 0.4rem; }
  .invoice-actions .btn { flex: 1 1 calc(50% - 0.4rem); padding: 0.65rem 0.5rem; font-size: 0.9rem; white-space: nowrap; }
}
.btn-lg { padding: 0.7rem 1.2rem; font-size: 1rem; }

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}
.qa-btn {
  --qa-accent: #2563eb;
  --qa-accent-2: #60a5fa;
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  background: linear-gradient(135deg, var(--qa-accent) 0%, var(--qa-accent-2) 100%);
  padding: 0.6rem 0.8rem;
  min-height: 0;
  border-radius: 9px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.08),
    0 4px 10px -6px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  text-decoration: none;
}
.qa-btn::after {
  /* soft sheen in the top-right corner */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 100% 0%, rgba(255,255,255,0.28), rgba(255,255,255,0) 55%);
  pointer-events: none;
  z-index: 0;
}
.qa-btn > * { position: relative; z-index: 1; }
.qa-btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.12),
    0 14px 28px -10px rgba(15, 23, 42, 0.3);
}
.qa-btn:active { transform: translateY(0); }

.qa-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.qa-label { display: block; line-height: 1.15; }

/* Rotating palette — each tile gets a different gradient duo. */
.quick-actions .qa-btn:nth-child(9n+1) { --qa-accent: #1d4ed8; --qa-accent-2: #60a5fa; }
.quick-actions .qa-btn:nth-child(9n+2) { --qa-accent: #0e7490; --qa-accent-2: #22d3ee; }
.quick-actions .qa-btn:nth-child(9n+3) { --qa-accent: #047857; --qa-accent-2: #34d399; }
.quick-actions .qa-btn:nth-child(9n+4) { --qa-accent: #b45309; --qa-accent-2: #fbbf24; }
.quick-actions .qa-btn:nth-child(9n+5) { --qa-accent: #6d28d9; --qa-accent-2: #a78bfa; }
.quick-actions .qa-btn:nth-child(9n+6) { --qa-accent: #be185d; --qa-accent-2: #f472b6; }
.quick-actions .qa-btn:nth-child(9n+7) { --qa-accent: #4338ca; --qa-accent-2: #818cf8; }
.quick-actions .qa-btn:nth-child(9n+8) { --qa-accent: #c2410c; --qa-accent-2: #fb923c; }
.quick-actions .qa-btn:nth-child(9n+9) { --qa-accent: #0f766e; --qa-accent-2: #5eead4; }

/* Orphan last tile spans full width so the grid has no empty half-row. */
.quick-actions .qa-btn:last-child:nth-child(odd) { grid-column: 1 / -1; }

.tagline {
  margin-top: 2rem;
  background: linear-gradient(90deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
  color: #fff;
  text-align: center;
  padding: 0.9rem;
  border-radius: 10px;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px -6px rgba(30, 58, 138, 0.3);
}

@media (max-width: 980px) {
  .dash-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
}

/* --- Report hero (Unpaid Invoices etc.) -------------------------------- */
.report-hero {
  background: linear-gradient(135deg, #e0e7ff 0%, #f0f9ff 50%, #ecfeff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.08);
}
.report-hero-left { display: flex; align-items: center; gap: 0.9rem; }
.report-hero-left h1 {
  margin: 0;
  color: #1e3a8a;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}
.report-hero-sub { color: #475569; font-size: 1.1rem; font-weight: 500; margin-top: 0.3rem; }
.report-icon {
  font-size: 1.8rem;
  background: #fff;
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.12);
}
.report-hero-right {
  text-align: right;
  color: #475569;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.report-hero-right div:first-child { font-weight: 600; color: #1e293b; }

/* Unpaid Invoices table */
.unpaid-wrap { border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05); }
.unpaid-table th {
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid #c7d2fe;
}
.unpaid-table td { font-size: 0.92rem; }
.unpaid-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.unpaid-table .center { text-align: center; }
.unpaid-table tbody tr:nth-child(even) { background: #f8fafc; }
.unpaid-table tbody tr:hover { background: #eef2ff; }
.unpaid-table tfoot td {
  background: #1e3a8a;
  color: #fff;
  font-weight: 700;
  padding: 0.7rem 0.75rem;
  font-size: 0.98rem;
}
.unpaid-table tfoot .total-label { text-align: right; letter-spacing: 0.02em; }
.unpaid-table tfoot .total-value { font-size: 1.05rem; }

/* Status pills for Terms column */
.pill {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill-amber { background: #fef3c7; color: #92400e; }
.pill-teal  { background: #cffafe; color: #155e75; }
.pill-green { background: #d1fae5; color: #065f46; }
.pill-red   { background: #fee2e2; color: #7f1d1d; }

/* Sales list: a soft amber tint on credit-term rows so they stand out
   from cash sales at a glance. */
tr.row-credit td { background: #fffbeb; }
tr.row-credit:hover td { background: #fef3c7; }

.due-overdue {
  color: #b91c1c;
  font-weight: 700;
  background: #fee2e2;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

/* Past-due rows get a soft pink tint + red left marker — visible but not
   screaming. Text colours stay default so company names / terms pills are
   still readable. */
.unpaid-table tr.row-overdue > td {
  background: #fff5f5;
}
.unpaid-table tr.row-overdue > td:first-child {
  box-shadow: inset 4px 0 0 #dc2626;
}
.unpaid-table tr.row-overdue:hover > td {
  background: #fee2e2;
}

.overdue-days {
  font-size: 0.78rem;
  color: #b91c1c;
  font-weight: 600;
  margin-top: 0.2rem;
  letter-spacing: 0.01em;
}

.due-today {
  color: #b45309;
  font-weight: 700;
  background: #fef3c7;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.overdue-days.due-today {
  color: #b45309;
  background: transparent;
  padding: 0;
}

/* Due today — amber row tint + amber left marker */
.unpaid-table tr.row-due-today > td {
  background: #fffbeb;
}
.unpaid-table tr.row-due-today > td:first-child {
  box-shadow: inset 4px 0 0 #d97706;
}
.unpaid-table tr.row-due-today:hover > td {
  background: #fef3c7;
}

/* Not yet due — subtle green left marker, no tint (keeps table calm) */
.unpaid-table tr.row-not-due > td:first-child {
  box-shadow: inset 4px 0 0 #10b981;
}

.due-future {
  color: #065f46;
  font-weight: 600;
  background: #d1fae5;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}
.overdue-days.due-future {
  color: #065f46;
  background: transparent;
  padding: 0;
  font-weight: 500;
}

/* Unpaid report — keep Date Sold on one line even on narrower screens
   so it doesn't wrap to a second row. */
.unpaid-table .date-col {
  white-space: nowrap;
}

/* Hide print-only cells on screen; show them in print. */
.print-only { display: none; }

/* A paper-drawn checkbox for signing off on paid invoices on a print-out. */
.print-checkbox {
  display: inline-block;
  width: 16px; height: 16px;
  border: 1.5px solid #334155;
  border-radius: 3px;
  background: #fff;
  vertical-align: middle;
}

/* Print view: strip chrome but KEEP the row tints, left bars, and date
   pills so the past-due / due-today / not-due buckets are still obvious
   on paper. Browsers strip backgrounds by default; these properties
   force them to print. */
@media print {
  /* Force US Letter (landscape) as the default paper for every print.
     `counter(page)` / `counter(pages)` print "Page N of M" in the footer. */
  @page {
    size: letter landscape;
    margin: 0.5in 0.5in 0.7in 0.5in;
    @bottom-right {
      content: "Page " counter(page) " of " counter(pages);
      font-family: -apple-system, "Segoe UI", Arial, sans-serif;
      font-size: 9pt;
      color: #475569;
    }
  }

  html, body { background: #fff !important; margin: 0; padding: 0; }
  /* Reveal the print-only Paid checkbox column on paper. */
  .print-only { display: table-cell !important; }
  .navbar, .form-actions, footer, .flash-wrap { display: none !important; }
  .report-hero {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    margin-bottom: 0.5rem !important;
    padding: 0.5rem 0.75rem !important;
  }
  .report-hero-left h1 { font-size: 1.1rem !important; }
  .report-hero-sub    { font-size: 0.9rem !important; }
  .unpaid-wrap        { box-shadow: none !important; border: 0 !important;
                        overflow: visible !important; }

  /* Force ALL backgrounds/colors to survive printing — without this,
     Chrome/Edge drop the row tints, pill backgrounds, and the dark
     Grand Total bar. */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* Tighten the table so 8 columns fit on landscape letter/A4. */
  .unpaid-table {
    width: 100% !important;
    font-size: 9.5pt !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
  }
  .unpaid-table th,
  .unpaid-table td {
    padding: 0.28rem 0.4rem !important;
    line-height: 1.25 !important;
  }
  .unpaid-table thead th {
    background: #eef2ff !important;
    color: #1e3a8a !important;
    font-size: 8.5pt !important;
  }

  /* Keep Terms pills / date pills visible but small */
  .pill, .due-overdue, .due-today, .due-future {
    padding: 0.05rem 0.3rem !important;
    font-size: 8.5pt !important;
  }
  .overdue-days { font-size: 7.5pt !important; margin-top: 0.1rem !important; }

  /* Left marker bars — use border-left in print (box-shadow is often dropped) */
  .unpaid-table tr.row-overdue > td:first-child {
    border-left: 4px solid #dc2626 !important;
  }
  .unpaid-table tr.row-due-today > td:first-child {
    border-left: 4px solid #d97706 !important;
  }
  .unpaid-table tr.row-not-due > td:first-child {
    border-left: 4px solid #10b981 !important;
  }

  /* Row tints must survive the zebra-stripe rule in print */
  .unpaid-table tr.row-overdue   > td { background: #fff5f5 !important; }
  .unpaid-table tr.row-due-today > td { background: #fffbeb !important; }
  .unpaid-table tr.row-not-due   > td { background: #fff     !important; }

  /* Avoid rows splitting across pages; repeat header per page.
     Footer uses table-row-group (not table-footer-group) so the Grand Total
     row appears ONLY on the final page, not repeated on every page. */
  .unpaid-table tr    { page-break-inside: avoid; }
  .unpaid-table thead { display: table-header-group; }
  .unpaid-table tfoot { display: table-row-group; }
  .unpaid-table tfoot tr { page-break-before: avoid; }

  /* Hide interactive checkboxes — they're not meaningful on paper */
  .unpaid-table input[type="checkbox"] { display: none !important; }
}

/* --- Sales form -------------------------------------------------------- */
.sales-form .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
}
.lines-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.lines-table input, .lines-table select { width: 100%; padding: 0.4rem; }
.lines-table select.line-product { text-overflow: ellipsis; font-size: 0.95rem; }
.lines-table td { vertical-align: middle; }
.lines-table input.cur { text-align: right; font-variant-numeric: tabular-nums; }
.lines-table input.line-amount { text-align: right; }
.totals {
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}
.totals > div { display: flex; flex-direction: column; align-items: flex-end; }
.totals label { font-size: 0.78rem; text-transform: uppercase; color: #6b7280; margin-bottom: 0.1rem; }
.totals span { font-size: 1.1rem; font-weight: 700; color: #111827; }
.totals input { text-align: right; padding: 0.3rem 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; width: 120px; }
#totalDue, #change { min-width: 100px; text-align: right; }

/* Print mode: clean up the invoice for printing */
@media print {
  .navbar, .breadcrumb, .form-actions, .lines-header button,
  .page-header .actions, footer, .flash-wrap { display: none !important; }
  .card { border: 0; padding: 0; }
  body { background: #fff; }
}

/* --- Dashboard embedded invoice form ---------------------------------- */
.invoice-title-bar {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  padding: 0.65rem 1rem;
  border-radius: 8px 8px 0 0;
  margin-bottom: 0;
}
.invoice-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #f3f4f6;
  padding: 0.5rem 0.75rem;
  border-left: 1px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
}
.invoice-search label { font-size: 0.85rem; color: #374151; white-space: nowrap; }
.invoice-search input {
  flex: 1; padding: 0.35rem 0.5rem; border: 1px solid #d1d5db; border-radius: 4px;
}
.invoice-header-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 1rem 1.25rem;
}
.invoice-header-grid .field label { font-size: 0.95rem; margin-bottom: 0.3rem; }
.invoice-header-grid .field input,
.invoice-header-grid .field select {
  padding: 0.55rem 0.7rem;
  font-size: 1rem;
}
@media (max-width: 760px) {
  .invoice-header-grid { grid-template-columns: 1fr; }
}
.field-check-pair { display: flex; flex-direction: column; }
.check-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding-top: 0.1rem;
}
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  margin: 0;
}
.check-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #2563eb;
  margin: 0;
}
.invoice-header-grid .check-row { width: auto; }

.field-wo-reason textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.7rem;
  border: 1px solid #dc2626;
  border-radius: 5px;
  background: #fef2f2;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}
.field-wo-reason textarea:focus {
  outline: 2px solid #dc2626;
  outline-offset: -1px;
}
.readonly-field {
  background: #f3f4f6 !important;
  color: #6b7280;
  cursor: not-allowed;
}
.sales-form.card { border-radius: 0 0 8px 8px; }

/* Price list table — readable but still compact enough to fit all
   size columns on a standard-width screen. */
.price-table-compact th,
.price-table-compact td {
  padding: 0.45rem 0.45rem;
  font-size: 1rem;
}
.price-table-compact th { font-size: 0.9rem; letter-spacing: 0; }
.price-table-compact .num { font-variant-numeric: tabular-nums; }

/* Delivery totals row — mirrors the "Subtotal | Tax | Total" strip in Access */
.del-totals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding: 0.9rem 1rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}
.del-totals-left {
  flex: 1 1 auto;
  font-size: 0.9rem;
  color: #475569;
  font-weight: 600;
}
.del-totals-left strong { font-size: 1.1rem; color: #0f172a; margin-left: 0.5rem; }
.del-total-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.del-total-box label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #334155;
  white-space: nowrap;
  margin: 0;
}
.del-total-box input {
  width: 120px;
  text-align: right;
  padding: 0.45rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}
.del-total-box input[readonly] { background: #f1f5f9; }
.del-total-grand input {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1e3a8a;
  background: #eff6ff;
}

/* --- Login page (modern, playful) -------------------------------------- */
.login-body {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 45%, #0ea5e9 100%);
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.login-bg .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: floaty 14s ease-in-out infinite;
}
.login-bg .blob-a {
  width: 420px; height: 420px;
  background: #60a5fa;
  top: -100px; left: -120px;
  animation-delay: 0s;
}
.login-bg .blob-b {
  width: 380px; height: 380px;
  background: #c084fc;
  bottom: -140px; right: -100px;
  animation-delay: -4s;
}
.login-bg .blob-c {
  width: 300px; height: 300px;
  background: #34d399;
  top: 40%; left: 60%;
  animation-delay: -8s;
  opacity: 0.35;
}
@keyframes floaty {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(30px, -40px) scale(1.08); }
}

.login-wrap {
  position: relative;
  z-index: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1.5rem;
}
.login-card {
  position: relative;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-radius: 22px;
  padding: 3rem 3rem 2.25rem;
  width: 100%;
  max-width: 520px;
  box-shadow:
    0 30px 60px -20px rgba(15, 23, 42, 0.35),
    0 4px 12px rgba(15, 23, 42, 0.08);
  animation: fadeUp 0.5s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-logo {
  display: flex; justify-content: center; margin-bottom: 1rem;
}
.login-logo-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 84px; height: 84px;
  font-size: 2.6rem;
  background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 10px 24px -8px rgba(37, 99, 235, 0.55);
}
.login-title {
  text-align: center; margin: 0 0 0.3rem;
  font-size: 2rem; color: #0f172a; letter-spacing: -0.01em;
}
.login-sub {
  text-align: center; margin: 0 0 1.6rem;
  color: #64748b; font-size: 1rem;
}

.login-field { margin-bottom: 0.85rem; }
.login-field label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: #334155; margin-bottom: 0.3rem; letter-spacing: 0.01em;
}
.login-input-wrap {
  position: relative; display: flex; align-items: center;
}
.login-input-icon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  font-size: 1.05rem; opacity: 0.65; pointer-events: none;
}
.login-input-wrap input {
  width: 100%; box-sizing: border-box;
  padding: 0.75rem 0.85rem 0.75rem 2.4rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.95rem;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.login-input-wrap input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.login-peek {
  position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; cursor: pointer;
  font-size: 1rem; padding: 0.4rem; border-radius: 6px;
}
.login-peek:hover { background: #e2e8f0; }

.login-submit {
  margin-top: 0.9rem;
  padding: 0.85rem; font-size: 1rem; font-weight: 600;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: 0; border-radius: 10px;
  box-shadow: 0 10px 20px -8px rgba(37, 99, 235, 0.55);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.login-submit:hover { transform: translateY(-1px); filter: brightness(1.05);
                     box-shadow: 0 14px 24px -8px rgba(37, 99, 235, 0.65); }
.login-submit:active { transform: translateY(0); }

.login-forgot {
  text-align: center; margin-top: 0.85rem;
}
.login-forgot a {
  color: #2563eb; font-size: 0.88rem; font-weight: 500;
  text-decoration: none;
}
.login-forgot a:hover { text-decoration: underline; }

.login-footer {
  text-align: center; margin: 1.25rem 0 0;
  color: #94a3b8; font-size: 0.82rem; font-style: italic;
}

/* Modal (shared) */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: none;
}
.modal.open { display: block; animation: fadeUp 0.2s ease-out; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  margin: 5vh auto;
  background: #fff;
  max-width: 440px; width: calc(100% - 2rem);
  border-radius: 16px;
  padding: 2rem 1.75rem 1.5rem;
  box-shadow: 0 30px 60px -15px rgba(15, 23, 42, 0.45);
  animation: fadeUp 0.25s ease-out;
}
.modal-close {
  position: absolute; top: 0.6rem; right: 0.75rem;
  background: transparent; border: 0;
  font-size: 1.8rem; line-height: 1; color: #64748b;
  cursor: pointer; padding: 0.2rem 0.55rem; border-radius: 6px;
}
.modal-close:hover { background: #f1f5f9; color: #0f172a; }

.btn-block { display: block; width: 100%; margin-top: 0.5rem; padding: 0.75rem; font-size: 1rem; }

/* --- Mobile-nav toggle ------------------------------------------------- */
.nav-toggle {
  display: none;
  background: none; border: 0; color: #fff;
  font-size: 1.4rem; padding: 0.2rem 0.5rem; cursor: pointer;
}

/* --- Responsive / mobile ---------------------------------------------- */
@media (max-width: 720px) {
  main { padding: 1rem 0.75rem 4rem; }
  h1 { font-size: 1.4rem; }

  /* Collapsible navbar */
  .navbar { flex-wrap: wrap; padding: 0.75rem 1rem; gap: 0.35rem; }
  /* Circular menu button — clearer tap target + more obvious it's a control. */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    font-size: 1.55rem;
    line-height: 1;
    background: rgba(255,255,255,0.18);
    border: 1.5px solid rgba(255,255,255,0.45);
    border-radius: 50%;           /* circle */
    flex-shrink: 0;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    transition: background 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
  }
  .nav-toggle:hover,
  .nav-toggle:focus { background: rgba(255,255,255,0.28); outline: none; }
  .nav-toggle:active { transform: scale(0.92); }
  /* When menu is open: solid fill + rotate so the ≡/× icon visibly swaps. */
  .navbar .nav-toggle.is-open {
    background: #fff;
    color: #1e3a8a;
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.25);
  }
  .nav-toggle .nav-toggle-icon {
    display: inline-block;
    transition: transform 0.25s ease;
  }
  .nav-toggle.is-open .nav-toggle-icon { transform: rotate(90deg); }

  /* Retractable (animated) mobile drawer. We animate max-height + opacity
     so there's a smooth slide-down rather than a snap. */
  .nav-links {
    display: flex;               /* always rendered for smooth animation */
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;        /* full-width rows, not centered */
    gap: 0;
    max-height: 0;               /* closed by default */
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    padding-top: 0;
    border-top: 0 solid rgba(255,255,255,0.15);
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.2s ease, padding 0.2s ease, border-top-width 0.2s ease;
  }
  .nav-links.open {
    max-height: 520px;           /* enough for every link */
    opacity: 1;
    margin-top: 0.5rem;
    padding: 0.5rem 0 0.25rem;
    border-top-width: 1px;
  }
  .nav-links a {
    display: block;
    margin: 0;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    text-align: left;
    border-radius: 6px;
    color: rgba(255,255,255,0.92);
  }
  .nav-links a:hover,
  .nav-links a:active { background: rgba(255,255,255,0.12); }
  .nav-links .nav-logout {
    margin-top: 0.35rem;
    text-align: center;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.25);
  }

  /* Page header actions stack vertically */
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .actions { flex-wrap: wrap; }
  .page-header .actions .btn { flex: 1 1 auto; text-align: center; }

  /* Buttons bigger for fingers */
  .btn { padding: 0.6rem 1rem; font-size: 0.95rem; }

  /* Dashboard hero — stack rather than overflow. */
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.95rem; }

  /* Form fields — a single full-width column on phones. */
  .invoice-header-grid { grid-template-columns: 1fr !important; }
  .prod-grid           { grid-template-columns: 1fr !important; }
  .prod-col-2 { grid-column: auto !important; }

  /* Report hero (Unpaid, Deliveries, etc.) stacks actions below title. */
  .report-hero { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .report-hero-right { align-items: flex-start !important; }

  /* Tables scroll horizontally rather than blowing up the layout. */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table th, .data-table td { font-size: 0.85rem; padding: 0.4rem 0.5rem; }

  /* Dropdown needs to be tappable, not hover */
  .dropdown-menu { position: static; box-shadow: none; margin-top: 0.25rem; display: none; }
  .dropdown.open .dropdown-menu { display: block; }
  .dropdown:hover .dropdown-menu { display: none; }     /* disable hover on touch */
  .dropdown.open:hover .dropdown-menu { display: block; }

  /* Search form stacks */
  .search-form { flex-direction: column; }
  .search-form input[type="search"] { width: 100%; }
  .search-form .btn { width: 100%; }

  /* --- THE BIG ONE: turn data tables into stacked cards --- */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  }
  .data-table td {
    border: 0;
    border-bottom: 1px solid #f3f4f6;
    padding: 0.4rem 0;
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    word-break: break-word;
  }
  .data-table td:last-child { border-bottom: 0; }
  /* Use the header text as a label in front of each cell value on mobile */
  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    flex: 0 0 40%;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }
  .data-table td.row-actions { justify-content: flex-start; gap: 1rem; padding-top: 0.6rem; }
  .data-table td.row-actions::before { display: none; }

  /* Form inputs full width */
  .form { padding: 0.75rem; }
  .field input, .field select, .field textarea { font-size: 1rem; }  /* prevents iOS zoom */

  /* Pager bigger tap targets */
  .pager a { padding: 0.5rem 0.85rem; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; }

  /* Unpaid Invoices report must stay as a real table on narrow screens —
     the stacked-card layout makes it unreadable. Let it scroll horizontally
     inside its wrapper instead. */
  .unpaid-wrap { overflow-x: auto; border: 1px solid #e5e7eb; background: #fff; }
  .unpaid-table.data-table,
  .unpaid-table.data-table thead,
  .unpaid-table.data-table tbody,
  .unpaid-table.data-table tr,
  .unpaid-table.data-table td,
  .unpaid-table.data-table th { display: revert; width: auto; }
  .unpaid-table.data-table { display: table; width: 100%; }
  .unpaid-table.data-table thead { display: table-header-group; }
  .unpaid-table.data-table tbody { display: table-row-group; }
  .unpaid-table.data-table tr    { display: table-row; background: transparent;
                                   border: 0; border-radius: 0; margin: 0;
                                   padding: 0; box-shadow: none; }
  .unpaid-table.data-table td,
  .unpaid-table.data-table th    { display: table-cell; }
  .unpaid-table.data-table td::before { content: none; }
}


/* --- Product Data form (Access-style) ---------------------------------- */
.prod-form-wrap {
  max-width: 980px;
  margin: 0 auto;
  background: #eef3fb;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 1rem 1.25rem 1.5rem;
  box-shadow: 0 2px 8px rgba(30,58,138,0.06);
}
.prod-header h1 {
  background: #fff;
  color: #1e3a8a;
  border: 1px solid #c7d2fe;
  padding: 0.7rem 1rem;
  border-radius: 6px;
  text-align: center;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
}
.prod-search {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}
.prod-search label { font-weight: 600; color: #1e3a8a; }
.prod-search select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
}
.prod-search-btn { padding: 0.35rem 0.6rem; }

.prod-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.9rem 1rem;
  align-items: start;
}
.prod-field { display: flex; flex-direction: column; gap: 0.3rem; }
.prod-field label { font-weight: 600; color: #0f172a; font-size: 0.9rem; }
.prod-field input,
.prod-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  font-size: 0.95rem;
  font-family: inherit;
}
.prod-field input:focus { outline: 2px solid #3b82f6; outline-offset: -1px; }
.prod-readonly { background: #f1f5f9 !important; color: #64748b; }
.prod-span-2 { grid-column: span 1; }
.prod-col-2 { grid-column: span 2; }
.prod-col-3 { grid-column: 1 / -1; }
.req { color: #dc2626; font-weight: 700; }

.prod-money { position: relative; }
.prod-money-sym {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-weight: 600;
}
.prod-money input { padding-left: 1.4rem; text-align: right; }

.prod-checks {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.75rem;
  justify-content: center;
}
.prod-check {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}
.prod-check input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: #1e3a8a;
  cursor: pointer;
}

.prod-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #cbd5e1;
}
.prod-actions > .btn:not(.prod-nav) {
  min-width: 200px;
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
}
.prod-nav {
  padding: 0.4rem 0.75rem !important;
  font-size: 1.1rem;
  min-width: 2.2rem;
  text-align: center;
  background: #3b82f6;
  color: #fff !important;
  border: 0;
}
.prod-nav:hover { background: #2563eb; }
.prod-nav.is-disabled { background: #cbd5e1; pointer-events: none; }

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: 0;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { background: #fca5a5; cursor: not-allowed; }

@media (max-width: 720px) {
  .prod-grid { grid-template-columns: 1fr 1fr; }
  .prod-checks { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
  .prod-check { flex: 1 0 45%; }
}
