/*
 * Airglove Medical orders. Layout follows the MARIS app (Tailwind slate palette, white cards with a
 * slate-200 border and small shadow); branding follows airglovemedical.com: Airglove blue #1426fc,
 * slate-ink #3b4251 headings, Raleway headings, Open Sans body, white header with the logo.
 * Hand-written so the app needs no build step.
 */
:root {
  --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0; --slate-300: #cbd5e1;
  --slate-400: #94a3b8; --slate-500: #64748b; --slate-600: #475569; --slate-700: #334155;
  --slate-800: #1e293b; --slate-900: #0f172a;

  /* Airglove blue (#1426fc, from airglovemedical.com) and its tints/shades. */
  --brand-50: #eef0ff; --brand-100: #e0e3ff; --brand-200: #c3c9ff; --brand-300: #99a3fe;
  --brand-400: #6672fd; --brand-500: #3a4afc; --brand-600: #1426fc; --brand-700: #0f1dd6;
  --brand-800: #1219a8; --brand-900: #151b80;
  /* Heading ink from the site. */
  --ink: #3b4251;
  --font-head: Raleway, "Open Sans", Arial, sans-serif;


  --red-50: #fef2f2; --red-200: #fecaca; --red-500: #ef4444; --red-600: #dc2626; --red-700: #b91c1c; --red-800: #991b1b;
  --amber-50: #fffbeb; --amber-200: #fde68a; --amber-400: #fbbf24; --amber-600: #d97706; --amber-700: #b45309; --amber-800: #92400e;
  --violet-50: #f5f3ff; --violet-200: #ddd6fe; --violet-300: #c4b5fd; --violet-500: #8b5cf6; --violet-600: #7c3aed; --violet-700: #6d28d9; --violet-800: #5b21b6;
  --emerald-50: #ecfdf5; --emerald-200: #a7f3d0; --emerald-500: #10b981; --emerald-700: #047857; --emerald-800: #065f46;

  --radius: 0.5rem; --radius-md: 0.375rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --ring: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--slate-100); color: var(--slate-900);
  font: 400 0.875rem/1.5 "Open Sans", Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-600); text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-md); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.icon { width: 1.5rem; height: 1.5rem; flex-shrink: 0; }
.icon-sm { width: 1rem; height: 1rem; flex-shrink: 0; }
.icon-xs { width: 0.875rem; height: 0.875rem; flex-shrink: 0; }

.container { max-width: 80rem; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }
@media (min-width: 640px) { .container { padding-left: 1.5rem; padding-right: 1.5rem; } }
@media (min-width: 1024px) { .container { padding-left: 2rem; padding-right: 2rem; } }
.content { padding-top: 2rem; padding-bottom: 3rem; display: grid; gap: 1.5rem; }

.muted { color: var(--slate-500); }
.faint { color: var(--slate-400); }
.strong { font-weight: 600; color: var(--slate-900); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.with-icon { display: flex; align-items: center; gap: 0.375rem; }
.with-icon .icon-xs { color: var(--slate-400); }
.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 1.5rem; align-content: start; }
.self-start { align-self: start; }
.narrow { max-width: 42rem; }

/* ---------- top nav: white with the Airglove Medical logo, as airglovemedical.com ---------- */
.topnav { background: #fff; border-bottom: 1px solid var(--slate-200); }
.topnav-inner { display: flex; justify-content: space-between; align-items: stretch; height: 4.5rem; }
.topnav-left { display: flex; align-items: stretch; min-width: 0; }
.logo { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo img { height: 3rem; width: auto; display: block; }
.logo-sub { font-family: var(--font-head); font-weight: 600; font-size: 0.8125rem; color: var(--slate-500); padding-left: 0.75rem; border-left: 1px solid var(--slate-200); line-height: 1.75rem; white-space: nowrap; }
.navlinks { display: flex; gap: 1.75rem; margin-left: 2.25rem; }
.navlink {
  display: inline-flex; align-items: center; padding: 0.25rem 0.125rem 0; border-bottom: 2px solid transparent;
  color: var(--ink); font-family: var(--font-head); font-weight: 600; font-size: 0.9375rem; transition: color .15s, border-color .15s;
}
.navlink:hover { color: var(--brand-600); text-decoration: none; }
.navlink[aria-current] { color: var(--brand-600); border-bottom-color: var(--brand-600); }
.navlink-mobile { display: none; }
.usermenu { position: relative; align-self: center; }
.usermenu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.5rem 0.75rem; border-radius: var(--radius-md); color: var(--ink); font-weight: 600;
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover, .usermenu[open] summary { color: var(--brand-600); background: var(--slate-50); }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 40; min-width: 12rem; padding: 0.25rem 0;
  background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); border: 1px solid var(--slate-200);
}
.dropdown a { display: block; padding: 0.5rem 1rem; color: var(--slate-700); }
.dropdown a:hover { background: var(--slate-100); text-decoration: none; color: var(--slate-900); }
.hamburger { display: none; align-self: center; background: none; border: 0; padding: 0.5rem; border-radius: var(--radius-md); color: var(--ink); cursor: pointer; }
.hamburger:hover { color: var(--brand-600); background: var(--slate-100); }

