/* ==========================================================================
   Relevy design system — "Trade Amber"
   Ink-navy + warm amber, light-first, mobile-polished.
   Zero build step: plain CSS, custom properties, self-hosted display font.
   ========================================================================== */

/* ---- Display font (self-hosted, variable weight, latin subset) ----------
   Bricolage Grotesque: warm, characterful grotesque for headings/brand.
   Chosen over the ubiquitous Inter/Space-Grotesk set for genuine personality. */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin.ada540c0e24a.woff2") format("woff2");
}

/* ---- Design tokens ------------------------------------------------------ */
:root {
  color-scheme: light;

  /* Brand */
  --ink:        #12161F;   /* brand base / dark surfaces */
  --ink-soft:   #1E2430;
  --amber:      #F5A524;   /* primary accent */
  --amber-600:  #E0930F;   /* hover */
  --amber-700:  #9A6208;   /* active/text-on-light (WCAG AA >=4.5:1 on light) */
  --amber-soft: #FEF3DB;   /* tinted background */

  /* Text */
  --text:       #1A1D24;
  --muted:      #5B6070;
  --faint:      #676C7C;   /* WCAG AA >=4.5:1 on light backgrounds */
  --on-ink:     #F4F5F7;   /* text on ink surfaces */
  --on-amber:   #1A1D24;   /* dark text on amber (contrast-safe) */

  /* Surfaces */
  --bg:         #FAFAF8;   /* app background (warm off-white) */
  --panel:      #FFFFFF;   /* cards / raised surfaces */
  --subtle:     #F3F2EC;   /* subtle fills, table headers */
  --subtle-2:   #ECEAE2;

  /* Lines */
  --line:       #E7E5DD;
  --line-2:     #D9D6CC;

  /* Semantic */
  --success:      #127A2E;
  --success-soft: #E4F3E8;
  --warning:      #9C5A0C;
  --warning-soft: #FCEFD6;
  --danger:       #C0362C;
  --danger-soft:  #FBE9E7;
  --info:         #1F4FB0;
  --info-soft:    #E7EDFB;

  /* Radius */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Shadow (warm, low-alpha) */
  --shadow-sm: 0 1px 2px rgba(18,22,31,.06), 0 1px 1px rgba(18,22,31,.04);
  --shadow:    0 4px 14px rgba(18,22,31,.08), 0 1px 3px rgba(18,22,31,.05);
  --shadow-lg: 0 18px 44px rgba(18,22,31,.14), 0 4px 12px rgba(18,22,31,.08);
  --ring:      0 0 0 3px rgba(245,165,36,.35);

  /* Type */
  --font-display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Motion */
  --t-fast: 120ms;
  --t:      200ms;
  --ease:   cubic-bezier(.2, .7, .2, 1);

  /* Layout */
  --container: 68rem;
  --header-h: 60px;
  --z-header: 40;
  --z-nav: 45;
  --z-menu: 60;
}

/* ---- Reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
}
h1 { font-size: clamp(1.7rem, 4.2vw, 2.35rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }

p { color: var(--text); }

a { color: var(--amber-700); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; }
svg { flex: none; }

/* Visible, consistent focus for keyboard users */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: .6rem 1rem;
  border-radius: 0 0 var(--r-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---- Layout ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.25rem;
}
.container--narrow { max-width: 40rem; }
.container--wide { max-width: 80rem; }

.app-main {
  padding-block: 1.75rem 4rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.page-head__title { display: flex; flex-direction: column; gap: .25rem; }
.page-head__eyebrow {
  font-size: .8rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--amber-700);
}
.page-head p { color: var(--muted); }
.page-head__actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---- App header / nav shell -------------------------------------------- */
.app-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-header__inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 1.25rem;
}

.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
  letter-spacing: -0.02em; color: var(--ink); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 28px; height: 28px; border-radius: 8px;
  box-shadow: 0 2px 6px rgba(18,22,31,.20);
  line-height: 0;
}
.brand__mark .logo-mark { width: 28px; height: 28px; display: block; }

/* primary nav (desktop) */
.nav {
  display: flex; align-items: center; gap: .25rem;
  margin-left: .5rem;
}
.nav__link {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .7rem; border-radius: var(--r-sm);
  color: var(--muted); font-weight: 500; font-size: .95rem;
  text-decoration: none; transition: color var(--t-fast), background var(--t-fast);
}
.nav__link svg { width: 18px; height: 18px; stroke: currentColor; }
.nav__link:hover { color: var(--ink); background: var(--subtle); text-decoration: none; }
.nav__link[aria-current="page"] {
  color: var(--ink); background: var(--amber-soft);
}
.nav__link[aria-current="page"]::after { content: none; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

/* account dropdown (native details/summary — no JS, CSP-safe) */
.acct { position: relative; }
.acct > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .3rem .3rem .3rem .7rem; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--panel);
  font-weight: 500; color: var(--text); font-size: .9rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary:hover { border-color: var(--line-2); }
