/* SmartMill mockup 1a — component layer on top of Unfold (Tailwind + Inter).
   Same classes will become base.html + partials in the Django app. */

:root {
  --sm-teal: #0f766e;
  --sm-ink: #1f2937;
  --sm-muted: #6b7280;
}

/* ---------- area label: "админка" / "кабинет" ---------- */
.sm-env {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: #0f766e;
  vertical-align: middle;
  margin-inline-start: 10px;
}
.sm-env--admin { background: #0f766e; }
.sm-env--client { background: #1d4ed8; }
.sm-env span { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: .85; }

/* ---------- chips ---------- */
.sm-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 18px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.sm-chip--status-design   { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.sm-chip--status-nesting  { background: #f0f9ff; color: #075985; border-color: #bae6fd; }
.sm-chip--status-ready    { background: #ecfeff; color: #155e75; border-color: #a5f3fc; }
.sm-chip--status-mill     { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.sm-chip--status-sinter   { background: #fdf4ff; color: #86198f; border-color: #f5d0fe; }
.sm-chip--status-dry      { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.sm-chip--status-finish   { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.sm-chip--status-done     { background: #f3f4f6; color: #374151; border-color: #e5e7eb; }
.sm-chip--status-attention{ background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.sm-chip--status-default  { background: #f9fafb; color: #4b5563; border-color: #e5e7eb; }

.sm-chip--machine-500l { background: #f5f3ff; color: #5b21b6; border-color: #ddd6fe; }
.sm-chip--machine-200  { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.sm-chip--machine-a5   { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.sm-chip--machine-default { background: #f9fafb; color: #4b5563; border-color: #e5e7eb; }

.sm-chip--bill-invoice  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.sm-chip--bill-nocharge { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.sm-chip--bill-redo     { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.sm-chip--bill-empty    { background: #fff; color: #9ca3af; border-color: #e5e7eb; border-style: dashed; }

.sm-chip--flag-rush      { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.sm-chip--flag-overdue   { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.sm-chip--flag-attention { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.sm-chip--flag-redo      { background: #fff1f2; color: #9f1239; border-color: #fda4af; }
.sm-chip--flag-nocharge  { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
.sm-chip--flag-nobilling { background: #fefce8; color: #854d0e; border-color: #fde047; }
.sm-chip--flag-noprice   { background: #fff; color: #b45309; border-color: #fbbf24; border-style: dashed; }
.sm-chip--flag-web       { background: #eff6ff; color: #1e3a8a; border-color: #c7d2fe; }

.sm-chip--inv-draft   { background: #f9fafb; color: #4b5563; border-color: #e5e7eb; }
.sm-chip--inv-sent    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.sm-chip--inv-partial { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.sm-chip--inv-paid    { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.sm-chip--inv-void    { background: #f3f4f6; color: #9ca3af; border-color: #e5e7eb; text-decoration: line-through; }

.sm-noprice { color: #b45309; border-bottom: 1px dashed #f59e0b; font-size: 12px; }

/* ---------- data tables used inside cards and custom pages ---------- */
.sm-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}
.sm-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef0f3;
  background: #fcfcfd;
}
.sm-card__title { font-weight: 600; font-size: 13.5px; color: #111827; }
.sm-card__hint { font-size: 12px; color: #6b7280; }

.sm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sm-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #6b7280;
  padding: 8px 12px;
  border-bottom: 1px solid #eef0f3;
  background: #fbfbfc;
  position: sticky;
  top: 0;
}
.sm-table td { padding: 8px 12px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.sm-table tbody tr:hover { background: #f9fafb; }
.sm-table td.num, .sm-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sm-table--compact th, .sm-table--compact td { padding: 6px 10px; }
.sm-table tfoot td { font-weight: 600; border-top: 1px solid #e5e7eb; background: #fbfbfc; }

.sm-kpis { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 8px; }
.sm-kpi {
  min-width: 132px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fcfdfd;
}
.sm-kpi span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.sm-kpi b { display: block; font-size: 17px; margin-top: 2px; color: #0f172a; font-variant-numeric: tabular-nums; }

.sm-note {
  padding: 10px 12px;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  background: #fcfcfd;
  color: #4b5563;
  font-size: 12.5px;
}
.sm-placeholder {
  padding: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: repeating-linear-gradient(135deg, #fbfcfd, #fbfcfd 10px, #f6f8fa 10px, #f6f8fa 20px);
  color: #475569;
  font-size: 12.5px;
}
.sm-placeholder p { margin: 6px 0 0; max-width: 60ch; }

.sm-link { color: #0f766e; font-weight: 600; text-decoration: none; }
.sm-link:hover { text-decoration: underline; }

/* ---------- journal view modes ---------- */
.sm-modes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.sm-modes a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-size: 12.5px;
  color: #374151;
  text-decoration: none;
}
.sm-modes a b { font-variant-numeric: tabular-nums; color: #111827; }
.sm-modes a.is-active { background: #0f766e; border-color: #0f766e; color: #fff; }
.sm-modes a.is-active b { color: #fff; }
.sm-modes .sm-modes__help { margin-left: auto; font-size: 12px; color: #6b7280; }

/* ---------- custom admin pages ---------- */
.sm-page { display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px; }
.sm-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.sm-filters label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; margin-bottom: 4px; }
.sm-filters input, .sm-filters select {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 10px; font-size: 13px; background: #fff; min-width: 150px;
}
.sm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
  border: 1px solid #d1d5db; background: #fff; color: #111827; cursor: pointer; text-decoration: none;
}
.sm-btn--primary { background: #0f766e; border-color: #0f766e; color: #fff; }
.sm-btn--ghost { border-style: dashed; }
.sm-btn:hover { filter: brightness(.97); }

.sm-aging td.num { font-variant-numeric: tabular-nums; }
.sm-aging .sm-aging__overdue { color: #b91c1c; font-weight: 600; }

/* dashboard */
.sm-grid { display: grid; gap: 14px; }
.sm-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sm-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sm-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .sm-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sm-grid--2, .sm-grid--3 { grid-template-columns: 1fr; } }

.sm-stat { padding: 14px 16px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; }
.sm-stat span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.sm-stat b { display: block; font-size: 22px; margin-top: 4px; color: #0f172a; font-variant-numeric: tabular-nums; }
.sm-stat small { color: #6b7280; font-size: 11.5px; }

.sm-bars { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.sm-bar { display: grid; grid-template-columns: 110px 1fr 62px; align-items: center; gap: 10px; font-size: 12.5px; }
.sm-bar__track { height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.sm-bar__fill { height: 100%; background: #0f766e; border-radius: 999px; }
.sm-bar__value { text-align: right; font-variant-numeric: tabular-nums; color: #334155; }

.sm-chart { display: flex; align-items: flex-end; gap: 18px; height: 160px; padding: 16px; }
.sm-chart__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.sm-chart__bar { width: 100%; background: linear-gradient(180deg, #14b8a6, #0f766e); border-radius: 6px 6px 0 0; min-height: 3px; }
.sm-chart__label { font-size: 11px; color: #6b7280; }
.sm-chart__value { font-size: 11px; color: #0f172a; font-variant-numeric: tabular-nums; }

/* ---------- client cabinet (кабинет) ---------- */
.portal-body { background: #f6f8f9; min-height: 100vh; }
.portal-shell { max-width: 1180px; margin: 0 auto; padding: 0 20px 48px; }
.portal-top {
  background: #fff; border-bottom: 1px solid #e5e7eb; margin-bottom: 22px;
}
.portal-top__inner {
  max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 60px;
  display: flex; align-items: center; gap: 18px;
}
.portal-brand { font-weight: 700; font-size: 15px; color: #0f172a; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.portal-brand em { font-style: normal; font-size: 11px; font-weight: 500; color: #0f766e; background: #ecfdf5; border: 1px solid #a7f3d0; padding: 1px 7px; border-radius: 999px; }
.portal-nav { display: flex; gap: 4px; margin-left: 12px; }
.portal-nav a { padding: 6px 10px; border-radius: 8px; font-size: 13px; color: #334155; text-decoration: none; }
.portal-nav a:hover { background: #f1f5f9; }
.portal-nav a.is-active { background: #ecfdf5; color: #0f766e; font-weight: 600; }
.portal-user { margin-left: auto; font-size: 12.5px; color: #475569; display: flex; align-items: center; gap: 10px; }
.portal-h1 { font-size: 21px; font-weight: 650; color: #0f172a; margin: 0 0 4px; }
.portal-sub { font-size: 13px; color: #64748b; margin: 0 0 18px; }

.portal-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .portal-cards { grid-template-columns: 1fr; } }

.portal-form { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .portal-form { grid-template-columns: 1fr; } }
.portal-field { margin-bottom: 14px; }
.portal-field label { display: block; font-size: 12px; font-weight: 500; color: #334155; margin-bottom: 5px; }
.portal-field input, .portal-field select, .portal-field textarea {
  width: 100%; border: 1px solid #d1d5db; border-radius: 9px; padding: 8px 11px; font-size: 13.5px; background: #fff;
}
.portal-field .hint { font-size: 11.5px; color: #94a3b8; margin-top: 4px; }
.portal-field .req { color: #dc2626; }
.portal-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .portal-grid2 { grid-template-columns: 1fr; } }

.portal-drop {
  border: 1.5px dashed #94a3b8; border-radius: 12px; padding: 18px; text-align: center;
  color: #475569; font-size: 13px; background: #fbfcfd;
}
.portal-drop b { display: block; color: #0f172a; margin-bottom: 4px; }

.portal-side { position: sticky; top: 16px; }
.portal-price { font-size: 26px; font-weight: 650; color: #0f172a; font-variant-numeric: tabular-nums; }
.portal-price small { font-size: 12px; color: #64748b; font-weight: 400; display: block; }
.portal-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed #e5e7eb; }
.portal-row:last-child { border-bottom: 0; }
.portal-row span { color: #64748b; }
.portal-row b { font-variant-numeric: tabular-nums; }

.portal-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.portal-step {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid #e5e7eb; background: #fff; font-size: 12px; color: #94a3b8;
}
.portal-step.is-done { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.portal-step.is-current { border-color: #0f766e; background: #0f766e; color: #fff; }

.portal-timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid #e2e8f0; }
.portal-timeline li { position: relative; padding: 0 0 16px 14px; font-size: 13px; }
.portal-timeline li::before {
  content: ""; position: absolute; left: -25px; top: 3px; width: 9px; height: 9px; border-radius: 999px;
  background: #cbd5e1; border: 2px solid #fff;
}
.portal-timeline li.is-done::before { background: #0f766e; }
.portal-timeline .when { display: block; font-size: 11.5px; color: #94a3b8; }

.portal-status { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; }
.portal-status--received { background: #f1f5f9; color: #475569; }
.portal-status--production { background: #eff6ff; color: #1d4ed8; }
.portal-status--shipped { background: #fff7ed; color: #c2410c; }
.portal-status--delivered { background: #ecfdf5; color: #047857; }

.sm-badge-src { font-size: 11px; color: #64748b; }

/* ---------- narrow screens: data tables scroll, they never crush ---------- */
@media (max-width: 900px) {
  #changelist-form { overflow-x: auto; }
  #changelist-form table { min-width: 940px; }
  .sm-card { overflow-x: auto; }
  .sm-card > .sm-table { min-width: 680px; }
  .sm-table { min-width: 520px; }
  .sm-page > .sm-card > table { min-width: 680px; }
  .sm-bar { grid-template-columns: 88px 1fr 56px; }
  .sm-grid--4 { grid-template-columns: 1fr; }
  .portal-form { grid-template-columns: 1fr; }
  .portal-nav { overflow-x: auto; }
}

.sm-cellsub { font-size: 11.5px; color: #6b7280; margin-top: 1px; white-space: nowrap; }

/* ---------- design pass 23.11: journal density and numbers ---------- */
/* long client names: one line with a clip, the full name is in the tooltip */
.sm-clip { display: block; max-width: 126px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-clip--work { max-width: 150px; }
.sm-nowrap { white-space: nowrap; }
/* dates: MM/DD/YYYY on one line in every list (Journal, Invoices, Payments, Cases, History) */
#result_list :is(
  td.field-date, th.column-date,
  td.field-date_col, th.column-date_col,
  td.field-ready_col, th.column-ready_col,
  td.field-period_col, th.column-period_col,
  td.field-paid_on_display, th.column-paid_on_display,
  td.field-created_at, th.column-created_at,
  td.field-changed_at, th.column-changed_at,
  td.field-started_at, th.column-started_at
) { white-space: nowrap; }
/* the journal has to fit 1440 without a horizontal scroll: tighter cells */
#result_list th, #result_list td { padding-left: 8px; padding-right: 8px; }
/* two-line cells (case/patient, work/options) sit inside the Unfold 45px row */
#result_list .sm-cellsub { line-height: 1; margin-top: 0; }
/* same 45px density as the Unfold table component inside cards */
#result_list td { padding-top: 2px; padding-bottom: 2px; }
#result_list td .sm-chip { line-height: 16px; padding-top: 1px; padding-bottom: 1px; }

/* money and counts: right-aligned, tabular figures, one currency format */
#result_list :is(
  td.field-qty, th.column-qty,
  td.field-price_col, th.column-price_col,
  td.field-total_col, th.column-total_col,
  td.field-paid_display, th.column-paid_display,
  td.field-balance_display, th.column-balance_display,
  td.field-amount_display, th.column-amount_display,
  td.field-cost_display, th.column-cost_display,
  td.field-price_display, th.column-price_display,
  td.field-fixed_price_display, th.column-fixed_price_display,
  td.field-discount_display, th.column-discount_display,
  td.field-open_balance, th.column-open_balance,
  td.field-total_display, th.column-total_display,
  td.field-days, th.column-days,
  td.field-days_open_col, th.column-days_open_col,
  td.field-days_openn, th.column-days_openn,
  td.field-rows_total, th.column-rows_total,
  td.field-cases_created, th.column-cases_created,
  td.field-jobs_created, th.column-jobs_created,
  td.field-jobs_count, th.column-jobs_count,
  td.field-cases_count, th.column-cases_count,
  td.field-conflicts, th.column-conflicts,
  td.field-surcharge_pct, th.column-surcharge_pct,
  td.field-rush_pct, th.column-rush_pct,
  td.field-priority, th.column-priority,
  td.field-sort_order, th.column-sort_order,
  td.field-rows_count, th.column-rows_count
) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* editable numbers in every admin form: right-aligned like the read-only ones */
#content input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }

/* inline job tables inside the case card: keep selects readable */
#job_set-group, .inline-group { overflow-x: auto; }
#job_set-group table, .inline-group table { min-width: 1080px; }
.inline-group select, .inline-group input[type="text"], .inline-group input[type="number"] { min-width: 118px; }

/* price matrix */
.sm-matrix th, .sm-matrix td { border-right: 1px solid #f1f5f9; }
.sm-matrix th:last-child, .sm-matrix td:last-child { border-right: 0; }
.sm-matrix tbody tr:nth-child(even) { background: #fbfcfd; }
.sm-matrix tbody tr:hover { background: #f4f8f8; }
.sm-matrix th { white-space: nowrap; }
.sm-matrix td.num { font-variant-numeric: tabular-nums; }

/* keep the sticky save bar from covering stacked inline cards */
body.change-form #content { padding-bottom: 96px; }

/* ---------- custom Unfold pages: page header, KPI, notes, forms ----------
   Unfold ships a compiled Tailwind build, so arbitrary values (text-[11px])
   and responsive prefixes are not available here — these classes cover them. */
.sm-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.sm-pretitle { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.sm-h1 { font-size: 20px; font-weight: 600; color: #0f172a; margin: 2px 0 0; }
.sm-lede { font-size: 13px; color: #6b7280; margin: 4px 0 0; max-width: 95ch; }
.sm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sm-toolbar form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.sm-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.sm-kpi-num { font-size: 21px; font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; margin-top: 2px; }
.sm-kpi-hint { font-size: 11.5px; color: #6b7280; margin-top: 2px; }
.sm-sub { font-size: 11.5px; color: #64748b; }
.sm-muted { color: #9ca3af; }
.sm-danger { color: #b91c1c; font-weight: 600; }
.sm-warn {
  border: 1px solid #fcd34d; border-radius: 8px; background: #fffbeb; color: #92400e;
  padding: 8px 12px; font-size: 12.5px;
}
.sm-form { display: flex; flex-direction: column; gap: 12px; }
.sm-form label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; margin-bottom: 4px; }
.sm-form input, .sm-form select, .sm-form textarea {
  width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; font-size: 13px; background: #fff;
}
.sm-form .errorlist { color: #b91c1c; font-size: 12px; margin: 4px 0 0; padding: 0; list-style: none; }
.sm-links { font-size: 12.5px; }
.sm-links a { color: #0f766e; font-weight: 600; text-decoration: none; }
.sm-links a:hover { text-decoration: underline; }

/* price rules list and role menu lists */
.sm-rules { list-style: decimal; padding-left: 20px; margin: 0; color: #4b5563; font-size: 12.5px; line-height: 1.65; }
.sm-rules li { margin-bottom: 4px; }
.sm-menulist { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 18px; font-size: 12.5px; color: #374151; }
.sm-menulist li { padding: 3px 0; break-inside: avoid; }
.sm-menulist li::before { content: "·"; color: #0f766e; font-weight: 700; margin-right: 6px; }

/* custom pages on a phone: wide data tables scroll inside the card instead of crushing */
@media (max-width: 900px) {
  .sm-page .overflow-x-auto { -webkit-overflow-scrolling: touch; }
  .sm-page table { min-width: 680px; }
}

/* read-only value rows on custom pages (editing lives in the standard admin card) */
.sm-readonly { display: flex; flex-wrap: wrap; gap: 24px; }
.sm-readonly span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.sm-readonly b { display: block; font-size: 15px; color: #0f172a; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- client cabinet 23.11: the same system as the staff side ----------
   The portal does not load Unfold's compiled Tailwind, so the few utility
   classes the portal templates use are defined here, scoped to .portal-body. */
.portal-body .p-4 { padding: 16px; }
.portal-body .p-6 { padding: 24px; }
.portal-body .px-4 { padding-left: 16px; padding-right: 16px; }
.portal-body .py-3 { padding-top: 12px; padding-bottom: 12px; }
.portal-body .mt-0 { margin-top: 0; }
.portal-body .mt-1 { margin-top: 4px; }
.portal-body .mt-2 { margin-top: 8px; }
.portal-body .mt-3 { margin-top: 12px; }
.portal-body .mt-4 { margin-top: 16px; }
.portal-body .mb-2 { margin-bottom: 8px; }
.portal-body .mb-3 { margin-bottom: 12px; }
.portal-body .mb-4 { margin-bottom: 16px; }
.portal-body .flex { display: flex; }
.portal-body .flex-wrap { flex-wrap: wrap; }
.portal-body .items-center { align-items: center; }
.portal-body .items-start { align-items: flex-start; }
.portal-body .justify-between { justify-content: space-between; }
.portal-body .gap-2 { gap: 8px; }
.portal-body .gap-3 { gap: 12px; }
.portal-body .gap-4 { gap: 16px; }
.portal-body .text-base-500 { color: #6b7280; }
.portal-body .text-base-600 { color: #4b5563; }
.portal-body .text-\[11\.5px\] { font-size: 11.5px; }
.portal-body .text-\[12px\] { font-size: 12px; }
.portal-body .text-\[12\.5px\] { font-size: 12.5px; }
.portal-body .text-\[13px\] { font-size: 13px; }
.portal-body .text-\[26px\] { font-size: 26px; line-height: 1.1; }
.portal-body .whitespace-nowrap { white-space: nowrap; }

/* client statuses use the journal's own chip palette */
.sm-chip--status-received   { background: #f3f4f6; color: #374151; border-color: #e5e7eb; }
.sm-chip--status-production { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.sm-chip--status-shipped    { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.sm-chip--status-delivered  { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }

/* headings and copy follow the staff pages */
.portal-h1 { font-size: 20px; font-weight: 600; color: #0f172a; margin: 0 0 4px; }
.portal-sub { font-size: 13px; color: #6b7280; margin: 0 0 16px; max-width: 95ch; }
.portal-price small { color: #6b7280; }

/* a card with a body: the content sits 16px inside, like Unfold's own cards */
.portal-card { padding: 16px; }
.portal-card > * + * { margin-top: 12px; }
.portal-cardlink { display: inline-block; margin-top: 10px; font-size: 12.5px; }
.portal-money { font-variant-numeric: tabular-nums; }

/* tables inside cards: numbers right, dates on one line */
.portal-body .sm-table td.num, .portal-body .sm-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.portal-body .sm-table td.is-date { white-space: nowrap; }

/* keep a wide table inside its card on a phone, never the page */
@media (max-width: 900px) {
  .portal-body { overflow-x: hidden; }
  .portal-top__inner { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 8px; }
  .portal-nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .portal-nav a { white-space: nowrap; }
  .portal-shell { padding: 0 14px 40px; }
  .portal-cards { gap: 12px; }
  .portal-body .sm-card { overflow-x: auto; }
  .portal-body .sm-table { min-width: 560px; }
  .portal-h1 { font-size: 18px; }
}
@media (max-width: 480px) {
  .portal-user { width: 100%; margin-left: 0; justify-content: space-between; }
  .portal-top__inner { gap: 8px; }
}

/* long <select> options must not stretch the form past the phone width */
.portal-body .portal-field select,
.portal-body .portal-field input,
.portal-body .portal-field textarea { max-width: 100%; min-width: 0; }
.portal-body .portal-form > *,
.portal-body .portal-cards > * { min-width: 0; }
.portal-body .sm-card { max-width: 100%; }

/* the portal has no Tailwind preflight: without border-box the 100%-wide fields
   plus their padding stick out of the card on a phone (Patient, Comment, Qty, date) */
.portal-body *, .portal-body *::before, .portal-body *::after { box-sizing: border-box; }

/* decision 23.11: a small "Stage 2 (preview)" mark in the cabinet header, not a banner */
.portal-preview {
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: #6b7280; border: 1px solid #e5e7eb; background: #f9fafb;
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