/* ---------- white page heading bar ---------- */
.pagehead { background: #fff; border-bottom: 1px solid var(--slate-200); }
.pagehead-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.pagehead h1 { font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; color: var(--slate-900); display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.crumbs { margin-top: 0.25rem; color: var(--slate-500); }
.crumbs a { color: var(--slate-500); }
.crumbs a:hover { color: var(--slate-700); text-decoration: none; }
.crumbs .sep { color: var(--slate-400); margin: 0 0.25rem; }
.pagehead-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- alerts ---------- */
.flash-wrap { padding-top: 1rem; }
.alert { display: flex; align-items: flex-start; gap: 0.75rem; border: 1px solid; border-radius: var(--radius); padding: 0.75rem 1rem; font-weight: 500; }
.alert-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.alert-success { border-color: var(--emerald-200); background: var(--emerald-50); color: var(--emerald-800); }
.alert-success .alert-icon { color: var(--emerald-500); }
.alert-error { border-color: var(--red-200); background: var(--red-50); color: var(--red-800); }
.alert-error .alert-icon { color: var(--red-500); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; white-space: nowrap;
  border-radius: var(--radius-md); padding: 0.5rem 0.875rem; font-size: 0.875rem; font-weight: 600; line-height: 1.25rem;
  border: 0; cursor: pointer; text-decoration: none; transition: background-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-500); color: #fff; }
.btn-primary:active { background: var(--brand-700); }
.btn-secondary { background: #fff; color: var(--slate-700); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--slate-300); }
.btn-secondary:hover { background: var(--slate-50); color: var(--slate-700); }
.btn-danger { background: var(--red-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: var(--red-500); color: #fff; }
.btn-link { background: none; color: var(--slate-500); padding-left: 0.25rem; padding-right: 0.25rem; }
.btn-link:hover { color: var(--slate-700); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.375rem 0.5rem; }
.btn-text { background: none; border: 0; padding: 0; cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--brand-700); display: inline-flex; align-items: center; gap: 0.375rem; }
.btn-text:hover { color: var(--brand-600); }
.btn-text.danger { color: var(--red-600); }
.btn-text.danger:hover { color: var(--red-700); }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 500; color: var(--brand-700); }
.linkbtn:hover { text-decoration: underline; }
.iconbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 1.875rem; height: 1.875rem;
  border-radius: var(--radius-md); border: 0; background: transparent; color: var(--slate-400); cursor: pointer;
}
.iconbtn:hover { background: var(--slate-100); color: var(--slate-700); }
.iconbtn.danger:hover { background: var(--red-50); color: var(--red-600); }
.iconbtn .dot { position: absolute; top: 0.3rem; right: 0.3rem; width: 0.375rem; height: 0.375rem; border-radius: 999px; background: var(--brand-500); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 999px; padding: 0.125rem 0.625rem; font-size: 0.75rem; font-weight: 500; line-height: 1rem; }
.badge-red { background: var(--red-50); color: var(--red-700); box-shadow: inset 0 0 0 1px var(--red-200); }
.badge-amber { background: var(--amber-50); color: var(--amber-800); box-shadow: inset 0 0 0 1px var(--amber-200); }
.badge-green { background: var(--emerald-50); color: var(--emerald-700); box-shadow: inset 0 0 0 1px var(--emerald-200); }
.badge-brand { background: var(--brand-50); color: var(--brand-700); box-shadow: inset 0 0 0 1px var(--brand-200); }
.badge-violet { background: var(--violet-50); color: var(--violet-700); box-shadow: inset 0 0 0 1px var(--violet-200); }
.badge-slate { background: var(--slate-100); color: var(--slate-600); box-shadow: inset 0 0 0 1px var(--slate-200); }
.owner { display: inline-flex; align-items: center; border-radius: var(--radius-md); background: var(--slate-100); color: var(--slate-600); font-size: 0.6875rem; font-weight: 600; padding: 0.0625rem 0.375rem; letter-spacing: 0.02em; }

/* ---------- cards ---------- */
.card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--slate-200); }
.card-head h2 { font-size: 1rem; font-weight: 600; color: var(--slate-900); }
.card-head .count { font-weight: 400; color: var(--slate-400); }
.card-head-wrap { flex-wrap: wrap; }
.card-body { padding: 1.25rem; }
.card-foot { padding: 0.75rem 1.25rem; border-top: 1px solid var(--slate-200); background: var(--slate-50); }
.empty { padding: 3rem 1.25rem; text-align: center; color: var(--slate-500); }
.empty-sm { padding: 1.5rem 1.25rem; }
.empty-icon { width: 2.5rem; height: 2.5rem; color: var(--slate-300); margin: 0 auto 0.75rem; display: block; }
.empty a, .empty .linkbtn { font-weight: 500; }