.acct[open] > summary { box-shadow: var(--ring); }
.avatar {
  width: 28px; height: 28px; border-radius: var(--r-full);
  background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: .8rem;
  font-family: var(--font-display);
}
.acct__menu {
  position: absolute; right: 0; top: calc(100% + .5rem);
  min-width: 12rem; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: .4rem; z-index: var(--z-menu);
  animation: pop var(--t) var(--ease);
}
.acct__menu a, .acct__menu button {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .55rem .6rem; border-radius: var(--r-sm);
  color: var(--text); font: inherit; text-align: left;
  background: none; border: 0; cursor: pointer; text-decoration: none;
}
.acct__menu a:hover, .acct__menu button:hover { background: var(--subtle); text-decoration: none; }
.acct__menu svg { width: 17px; height: 17px; stroke: var(--muted); }
.acct__sep { height: 1px; background: var(--line); margin: .35rem .2rem; }

/* mobile bottom nav */
.mobilenav {
  display: none;
  position: fixed; inset: auto 0 0 0; z-index: var(--z-nav);
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.mobilenav__link {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem;
  padding: .4rem 0; min-height: 48px; justify-content: center;
  color: var(--faint); font-size: .68rem; font-weight: 600;
  text-decoration: none; border-radius: var(--r-sm);
}
.mobilenav__link svg { width: 22px; height: 22px; stroke: currentColor; }
.mobilenav__link[aria-current="page"] { color: var(--amber-700); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.05rem; border-radius: var(--r-sm);
  font-family: var(--font-body); font-weight: 600; font-size: .95rem;
  line-height: 1; cursor: pointer; text-decoration: none;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast),
              background var(--t-fast), border-color var(--t-fast), filter var(--t-fast);
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; stroke: currentColor; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn--primary { --btn-bg: var(--amber); --btn-fg: var(--on-amber); box-shadow: 0 2px 10px rgba(245,165,36,.35); }
.btn--primary:hover { --btn-bg: var(--amber-600); box-shadow: 0 6px 18px rgba(245,165,36,.42); }

.btn--dark { --btn-bg: var(--ink); --btn-fg: #fff; }
.btn--dark:hover { --btn-bg: var(--ink-soft); }

.btn--ghost { --btn-bg: transparent; --btn-fg: var(--text); --btn-bd: var(--line-2); }
.btn--ghost:hover { --btn-bg: var(--subtle); }

.btn--subtle { --btn-bg: var(--subtle); --btn-fg: var(--ink); }
.btn--subtle:hover { --btn-bg: var(--subtle-2); }

.btn--danger { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: var(--danger); }
.btn--danger:hover { --btn-bg: var(--danger-soft); }

.btn--lg { padding: .82rem 1.4rem; font-size: 1.02rem; border-radius: var(--r); }
.btn--sm { padding: .42rem .7rem; font-size: .85rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn--link { --btn-bg: transparent; --btn-fg: var(--amber-700); padding-inline: .25rem; box-shadow: none; }
.btn--link:hover { text-decoration: underline; }

/* ---- Cards -------------------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
}
.card--pad-lg { padding: 1.75rem; }
.card__title { font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); margin-bottom: .35rem; }
.card__hint { color: var(--muted); font-size: .92rem; }

a.card, .card--link { transition: transform var(--t) var(--ease), box-shadow var(--t), border-color var(--t); }
a.card:hover, .card--link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); text-decoration: none; }

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }

/* ---- Stat cards --------------------------------------------------------- */
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.15rem 1.25rem;
  display: flex; flex-direction: column; gap: .35rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease), box-shadow var(--t), border-color var(--t);
}
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); text-decoration: none; }
.stat__label {
  display: flex; align-items: center; gap: .45rem;
  color: var(--muted); font-size: .85rem; font-weight: 600;
}
.stat__label svg { width: 16px; height: 16px; stroke: var(--amber-700); }
.stat__value { font-family: var(--font-display); font-size: 1.9rem; color: var(--ink); letter-spacing: -0.02em; }
.stat__meta { color: var(--faint); font-size: .82rem; }