/* ---------- stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.stat {
  display: grid; gap: 0.25rem; padding: 1rem 1.25rem; background: #fff; color: inherit;
  border: 1px solid var(--slate-200); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--slate-300); transition: box-shadow .15s;
}
.stat:hover { text-decoration: none; color: inherit; box-shadow: var(--shadow-sm), 0 0 0 2px rgb(84 101 186 / 0.35); }
.stat.is-active { box-shadow: 0 0 0 2px var(--brand-500); }
.stat-red { border-top-color: var(--red-500); }
.stat-amber { border-top-color: var(--amber-400); }
.stat-brand { border-top-color: var(--brand-500); }
.stat-violet { border-top-color: var(--violet-500); }
.stat-green { border-top-color: var(--emerald-500); }
.stat-label { font-size: 0.875rem; font-weight: 500; color: var(--slate-500); }
.stat-value { font-size: 1.5rem; line-height: 2rem; font-weight: 600; color: var(--slate-900); font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 0.875rem; font-weight: 400; color: var(--slate-400); }
.stat-red .stat-value { color: var(--red-700); }
.stat-hint { font-size: 0.8125rem; color: var(--slate-500); }

/* ---------- segmented controls (as the MARIS dashboard layout toggle) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.segmented { display: inline-flex; border-radius: var(--radius-md); background: var(--slate-100); padding: 0.125rem; }
.segmented a { border-radius: 0.25rem; padding: 0.375rem 0.75rem; font-weight: 500; color: var(--slate-500); }
.segmented a:hover { color: var(--slate-700); text-decoration: none; }
.segmented a[aria-current] { background: #fff; color: var(--slate-900); box-shadow: var(--shadow-sm); }
.monthnav { display: flex; gap: 0.375rem; }
.segmented-lg a { padding: 0.4375rem 0.875rem; }
.pagehead-actions { align-items: center; }

/* ---------- order timeline (months across, clients down) ---------- */
.timeline-wrap { overflow-x: auto; }
.timeline { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 60rem; font-size: 0.8125rem; }
.timeline th, .timeline td { border-bottom: 1px solid var(--slate-100); }
.timeline thead th {
  background: var(--slate-50); border-bottom: 1px solid var(--slate-200); padding: 0.625rem 0.25rem;
  font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-500); text-align: center;
}
.timeline thead th span { display: block; font-size: 0.6875rem; letter-spacing: 0; text-transform: none; color: var(--slate-400); font-weight: 400; }
.timeline thead th.tl-client { text-align: left; padding-left: 1.25rem; vertical-align: bottom; }
.timeline .tl-client {
  position: sticky; left: 0; z-index: 1; background: #fff; width: 20rem; min-width: 16rem; max-width: 20rem;
  border-right: 1px solid var(--slate-200); text-align: left; font-weight: 400;
}
.timeline thead .tl-client { background: var(--slate-50); z-index: 2; }
.tl-client-inner { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.5rem 0.5rem 1.25rem; }
.tl-name { min-width: 0; flex: 1; }
.tl-name a { display: block; font-size: 0.875rem; font-weight: 500; color: var(--slate-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-name a:hover { color: var(--brand-700); }
.tl-meta { display: flex; align-items: center; gap: 0.375rem; margin-top: 0.25rem; }
.tl-actions { display: flex; opacity: 0.55; transition: opacity .15s; }
.timeline tbody tr:hover .tl-actions, .tl-actions:focus-within { opacity: 1; }
.timeline tbody tr:hover > * { background-color: var(--slate-50); }
.tl-month { min-width: 4.25rem; }
.tl-cell { text-align: center; padding: 0.375rem 0.25rem; vertical-align: middle; font-variant-numeric: tabular-nums; }
.tl-cell .chip + .chip { margin-top: 0.25rem; }
.timeline .is-now { background: var(--brand-50); }
.timeline thead th.is-now { background: var(--brand-100); color: var(--brand-800); }
.timeline thead th.is-now span { color: var(--brand-700); }
.timeline tbody tr:hover > .is-now { background: var(--brand-100); }
.timeline .is-jan { border-left: 1px dashed var(--slate-300); }
.timeline tfoot th, .timeline tfoot td { background: var(--slate-50); font-weight: 600; color: var(--slate-700); padding-top: 0.5rem; padding-bottom: 0.5rem; border-bottom: 0; border-top: 1px solid var(--slate-200); }
.timeline tfoot tr + tr th, .timeline tfoot tr + tr td { border-top: 0; color: var(--brand-700); }
.timeline tfoot th.tl-client { padding-left: 1.25rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-500); font-weight: 500; }
.timeline tfoot .is-now { background: var(--brand-100); }
.timeline tfoot tr.tf-opps th, .timeline tfoot tr.tf-opps td, .timeline tfoot tr.tf-opps th.tl-client { color: var(--violet-700); }
.timeline tbody tr.row-quiet .tl-name a { color: var(--slate-500); }

.chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: 3rem; padding: 0.1875rem 0.5rem;
  border-radius: var(--radius-md); font-size: 0.8125rem; font-weight: 600; line-height: 1.125rem; border: 0;
  font-variant-numeric: tabular-nums; cursor: default;
}
button.chip { cursor: pointer; transition: transform .1s, box-shadow .1s; }
button.chip:hover { transform: translateY(-1px); }
.chip-actual { background: var(--brand-600); color: #fff; }
.chip-expected { background: #fff; color: var(--brand-700); box-shadow: inset 0 0 0 1.5px var(--brand-300); }
.chip-soon { background: var(--amber-50); color: var(--amber-800); box-shadow: inset 0 0 0 1.5px var(--amber-400); }
.chip-overdue { background: var(--red-600); color: #fff; }
.chip-units { background: var(--emerald-50); color: var(--emerald-800); box-shadow: inset 0 0 0 1px var(--emerald-200); font-weight: 600; }
a.chip { text-decoration: none; transition: transform .1s; }
a.chip:hover { transform: translateY(-1px); text-decoration: none; }
.chip-opp { background: var(--violet-50); color: var(--violet-700); box-shadow: inset 0 0 0 1.5px var(--violet-300); background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgb(139 92 246 / 0.08) 6px 9px); }
.chip-opp:hover { color: var(--violet-800); }
.chip-opp.is-late { background: var(--violet-600); color: #fff; box-shadow: none; }
.chip-quiet { background: var(--slate-100); color: var(--slate-500); box-shadow: inset 0 0 0 1px var(--slate-300); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; color: var(--slate-500); font-size: 0.8125rem; }
.legend > span { display: inline-flex; align-items: center; gap: 0.5rem; }
.legend .chip { min-width: 2.5rem; font-size: 0.75rem; padding: 0.0625rem 0.375rem; }
.legend > .legend-note { display: block; margin-left: auto; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table thead { background: var(--slate-50); }
.table th { padding: 0.75rem 1.25rem; text-align: left; font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-500); border-bottom: 1px solid var(--slate-200); white-space: nowrap; }
.table td { padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--slate-100); color: var(--slate-700); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--slate-50); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.actions-cell { text-align: right; width: 1%; padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }

/* ---------- forms ---------- */
.field { display: grid; gap: 0.25rem; align-content: start; }
.field label, .divider-label { font-size: 0.875rem; font-weight: 500; color: var(--slate-700); }
.field.grow { flex: 1; min-width: 12rem; }
.field-narrow { max-width: 12rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=search], input[type=password], select, textarea {
  width: 100%; border: 1px solid var(--slate-300); border-radius: var(--radius-md); background: #fff; color: var(--slate-900);
  font: inherit; font-size: 0.875rem; padding: 0.5rem 0.75rem; min-height: 2.375rem; box-shadow: var(--shadow-sm);
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 2rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E") right 0.5rem center / 1.25rem no-repeat;
}
textarea { resize: vertical; }
::placeholder { color: var(--slate-400); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 1px var(--brand-500); }
.help { font-size: 0.8125rem; color: var(--slate-500); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.inline-fields { display: flex; gap: 0.5rem; }
.inline-fields select { width: auto; }
.w-20 { width: 5rem !important; }
.affix { position: relative; }
.affix span { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--slate-400); }
.affix input { padding-left: 1.75rem; }
.no-spinner { -moz-appearance: textfield; }
.no-spinner::-webkit-outer-spin-button, .no-spinner::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.divider-label { display: flex; align-items: center; gap: 0.75rem; padding-top: 0.5rem; font-weight: 600; color: var(--slate-900); }
.divider-label::after { content: ""; flex: 1; border-top: 1px solid var(--slate-200); }
.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }
.delete-row { background: #fff; display: flex; justify-content: flex-start; }

.filterbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; padding: 1rem; overflow: visible; }
.filterbar .field:not(.grow) { width: 10rem; }
.clear-link { color: var(--slate-500); padding-bottom: 0.5rem; }
.clear-link:hover { color: var(--slate-700); }
.filter-note { margin-top: -0.75rem; }

/* ---------- clients grid ---------- */
.client-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.client-card { position: relative; display: flex; flex-direction: column; padding: 1.25rem; transition: box-shadow .15s; }
.client-card:hover { box-shadow: var(--shadow-sm), 0 0 0 2px rgb(84 101 186 / 0.4); }
.client-card.is-inactive { opacity: 0.75; }
.client-card-top { display: flex; align-items: flex-start; gap: 0.75rem; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 2.5rem; height: 2.5rem; border-radius: var(--radius); background: var(--brand-900); color: #fff; font-size: 0.875rem; font-weight: 600; }
.avatar-sm { width: 2rem; height: 2rem; font-size: 0.6875rem; border-radius: 999px; background: var(--brand-100); color: var(--brand-800); }
.client-card-name { min-width: 0; flex: 1; }
.client-card-name a { display: block; font-weight: 600; color: var(--slate-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-card-name a:hover { color: var(--brand-700); text-decoration: none; }
.client-card-name p { font-size: 0.75rem; color: var(--slate-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stretched::after { content: ""; position: absolute; inset: 0; }
.client-card-body { margin-top: 1rem; display: grid; gap: 0.375rem; min-height: 4rem; align-content: start; color: var(--slate-500); }
.client-card-body .strong { font-weight: 400; color: var(--slate-700); }
.client-card-foot { margin-top: auto; padding-top: 0.75rem; border-top: 1px solid var(--slate-100); display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; font-size: 0.75rem; color: var(--slate-500); }
.client-card-foot > span { white-space: nowrap; }
.client-card-foot .push { margin-left: auto; }
.client-card-body { margin-bottom: 1rem; }

/* ---------- client page ---------- */
.client-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; }
.dl { display: grid; gap: 1rem; margin: 0; }
.dl dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-400); }
.dl dd { margin: 0.125rem 0 0; color: var(--slate-900); display: grid; gap: 0.25rem; }
.dl dd a.with-icon { color: var(--brand-700); }
.dl-split { border-top: 1px solid var(--slate-200); padding-top: 1rem; display: grid; gap: 1rem; }
.next-order { border-left: 4px solid var(--brand-500); }
.next-overdue { border-left-color: var(--red-500); }
.next-soon { border-left-color: var(--amber-400); }
.next-quiet, .next-inactive, .next-none { border-left-color: var(--slate-300); }
.next-order-body { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.eyebrow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-400); }
.next-date { font-size: 1.25rem; font-weight: 600; color: var(--slate-900); margin: 0.125rem 0 0.25rem; }
.next-overdue .next-date { color: var(--red-700); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 0.75rem; align-items: flex-start; padding: 1rem 1.25rem; border-bottom: 1px solid var(--slate-100); }
.feed li:last-child { border-bottom: 0; }
.feed-body { flex: 1; min-width: 0; color: var(--slate-700); }
.feed-meta { font-size: 0.8125rem; margin-bottom: 0.125rem; }
.feed-meta strong { color: var(--slate-900); font-weight: 600; }
.feed-meta span { color: var(--slate-400); margin-left: 0.25rem; }

/* ---------- modals (as MARIS x-modal) ---------- */
.modal {
  border: 0; padding: 0; border-radius: var(--radius); box-shadow: var(--shadow-xl); color: var(--slate-900);
  width: min(36rem, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); overflow: auto;
}
.modal-sm { width: min(28rem, calc(100vw - 2rem)); }
.modal::backdrop { background: rgb(15 23 42 / 0.5); }
.modal[open] { animation: modal-in .2s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(1rem) scale(.98); } }
.modal-head { padding: 1.25rem 1.5rem 0; }
.modal-title { font-size: 1.125rem; font-weight: 600; color: var(--slate-900); }
.modal-sub { margin-top: 0.125rem; color: var(--slate-500); }
.modal-body { padding: 1.25rem 1.5rem; display: grid; gap: 1rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 0.75rem 1.5rem; background: var(--slate-50); border-top: 1px solid var(--slate-200); }
.modal-foot-left { margin-right: auto; }
.confirm { display: flex; gap: 1rem; align-items: flex-start; }
.confirm-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 999px; background: var(--red-50); color: var(--red-600); flex-shrink: 0; }
.confirm-text { margin-top: 0.25rem; color: var(--slate-500); }

/* ---------- login ---------- */
.login { max-width: 24rem; margin: 3rem auto; width: 100%; }
.login-brand { display: flex; justify-content: center; padding: 2rem 1.25rem 0.5rem; }
.login-brand img { width: 11rem; height: auto; display: block; }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .client-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-layout { grid-template-columns: 1fr; }
  .main-col { order: -1; }
}
@media (max-width: 639px) {
  .navlinks { display: none; }
  .navlinks.is-open {
    display: grid; gap: 0; position: absolute; left: 0; right: 0; top: 4.5rem; z-index: 30; margin: 0;
    background: #fff; border-top: 1px solid var(--slate-200); border-bottom: 1px solid var(--slate-200); padding: 0.5rem 0 0.75rem; box-shadow: var(--shadow-lg);
  }
  .navlinks.is-open .navlink { padding: 0.5rem 1rem; border-bottom: 0; border-left: 4px solid transparent; }
  .navlinks.is-open .navlink[aria-current] { border-left-color: var(--brand-600); background: var(--brand-50); }
  .logo-sub { display: none; }
  .logo img { height: 2.5rem; }
  .navlink-mobile { display: inline-flex; }
  .usermenu { display: none; }
  .hamburger { display: inline-flex; }
  .topnav { position: relative; }
  .client-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .timeline .tl-client { width: 12rem; min-width: 12rem; max-width: 12rem; }
  .tl-client-inner { padding-left: 0.75rem; flex-wrap: wrap; }
  .legend-note { margin-left: 0; }
  .filterbar .field:not(.grow) { width: calc(50% - 0.375rem); }
  .pagehead-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; color: var(--slate-700); cursor: pointer; }