/* ---- Badges ------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem; border-radius: var(--r-full);
  font-size: .78rem; font-weight: 600; line-height: 1.4;
  background: var(--subtle); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--neutral { background: var(--subtle); color: var(--muted); }
.badge--info    { background: var(--info-soft); color: var(--info); }
.badge--amber   { background: var(--amber-soft); color: var(--amber-700); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger  { background: var(--danger-soft); color: var(--danger); }

/* ---- Tables / lists ----------------------------------------------------- */
.table-wrap {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table thead th {
  text-align: left; font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint);
  padding: .8rem 1.1rem; background: var(--subtle);
  border-bottom: 1px solid var(--line);
}
.table tbody td { padding: .85rem 1.1rem; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--subtle); }
.table tbody tr:first-child td { border-top: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a { color: var(--ink); font-weight: 600; }
.table a:hover { color: var(--amber-700); }

/* stacked list (mobile-friendly rows) */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.15rem; border-top: 1px solid var(--line);
  text-decoration: none; color: inherit; transition: background var(--t-fast);
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--subtle); text-decoration: none; }
.row__main { flex: 1; min-width: 0; }
.row__title { font-weight: 600; color: var(--ink); }
.row__sub { color: var(--muted); font-size: .88rem; }
.row__end { text-align: right; display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; }
.row__amount { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- Forms -------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.1rem; }
.field > label, label.field-label { font-weight: 600; font-size: .9rem; color: var(--ink); }
.field .help { color: var(--muted); font-size: .82rem; }
.field .errorlist, .errorlist { color: var(--danger); font-size: .85rem; list-style: none; padding: 0; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=url], input[type=search],
select, textarea {
  width: 100%; font: inherit; color: var(--text);
  padding: .65rem .8rem; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); background: var(--panel);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--amber); box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

.form-card { max-width: 30rem; }
.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }

/* Django form <p> fallback so unstyled {{ form.as_p }} still looks tidy */
form p { margin-bottom: 1rem; }
form p label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; color: var(--ink); }