.check input { width: 1rem; height: 1rem; accent-color: var(--brand-600); }
form.inline { display: inline; }
.strong-link { font-weight: 500; color: var(--slate-900); }
.strong-link:hover { color: var(--brand-700); }
.note-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--slate-700); }
.actions-cell .btn + .btn, .actions-cell .btn + .iconbtn, .actions-cell form + .iconbtn { margin-left: 0.25rem; }
.actions-cell .iconbtn { vertical-align: middle; }
.minw { min-width: 12rem; }

/* ---------- gloves + units line items ---------- */
.lines { border: 1px solid var(--slate-200); border-radius: var(--radius); overflow: hidden; }
.lines-row { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem 9.5rem; gap: 0.75rem; align-items: center; padding: 0.625rem 0.875rem; border-top: 1px solid var(--slate-100); }
.lines-head { border-top: 0; background: var(--slate-50); padding-top: 0.5rem; padding-bottom: 0.5rem; font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-500); }
.lines-item { display: grid; font-weight: 500; color: var(--slate-900); }
.lines-item small { font-weight: 400; font-size: 0.75rem; color: var(--slate-500); }
.lines-row input[data-qty] { text-align: right; }
.lines-row input[data-val] { text-align: right; }
.lines-total { background: var(--slate-50); font-weight: 600; color: var(--slate-900); }
.lines-total strong { text-align: right; padding-right: 0.75rem; font-variant-numeric: tabular-nums; }
.lines .help { padding: 0 0.875rem 0.625rem; background: var(--slate-50); }
.field-label { font-size: 0.875rem; font-weight: 500; color: var(--slate-700); }
@media (max-width: 639px) {
  .lines-row { grid-template-columns: minmax(0, 1fr) 5.5rem 7.5rem; gap: 0.5rem; }
}

.sub-value { display: block; font-size: 0.75rem; color: var(--slate-500); }
.sub-value.is-est { color: var(--slate-400); }
.breakdown { display: grid; gap: 0.125rem; white-space: nowrap; }
.breakdown em { font-style: normal; color: var(--slate-500); margin-left: 0.25rem; }

/* ---------- searchable picker ---------- */
.combo { position: relative; }
.combo input { padding-right: 2.25rem; }
.combo-caret { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); color: var(--slate-500); cursor: pointer; display: flex; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 0.25rem); margin: 0; padding: 0.25rem 0; list-style: none;
  max-height: 17rem; overflow-y: auto; background: #fff; border: 1px solid var(--slate-300); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
}
.combo-list li { padding: 0.5rem 0.75rem; cursor: pointer; display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--brand-50); }
.combo-list li[aria-selected="true"] .combo-name { color: var(--brand-800); }
.combo-name { color: var(--slate-900); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-name mark { background: none; color: var(--brand-700); font-weight: 600; }
.combo-sub { font-size: 0.75rem; color: var(--slate-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.combo-list li.is-new { border-top: 1px solid var(--slate-100); }
.combo-list li.is-current .combo-name { font-weight: 600; }
.combo-tick { color: var(--brand-600); font-weight: 600; margin-left: auto; }
.combo-sub + .combo-tick { margin-left: 0.5rem; }
.combo-name { flex: 1; }
.combo input { cursor: default; }
.combo input:focus { cursor: text; }
.combo-add { color: var(--brand-700); font-weight: 500; }
.combo-empty { color: var(--slate-500); cursor: default !important; }
.combo-hint.is-new { color: var(--brand-700); font-weight: 500; }

/* ---------- toasts (as the MARIS ajax toasts) ---------- */
.toasts { position: fixed; top: 1rem; right: 1rem; z-index: 60; display: flex; flex-direction: column; gap: 0.75rem; width: min(24rem, calc(100% - 2rem)); pointer-events: none; }
.toast {
  position: relative; overflow: hidden; pointer-events: auto; display: flex; align-items: flex-start; gap: 0.75rem;
  border: 1px solid; border-radius: var(--radius); padding: 0.75rem 0.75rem 0.875rem 1rem; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-0.5rem); transition: opacity .2s ease, transform .2s ease;
}
.toast.is-in { opacity: 1; transform: none; }
.toast.is-leaving { opacity: 0; transform: translateX(1rem); }
.toast-success { border-color: var(--emerald-200); background: var(--emerald-50); color: var(--emerald-800); }
.toast-success .toast-icon { color: var(--emerald-500); }
.toast-error { border-color: var(--red-200); background: var(--red-50); color: var(--red-800); }
.toast-error .toast-icon { color: var(--red-500); }
.toast-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.toast-body { flex: 1; min-width: 0; }
.toast-close { flex-shrink: 0; margin: -0.125rem -0.125rem 0 0; background: none; border: 0; padding: 0.25rem; border-radius: 0.25rem; color: inherit; opacity: 0.6; cursor: pointer; display: flex; }
.toast-close:hover { opacity: 1; }
.toast-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: currentColor; opacity: 0.25; transform-origin: left; }

/* ---------- timeline row header: actions float over the row on hover ---------- */
.timeline .tl-client { width: 19rem; min-width: 19rem; max-width: 19rem; }
.tl-client-inner { position: relative; padding-right: 0.75rem; }
.tl-meta { flex-wrap: nowrap; overflow: hidden; }
.tl-meta .badge { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tl-meta .owner { flex-shrink: 0; }
.tl-actions {
  position: absolute; right: 0.375rem; top: 0.3125rem; gap: 0.125rem; padding: 0 0.125rem 0 2rem;
  opacity: 0; pointer-events: none; background: linear-gradient(to right, rgb(248 250 252 / 0), var(--slate-50) 1.75rem);
  transition: opacity .12s;
}
.timeline tbody tr:hover .tl-actions, .tl-actions:focus-within { opacity: 1; pointer-events: auto; }
.timeline tbody tr:hover .tl-actions { background: linear-gradient(to right, transparent, var(--slate-50) 1.25rem); }
.tl-actions .iconbtn { background: var(--slate-50); }
.tl-actions .iconbtn:hover { background: #fff; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--slate-200); }
@media (hover: none) {
  .tl-actions { position: static; transform: none; opacity: 1; pointer-events: auto; background: none; padding: 0; }
  .tl-client-inner { flex-wrap: wrap; }
}

.modal-lg { width: min(42rem, calc(100vw - 2rem)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 639px) { .form-grid-3 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
.section-help { margin-top: -0.5rem; }

/* Native selects are replaced by .select-btn + .combo-list (see app.js) to match the typed dropdowns. */
.select-native { position: absolute !important; opacity: 0; pointer-events: none; width: 1px !important; height: 1px; min-height: 0 !important; padding: 0 !important; border: 0 !important; bottom: 0; left: 0; }
.select-btn {
  position: relative; display: flex; align-items: center; width: 100%; min-height: 2.375rem; padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  border: 1px solid var(--slate-300); border-radius: var(--radius-md); background: #fff; color: var(--slate-900);
  font: inherit; font-size: 0.875rem; text-align: left; cursor: pointer; box-shadow: var(--shadow-sm);
}
.select-btn:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 1px var(--brand-500); }
.select-btn[aria-expanded="true"] { border-color: var(--brand-500); box-shadow: 0 0 0 1px var(--brand-500); }
.select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-btn .combo-caret { pointer-events: none; }
.inline-fields .combo-select { width: 8rem; }
.combo-list { min-width: 100%; }

/* ---------- contacts ---------- */
.contacts { list-style: none; margin: 0; padding: 0; }
.contacts li { display: flex; gap: 0.75rem; align-items: flex-start; padding: 1rem 1.25rem; border-bottom: 1px solid var(--slate-100); }
.contacts li:last-child { border-bottom: 0; }
.contact-body { flex: 1; min-width: 0; display: grid; gap: 0.125rem; }
.contact-body .with-icon { color: var(--brand-700); min-width: 0; }
.contact-name { font-weight: 600; color: var(--slate-900); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.contact-actions { display: flex; gap: 0.125rem; flex-shrink: 0; }
.small-text { font-size: 0.8125rem; margin-top: 0.25rem; }
.side-col { align-self: start; }

/* ---------- brand typography: Raleway headings in slate-ink, as airglovemedical.com ---------- */
.pagehead h1, .card-head h2, .modal-title, .section-title, .divider-label, .next-date, .login h1 {
  font-family: var(--font-head); color: var(--ink); font-variant-numeric: lining-nums;
}
.pagehead h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.card-head h2 { font-weight: 700; }
.modal-title { font-weight: 700; }
.client-card-name a, .tl-name a, .contact-name { color: var(--ink); }
.avatar { background: var(--ink); }
.pagehead { border-bottom: 1px solid var(--slate-200); }

/* ---------- accounts ---------- */
.dropdown-who { padding: 0.5rem 1rem 0.625rem; margin: 0 0 0.25rem; border-bottom: 1px solid var(--slate-100); font-weight: 600; color: var(--ink); display: grid; }
.dropdown-who span { font-weight: 400; font-size: 0.75rem; color: var(--slate-500); }
.login-title { font-family: var(--font-head); color: var(--ink); font-size: 1.25rem; font-weight: 700; margin-bottom: 0.25rem; }
.field-error { font-size: 0.8125rem; color: var(--red-700); }
.user-cell { display: flex; align-items: center; gap: 0.625rem; }
tr.is-inactive td { color: var(--slate-400); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; background: var(--slate-100); border-radius: 0.25rem; padding: 0.0625rem 0.375rem; }
.temp-card { border-color: var(--amber-200); background: var(--amber-50); }
.temp-title { font-family: var(--font-head); font-weight: 700; color: var(--ink); font-size: 1rem; margin-bottom: 0.25rem; }
.temp-details { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin: 0.75rem 0 0; }
.temp-details dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-500); }
.temp-details dd { margin: 0.25rem 0 0; display: flex; align-items: center; gap: 0.5rem; }
.temp-details code { font-size: 1rem; padding: 0.25rem 0.5rem; background: #fff; box-shadow: inset 0 0 0 1px var(--amber-200); }
.avatar.avatar-sm { background: var(--brand-100); color: var(--brand-800); }

/* ---------- audit log ---------- */
.head-links { display: flex; gap: 1rem; align-items: center; }
.audit-table td { vertical-align: top; }
.audit-who { white-space: nowrap; color: var(--slate-700); }
.audit-what { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; max-width: 46rem; }
.audit-what .badge { flex-shrink: 0; }
.audit-what a { color: var(--slate-900); }
.audit-what a:hover { color: var(--brand-600); }
.audit-details summary { cursor: pointer; color: var(--brand-700); font-weight: 500; white-space: nowrap; }
.audit-details[open] summary { margin-bottom: 0.5rem; }
.audit-details { min-width: 7rem; }
.audit-details[open] { min-width: 26rem; }
table.changes { border-collapse: collapse; width: 100%; font-size: 0.8125rem; margin-bottom: 0.75rem; }
table.changes th { text-align: left; font-weight: 500; color: var(--slate-500); padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--slate-200); }
table.changes td { padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--slate-100); vertical-align: top; }
table.changes td.old { color: var(--red-700); text-decoration: line-through; text-decoration-color: rgb(185 28 28 / 0.35); }
table.changes td.new { color: var(--emerald-700); }
.audit-meta { display: grid; gap: 0.375rem; margin: 0; font-size: 0.8125rem; }
.audit-meta dt { color: var(--slate-500); font-size: 0.75rem; }
.audit-meta dd { margin: 0; color: var(--slate-700); word-break: break-word; }
.pager { display: flex; justify-content: space-between; align-items: center; }