/* ---- Alerts / callouts -------------------------------------------------- */
.alert {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .9rem 1.1rem; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text);
}
.alert svg { width: 20px; height: 20px; margin-top: 1px; }
.alert--info    { background: var(--info-soft);    border-color: #cdddf7; color: #163f8f; }
.alert--success { background: var(--success-soft); border-color: #c6e6cf; color: #0e5f24; }
.alert--warning { background: var(--warning-soft); border-color: #f2ddb0; color: #8a5209; }
.alert--danger, .alert--error { background: var(--danger-soft);  border-color: #f2c9c4; color: #98271f; }
.alert--debug { background: var(--subtle); border-color: var(--line); color: var(--muted); }

/* ---- Empty state -------------------------------------------------------- */
.empty {
  text-align: center; padding: 3rem 1.5rem;
  background: var(--panel); border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
}
.empty__icon {
  width: 52px; height: 52px; margin: 0 auto 1rem; border-radius: var(--r);
  background: var(--amber-soft); display: grid; place-items: center;
}
.empty__icon svg { width: 26px; height: 26px; stroke: var(--amber-700); }
.empty h3 { margin-bottom: .35rem; }
.empty p { color: var(--muted); max-width: 26rem; margin: 0 auto 1.25rem; }

/* ---- Section dividers / misc ------------------------------------------- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--gap, 1rem); }
.cluster { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.hr { height: 1px; background: var(--line); border: 0; margin: 1.5rem 0; }
.mono-num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.hide-sm { display: inline; }
@media (max-width: 760px) { .hide-sm { display: none; } }

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted); font-size: .9rem;
  padding-block: 1.5rem;
}
.site-footer__inner { display: flex; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--muted); margin-right: 1.1rem; }
.site-footer a:hover { color: var(--ink); }

/* ---- Animations --------------------------------------------------------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  .animate { animation: fade-up .5s var(--ease) both; }
  .stagger > * { animation: fade-up .5s var(--ease) both; }
  .stagger > *:nth-child(1) { animation-delay: .02s; }
  .stagger > *:nth-child(2) { animation-delay: .08s; }
  .stagger > *:nth-child(3) { animation-delay: .14s; }
  .stagger > *:nth-child(4) { animation-delay: .20s; }
  .stagger > *:nth-child(5) { animation-delay: .26s; }
  .stagger > *:nth-child(6) { animation-delay: .32s; }
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 860px) {
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  :root { --header-h: 56px; }
  .nav { display: none; }                 /* desktop nav hidden on mobile */
  .mobilenav { display: flex; }
  body.has-shell .app-main { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .table thead { display: none; }         /* tables collapse to rows */
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr { padding: .5rem 0; border-top: 1px solid var(--line); }
  .table tbody td { border: 0; padding: .2rem 1.1rem; }
  .table tbody td.num { text-align: left; }
  .table tbody td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--faint); font-weight: 600;
  }
}
@media (max-width: 460px) {
  .page-head { align-items: flex-start; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
}

/* ---- Line-item editor --------------------------------------------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.li-table td { vertical-align: middle; }
.li-table input[type=text], .li-table input[type=number] { padding: .5rem .6rem; }
.li-table input[name$="-quantity"], .li-table input[name$="-unit_price"] { max-width: 7rem; text-align: right; }
.li-table td.li-amount { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.li-rm-col { width: 3rem; text-align: center; }
.li-rm {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--panel); color: var(--muted); cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.li-rm svg { width: 16px; height: 16px; }
.li-rm:hover, .li-rm:focus-visible {
  color: var(--danger); border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent); outline: none;
}
.li-total-row td { border-top: 2px solid var(--line-2); font-variant-numeric: tabular-nums; }
.li-editor [data-add-line] { margin-top: .25rem; }
@media (max-width: 760px) {
  .li-table input[name$="-quantity"], .li-table input[name$="-unit_price"] { max-width: 100%; text-align: left; }
  .li-rm-col { width: 100%; text-align: left; }
}

/* ---- Structured address + explicit form fields -------------------------- */
.form-section {
  font-size: 1rem; font-weight: 600; color: var(--ink);
  margin: 1.5rem 0 .9rem; padding-top: 1.1rem; border-top: 1px solid var(--line);
}
.address-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.address-grid__full { grid-column: 1 / -1; }
.field--check { display: flex; align-items: center; gap: .55rem; margin-bottom: 1.1rem; }
.field--check input { width: auto; margin: 0; }
.field--check label { margin: 0; font-weight: 600; font-size: .9rem; color: var(--ink); }
.field--error > input, .field--error > select, .field--error > textarea { border-color: var(--danger); }
@media (max-width: 460px) { .address-grid { grid-template-columns: 1fr; } }

/* ---- Job schedule calendar ---------------------------------------------- */
.cal-bar { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.cal-bar__month {
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  color: var(--ink); min-width: 9.5rem;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(7.5rem, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r-sm); overflow: hidden;
}
.cal-dow {
  background: var(--panel); padding: .5rem .6rem; text-align: right;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
}
.cal-cell {
  background: var(--panel); min-height: 6.5rem; padding: .35rem .4rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.cal-cell--muted { background: var(--bg); }
.cal-cell--muted .cal-daynum { color: var(--faint); }
.cal-cell--today { box-shadow: inset 0 0 0 2px var(--amber); }
.cal-daynum {
  font-size: .8rem; font-weight: 600; color: var(--ink-soft);
  text-align: right; font-variant-numeric: tabular-nums;
}
.cal-cell--today .cal-daynum { color: var(--amber-700); }
.cal-chip {
  display: block; padding: .22rem .42rem; border-radius: 6px;
  border-left: 3px solid var(--info); background: var(--info-soft);
  text-decoration: none; line-height: 1.2; transition: filter var(--t-fast);
}
.cal-chip:hover { filter: brightness(.97); text-decoration: none; }
.cal-chip--complete { border-left-color: var(--success); background: var(--success-soft); }
.cal-chip__title, .cal-chip__sub {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-chip__title { font-size: .78rem; font-weight: 600; color: var(--ink); }
.cal-chip__sub { font-size: .7rem; color: var(--muted); }
.cal-agenda__main { display: flex; align-items: center; gap: .85rem; }
.cal-agenda-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 2.6rem; height: 2.6rem; border-radius: var(--r-sm);
  background: var(--amber-soft); flex-shrink: 0;
}
.cal-agenda-date__d { font-weight: 700; font-size: 1rem; color: var(--amber-700); line-height: 1; }
.cal-agenda-date__m { font-size: .65rem; text-transform: uppercase; letter-spacing: .04em; color: var(--amber-700); }
@media (max-width: 680px) {
  .table-wrap:has(.cal-grid) { overflow-x: auto; }
  .cal-grid { min-width: 44rem; }
}

/* ---- Status / success toast --------------------------------------------- */
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-7px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast { animation: toast-in 280ms var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---- Interaction polish ------------------------------------------------- */
/* A clear amber ring on keyboard focus — follows each element's own radius. */
a:focus-visible, button:focus-visible, summary:focus-visible,
.btn:focus-visible, .stat:focus-visible, .row:focus-visible,
.mobilenav__link:focus-visible {
  outline: none; box-shadow: var(--ring);
}
/* Native checkboxes/radios in the brand amber. */
input[type=checkbox], input[type=radio] { accent-color: var(--amber); }
/* Considered press/lift on the primary action and the tappable stat cards. */
@media (hover: hover) {
  .btn--primary:hover { transform: translateY(-1px); }
  .stat { transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t); }
  .stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
}
@media (prefers-reduced-motion: reduce) {
  .btn--primary:hover, .stat:hover { transform: none; }
}
