/* ==========================================================================
   LYB Crafts — Modern Atelier
   Linen ground, sage and ochre, tight grotesk with serif figures.
   Presentation only. Every selector here is also relied on by app.js
   and the browser suite, so names are stable.
   ========================================================================== */

/* --- Typefaces ----------------------------------------------------------- */
@font-face {
  font-family: "Inter var";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter var";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces var";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/fraunces-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces var";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Tokens -------------------------------------------------------------- */
:root {
  /* Ground and surface */
  --linen: #f6f4ee;
  --paper: #fffdf8;
  --paper-warm: #faf7f0;
  --paper-sunk: #f1eee5;

  /* Ink */
  --ink: #1f2e29;
  --ink-soft: #3f544c;
  --muted: #7c8a82;
  --muted-deep: #61706a;

  /* Keylines */
  --line: #e4dfd2;
  --line-soft: #eeeae0;
  --line-strong: #d6d0c0;

  /* Accents */
  --sage: #3d6b5c;
  --sage-deep: #2b4d42;
  --sage-tint: #e6ede8;
  --sage-ink: #294a3f;
  --ochre: #c08a2e;
  --ochre-deep: #9a6d1f;
  --ochre-tint: #f6edd9;
  --clay: #b4674a;
  --clay-tint: #f7e8e0;

  /* Type */
  --sans:
    "Inter var", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --serif: "Fraunces var", Fraunces, "Iowan Old Style", Georgia, serif;

  /* Form */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px #2a3b2f0a, 0 8px 24px -18px #2a3b2f2e;
  --shadow-lift: 0 2px 4px #2a3b2f0d, 0 18px 38px -26px #2a3b2f47;

  /* Tabler bridge */
  --tblr-primary: #3d6b5c;
  --tblr-primary-rgb: 61, 107, 92;
  --tblr-body-bg: #f6f4ee;
  --tblr-body-color: #1f2e29;
  --tblr-border-color: #e4dfd2;
  --tblr-font-sans-serif: var(--sans);
}

* {
  box-sizing: border-box;
}

/* --- Base ---------------------------------------------------------------- */
body {
  font-family: var(--sans);
  font-feature-settings:
    "cv05" 1,
    "ss03" 1;
  color: var(--ink);
  background-color: var(--linen);
  /* Paper tooth: fractal grain, barely there, tiling behind everything. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='0.22'/%3E%3C/svg%3E");
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--sage);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover {
  color: var(--sage-deep);
}
::selection {
  background: var(--ochre-tint);
  color: var(--ink);
}

/* --- Typography ---------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: -0.028em;
}
h1 {
  font-family: var(--serif);
  font-size: 2.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 60;
  line-height: 1.1;
}
h2 {
  font-size: 1.2rem;
  font-weight: 620;
}
h3 {
  font-size: 1rem;
  font-weight: 620;
}
.eyebrow,
.nav-label {
  margin: 0;
  color: var(--muted-deep);
  font-size: 10px;
  font-weight: 620;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.text-secondary {
  color: var(--muted-deep) !important;
}
.muted {
  color: var(--muted);
}
/* Serif figures: the atelier signature. Tabular so columns still align. */
.money,
.stat-value,
.total-list .grand-total span:last-child,
.cost-summary .value {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}
.pre-wrap,
.line {
  white-space: pre-wrap;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0.6rem 1.15rem;
  border: 1px solid #0000;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.006em;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  border-color: var(--sage);
  background: var(--sage);
  color: var(--paper);
}
.btn-primary:hover,
.btn-primary:focus {
  border-color: var(--sage-deep);
  background: var(--sage-deep);
  color: var(--paper);
}
.btn-outline-secondary {
  border-color: var(--line-strong);
  background: var(--paper);
  color: var(--ink);
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  border-color: var(--sage);
  background: var(--sage-tint);
  color: var(--sage-ink);
}
.btn[disabled],
.btn:disabled {
  opacity: 0.45;
}
.w-100 {
  width: 100%;
}

/* --- Cards --------------------------------------------------------------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: #0000;
}
.card-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  font-variation-settings: "opsz" 24;
  letter-spacing: -0.012em;
}
.card-header a {
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.card-body {
  padding: 22px;
}
/* Headings inside a card body — document details, side panels, forms. */
.card-body > h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  font-variation-settings: "opsz" 30;
  letter-spacing: -0.014em;
}
.card-body h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  font-variation-settings: "opsz" 24;
  letter-spacing: -0.01em;
}
.card-body :is(div, p, table, ul) + h3 {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px dashed var(--line-soft);
}
.card-body > h2 + p,
.card-body h3 + p {
  margin-top: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

/* --- Tables -------------------------------------------------------------- */
.table-responsive {
  overflow-x: auto;
}
.table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  color: var(--ink);
}
.table thead th,
.table th {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  border-bottom-color: var(--line);
  background: var(--paper-sunk);
  box-shadow: none;
  color: var(--muted-deep);
  font-size: 10px;
  font-weight: 620;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.table tbody td,
.table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
  border-bottom-color: var(--line-soft);
  box-shadow: none;
  font-size: 13.5px;
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom-width: 0;
}
.table tbody tr:hover td {
  background: #f3f1e94d;
}
.table .primary {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.table .primary:hover {
  color: var(--sage);
  text-decoration: underline;
}
.table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

/* --- Status badges ------------------------------------------------------- */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-sunk);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 620;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}
.badge-status[data-state="Ordered"],
.badge-status[data-state="Applied"],
.badge-status[data-state="Paid"],
.badge-status[data-state="Completed"],
.badge-status[data-state="Accepted"] {
  border-color: #bcd2c2;
  background: var(--sage-tint);
  color: var(--sage-ink);
}
.badge-status[data-state="Partially Paid"],
.badge-status[data-state="In Production"],
.badge-status[data-state="Sent"],
.badge-status[data-state="Quoted"],
.badge-status[data-state="Not applied"] {
  border-color: #e6cf9c;
  background: var(--ochre-tint);
  color: var(--ochre-deep);
}
.badge-status[data-state="Expired"],
.badge-status[data-state="Declined"],
.badge-status[data-state="Cancelled"],
.badge-status[data-state="Lost"],
.badge-status[data-state="Failed"],
.badge-status[data-state="Altered"] {
  border-color: #e5c0ae;
  background: var(--clay-tint);
  color: #8d4a30;
}

/* --- Shell: sidebar ------------------------------------------------------ */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  width: 244px;
  flex-direction: column;
  padding: 26px 20px;
  border-right: 1px solid var(--line);
  background: var(--paper-warm);
  overflow-y: auto;
}
.sidebar > * {
  flex: none;
}
.sidebar .nav-label {
  margin: 26px 0 10px 10px;
}
.wordmark {
  display: inline-grid;
  grid-template-columns: auto auto;
  column-gap: 10px;
  align-items: baseline;
  justify-content: start;
  width: fit-content;
  margin-left: 10px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  font-variation-settings: "opsz" 40;
  letter-spacing: -0.035em;
  text-decoration: none;
}
.wordmark:hover,
.wordmark:focus-visible {
  text-decoration: none;
}
.wm-accent {
  color: var(--sage);
}
.brand-mark {
  grid-column: 1;
  grid-row: 1;
  height: 0.82em;
  width: auto;
  flex: none;
  color: var(--sage);
}
.wordmark-text {
  grid-column: 2;
  grid-row: 1;
  line-height: 1;
}
.wordmark small {
  /* Centred beneath the whole lockup — mark and wordmark together —
     rather than hanging off the text's left edge. */
  grid-column: 1 / -1;
  grid-row: 2;
  display: block;
  margin-top: 7px;
  text-align: center;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 620;
  letter-spacing: 0.19em;
}
.studio {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 24px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.studio strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 620;
  line-height: 1.3;
}
.studio small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.studio-avatar,
.user-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.sidebar nav a:hover {
  background: #eae6da;
  color: var(--ink);
}
.sidebar nav a[aria-current] {
  background: var(--sage-tint);
  color: var(--sage-ink);
  font-weight: 620;
}
.icon {
  display: block;
  width: 100%;
  height: 100%;
}
.nav-mark {
  display: grid;
  width: 19px;
  height: 19px;
  flex: none;
  place-items: center;
  color: var(--muted);
  transition: color 0.15s ease;
}
.sidebar nav a:hover .nav-mark {
  color: var(--ink-soft);
}
.sidebar nav a[aria-current] .nav-mark {
  color: var(--ochre);
}
.sidebar-bottom {
  display: flex;
  margin-top: 34px;
  flex-direction: column;
  gap: 3px;
}
.sidebar-bottom > a {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted-deep);
  font-size: 12.5px;
  text-decoration: none;
}
.sidebar-bottom > a:hover {
  background: #eae6da;
  color: var(--ink);
}
.logout {
  width: 100%;
  padding: 7px 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #0000;
  color: var(--muted-deep);
  font-family: var(--sans);
  font-size: 12.5px;
  text-align: left;
}
.logout:hover {
  background: #eae6da;
  color: var(--ink);
}
.pilot-card {
  margin-bottom: 14px;
  padding: 15px;
  border: 1px solid #e6d9b8;
  border-radius: var(--radius);
  /* Warm ochre wash — the one openly decorative panel in the shell. */
  background: linear-gradient(160deg, #faf2df, #f7eee0);
}
.pilot-card .eyebrow {
  color: var(--ochre-deep);
}
.pilot-card strong {
  display: block;
  margin-top: 7px;
  color: #4a3a1c;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.32;
}
.pilot-card small {
  display: block;
  margin-top: 7px;
  color: #8a7143;
  font-size: 10.5px;
}

/* --- Shell: workspace and topbar ----------------------------------------- */
.workspace {
  margin-left: 244px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  height: 66px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: #f6f4eef2;
  backdrop-filter: blur(8px);
}
.topbar > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 620;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.topbar > div {
  display: flex;
  align-items: center;
  gap: 14px;
}
.working-badge {
  padding: 4px 11px;
  border: 1px solid #e6d9b8;
  border-radius: 999px;
  background: var(--ochre-tint);
  color: var(--ochre-deep);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.15em;
}
.topbar .user-avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}
#main {
  flex: 1;
  padding: 36px 34px 52px;
}

/* --- Page heading -------------------------------------------------------- */
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 30px;
}
.page-heading h1 {
  margin: 7px 0 0;
}
.page-heading p {
  margin: 8px 0 0;
  max-width: 54ch;
  color: var(--muted-deep);
  font-size: 13.5px;
}
.heading-actions,
.actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
}

/* --- Welcome banner ------------------------------------------------------ */
.welcome-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 26px;
  padding: 26px 28px;
  border: 1px solid #d8dfd4;
  border-radius: var(--radius-lg);
  background: linear-gradient(140deg, #e9efe6, #eff1e6 55%, #f5eede);
  overflow: hidden;
}
.welcome-banner h2 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  font-variation-settings: "opsz" 40;
  letter-spacing: -0.018em;
}
.welcome-banner p {
  margin: 8px 0 0;
  max-width: 58ch;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.first-steps {
  margin-bottom: 26px;
}
.first-steps .eyebrow {
  margin-bottom: 10px;
}
.step-cards {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
}
.step-card {
  display: flex;
  flex: 0 0 200px;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  scroll-snap-align: start;
}
.step-card small {
  flex: 1;
  color: var(--muted-deep);
  font-size: 12.5px;
}
.step-card .btn {
  align-self: flex-start;
  margin-top: 4px;
}
.step-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted-deep);
  font-size: 12px;
  font-weight: 700;
}
.step-card.done .step-mark {
  border-color: var(--sage);
  background: var(--sage);
  color: #fff;
}
.step-card.done strong {
  color: var(--muted-deep);
}
.step-card.note {
  border-color: #ead8b4;
  background: var(--ochre-tint);
}
.step-card.note strong,
.step-card.note small {
  color: var(--ochre-deep);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.banner-mark {
  display: block;
  width: 52px;
  height: 52px;
  flex: none;
  color: var(--ochre);
  opacity: 0.5;
}

/* --- Stat tiles ---------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  position: relative;
  padding: 20px 20px 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
/* The ochre keyline — a bound edge down the spine of each figure. */
.stat::before {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 0;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--ochre);
  opacity: 0.55;
}
.stat-label {
  margin: 0;
  color: var(--muted-deep);
  font-size: 10px;
  font-weight: 620;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.stat-value {
  display: block;
  margin: 12px 0 0;
  color: var(--ink);
  font-size: 30px;
  font-weight: 500;
  font-variation-settings: "opsz" 72;
  line-height: 1.05;
}
.stat-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}
.stat > a {
  display: block;
  color: inherit;
  text-decoration: none;
}
/* The label carries the drill-down arrow at its far edge. */
.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stat-label span {
  color: var(--line-strong);
  font-size: 13px;
  letter-spacing: 0;
  transition: color 0.15s ease;
}
.stat > a:hover .stat-label span {
  color: var(--sage);
}
.stat > a:hover .stat-value {
  color: var(--sage-ink);
}

/* --- Layout helpers ------------------------------------------------------ */
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.material-row .field-grid.material-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.amount-unit > .form-select {
  flex: 0 0 auto;
  width: auto;
  max-width: 58%;
}
@media (max-width: 760px) {
  .material-row .field-grid.material-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Label with an info button on the right; the bubble opens on click. */
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.info {
  position: relative;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}
.info-tip {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted-deep);
  font-family: var(--serif);
  font-size: 11px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
}
.info-tip:hover,
.info-tip[aria-expanded="true"] {
  border-color: var(--sage);
  background: var(--sage);
  color: #fff;
}
.info-bubble:empty {
  display: none;
}
.info-bubble {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  width: 240px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgb(31 46 41 / 0.18);
}
.combo {
  position: relative;
}
.combo-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  max-height: 280px;
  margin: 4px 0 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 10px 28px rgb(31 46 41 / 0.12);
}
.combo-list li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.combo-list li small {
  display: block;
  color: var(--muted-deep);
  font-size: 12px;
}
.combo-list li:hover,
.combo-list li[aria-selected="true"] {
  background: var(--sage-tint);
}
.combo-list li.combo-new {
  color: var(--sage-deep);
  font-weight: 600;
}
/* Payments: tabs between what's owed and what came in. */
.tab-row {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.tab-row .tab {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-deep);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.tab-row .tab.active {
  border-color: var(--sage);
  background: var(--sage);
  color: #fff;
}
.payments-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 760px) {
  .payments-stats {
    grid-template-columns: minmax(0, 1fr);
  }
}
tr.voided td {
  color: var(--muted);
  text-decoration: line-through;
}
.badge-status[data-state="Overdue"] {
  border-color: #e5c0ae;
  background: var(--clay-tint);
  color: #8d4a30;
}
/* Activity: newest first, who and when under each entry. */
.activity {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.activity > li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.activity > li:last-child {
  border-bottom: 0;
}
.activity small {
  display: block;
  color: var(--muted-deep);
}
.activity ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 13px;
}
.activity-filter {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
}
.activity-pages:empty {
  display: none;
}
.activity-pages {
  display: flex;
  gap: 8px;
}
@media (max-width: 760px) {
  .activity-filter {
    grid-template-columns: minmax(0, 1fr);
  }
}
.row-cost {
  margin: 10px 0 0;
  color: var(--sage-deep);
  font-size: 13px;
  font-weight: 600;
}
.row-cost:empty {
  display: none;
}
.quote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--line);
}
.inquiry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.inquiry-row:last-child {
  border-bottom: 0;
}
.inquiry-row small {
  display: block;
  color: var(--muted-deep);
}
.inquiry-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
/* Quick quote: keep the answer in view while the maker types. */
.quote-layout > aside {
  position: sticky;
  top: 16px;
}
@media (max-width: 1200px) {
  /* The two columns stack here; show the answer before the long form. */
  .quote-layout > aside {
    order: -1;
    position: static;
  }
}
.mt-3 {
  margin-top: 1rem;
}
.mt-4 {
  margin-top: 1.5rem;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-4 {
  margin-bottom: 1.5rem;
}

/* --- Empty states -------------------------------------------------------- */
.empty-state {
  padding: 46px 26px;
  text-align: center;
}
.empty-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  background: var(--paper-warm);
  color: var(--ochre);
}
.empty-icon .icon {
  width: 26px;
  height: 26px;
}
.empty-state h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  font-variation-settings: "opsz" 30;
}
.empty-state p {
  margin: 9px auto 18px;
  max-width: 44ch;
  color: var(--muted-deep);
  font-size: 13px;
}

/* --- Quick links --------------------------------------------------------- */
.quick-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.quick-link:hover {
  background: var(--paper-warm);
}
.quick-link:last-child {
  border-bottom: 0;
}
.quick-link .symbol {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border: 1px solid #dbe4dc;
  border-radius: 50%;
  background: var(--sage-tint);
  color: var(--sage);
}
.quick-link .symbol .icon {
  width: 19px;
  height: 19px;
}
.quick-link strong {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}
.quick-link small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}
.quick-link b {
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
}
.quick-link:hover b {
  color: var(--sage);
}
.soft-note {
  margin: 18px 2px 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}
.soft-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 620;
}
.workspace-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}
.workspace-footer span {
  font-family: var(--serif);
}

/* --- Filters and pagination ---------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.filter-bar .form-control {
  max-width: 320px;
}
.filter-bar .form-select {
  max-width: 200px;
}
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}
.pagination-bar span {
  margin-right: auto;
}

/* --- Forms --------------------------------------------------------------- */
.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 620;
  letter-spacing: -0.004em;
}
.form-control,
.form-select {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.form-control::placeholder {
  color: #a6b0a8;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px #3d6b5c26;
  outline: 0;
}
.form-select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c8a82' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.form-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.span-all {
  grid-column: 1 / -1;
}
/* Document header: customer takes half the row, the rest a quarter each. */
.doc-header-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.doc-header-grid.with-expiry {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.doc-header-grid > :first-child {
  grid-column: span 2;
}
.form-section {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px dashed var(--line-strong);
}
.form-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.form-section h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  font-variation-settings: "opsz" 30;
}
.form-section p {
  margin: 0 0 16px;
  color: var(--muted-deep);
  font-size: 12.5px;
}
.form-message {
  margin: 16px 0 0;
  padding: 11px 14px;
  border: 1px solid #e6cf9c;
  border-radius: var(--radius-sm);
  background: var(--ochre-tint);
  color: #7a5715;
  font-size: 12.5px;
}
.form-message:empty {
  display: none;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}
.form-card .card-body {
  padding: 26px;
}
.form-card h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  font-variation-settings: "opsz" 30;
  letter-spacing: -0.014em;
}
/* A dashed rule wherever a heading opens a new section mid-card. */
.form-card :is(div, p, section, ul, table, fieldset) + h2 {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px dashed var(--line-strong);
}
.form-card h2 + .form-hint,
.form-card h2 + .text-secondary {
  margin-bottom: 18px;
}
.form-card h3 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  font-variation-settings: "opsz" 24;
}
.form-card form .detail-meta {
  margin-top: 20px;
}
#add-material {
  margin-bottom: 24px;
}
#material-rows:not(:empty) {
  margin-top: 4px;
}
#cost-result:not(:empty) {
  margin-top: 4px;
}
.line-editor {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-warm);
}
.line-editor .field-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
/* Sits in the row's own header band, so it never lands on a field label. */
.remove-line {
  order: -1;
  align-self: flex-end;
  margin-bottom: 10px;
  min-height: 0;
  padding: 3px 10px;
  border: 1px solid #e3b8a6;
  border-radius: 999px;
  background: var(--paper);
  color: #a3432a;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
}
.remove-line:hover,
.remove-line:focus-visible {
  border-color: #a3432a;
  background: var(--clay-tint);
  color: #8a3520;
}
/* Small, tight pill for adding a row; green to pair with the red remove. */
.add-line {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--sage);
  border-radius: 999px;
  background: var(--sage-tint);
  color: var(--sage-deep);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
}
.add-line:hover,
.add-line:focus-visible {
  background: var(--sage);
  color: #fff;
}
.btn-danger {
  border-color: #a3432a;
  background: #a3432a;
  color: #fff;
}
.btn-danger:hover,
.btn-danger:focus-visible {
  border-color: #8a3520;
  background: #8a3520;
  color: #fff;
}

/* --- Costing and totals -------------------------------------------------- */
.cost-summary {
  margin-top: 18px;
  padding: 20px 22px;
  border: 1px solid #d8dfd4;
  border-radius: var(--radius);
  background: linear-gradient(150deg, #eaf0e7, #f4f1e4);
}
.cost-summary .value {
  display: block;
  margin: 6px 0 0;
  color: var(--sage-ink);
  font-size: 27px;
  font-weight: 500;
  font-variation-settings: "opsz" 60;
}
.cost-summary p {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 12.5px;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-bottom: 22px;
}
.detail-meta > div {
  min-width: 130px;
}
.detail-meta strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 620;
}
.total-list {
  margin-left: auto;
  max-width: 330px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-warm);
}
.total-list div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 7px 0;
  color: var(--ink-soft);
  font-size: 13px;
}
.total-list .grand-total {
  margin-top: 8px;
  padding-top: 13px;
  border-top: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 15px;
  font-weight: 620;
}
.total-list .grand-total span:last-child {
  font-size: 20px;
  font-weight: 500;
  font-variation-settings: "opsz" 40;
}

/* --- Production board ---------------------------------------------------- */
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.board-column {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-sunk);
}
.board-column h2 {
  margin: 0 0 12px;
  padding-left: 9px;
  border-left: 2px solid var(--ochre);
  color: var(--muted-deep);
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.board-card {
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.board-card:last-child {
  margin-bottom: 0;
}
.board-card a {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 620;
  text-decoration: none;
}
.board-card a:hover {
  color: var(--sage);
}
.board-card p {
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}
.board-card .btn {
  width: 100%;
  min-height: 34px;
  padding: 5px 12px;
  font-size: 11.5px;
}
.read-only-note {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 12px;
}

/* --- Attachments and images ---------------------------------------------- */
.attachment-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.9;
}
.product-image {
  display: block;
  max-width: 240px;
  max-height: 220px;
  margin: 10px 0 20px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  object-fit: contain;
}
.seller-logo {
  object-fit: contain;
}

/* --- Feedback ------------------------------------------------------------ */
#global-message:not(:empty) {
  margin-bottom: 20px;
  padding: 13px 17px;
  border: 1px solid #bcd2c2;
  border-radius: var(--radius);
  background: var(--sage-tint);
  color: var(--sage-ink);
  font-size: 13px;
  font-weight: 550;
}
.alert {
  padding: 13px 17px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 13px;
}
.alert-warning {
  border-color: #e6cf9c;
  background: var(--ochre-tint);
  color: #7a5715;
}
.alert a {
  color: inherit;
  font-weight: 620;
}
.loading-state {
  padding: 60px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* --- Dialog -------------------------------------------------------------- */
dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}
dialog::backdrop {
  background: #1f2e2966;
  backdrop-filter: blur(2px);
}
dialog textarea {
  min-height: 90px;
}
dialog h2 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  font-variation-settings: "opsz" 30;
  letter-spacing: -0.015em;
}
dialog .form-actions {
  margin-top: 20px;
}
#close-dialog {
  margin-top: 14px;
  min-height: 36px;
  padding: 0.4rem 1rem;
  font-size: 12px;
}

/* --- Account dropdown ---------------------------------------------------- */
.account-dropdown {
  position: relative;
}
.account-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 10px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: #0000;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
}
.account-toggle:hover,
.account-toggle[aria-expanded="true"] {
  background: #e9e5d9;
}
.account-chevron {
  color: var(--muted);
  transition: transform 0.18s ease;
}
.account-toggle[aria-expanded="true"] .account-chevron {
  transform: rotate(180deg);
}
.account-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-lift);
}
.account-panel a,
.account-panel button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #0000;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  text-align: left;
  text-decoration: none;
}
.account-panel a:hover,
.account-panel button:hover {
  background: var(--sage-tint);
  color: var(--sage-ink);
}
.account-panel form {
  margin: 0;
  border-top: 1px solid var(--line-soft);
}
.account-logout {
  margin: 16px 0 0;
}

/* --- Password reveal ----------------------------------------------------- */
.password-control {
  position: relative;
}
.password-control .form-control {
  min-height: 44px;
  padding-right: 48px;
}
.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: #0000;
  color: var(--muted-deep);
}
.password-toggle:hover {
  background: var(--sage-tint);
  color: var(--sage-ink);
}

/* --- Public: authentication ---------------------------------------------- */
.auth-body {
  margin: 0;
}
.auth-wrap {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1.08fr 1fr;
}
.auth-story {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 60px;
  border-right: 1px solid #dcd6c6;
  /* Deep sage ground with a warm ochre bloom — the brand moment. */
  background:
    radial-gradient(120% 90% at 8% 4%, #ffffff1f, #0000 60%),
    radial-gradient(90% 70% at 96% 100%, #c08a2e33, #0000 62%),
    linear-gradient(158deg, #33604f, #294c40 62%, #224137);
  color: #edf2ea;
  overflow: hidden;
}
/* Faint warp-and-weft over the green, like cloth catching light. */
.auth-story::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(45deg, #0000 0 9px, #ffffff0a 9px 10px),
    repeating-linear-gradient(-45deg, #0000 0 9px, #0000000f 9px 10px);
}
.auth-story > * {
  position: relative;
  z-index: 1;
}
.auth-story .brand-mark {
  color: #fbfaf4;
  --mark-accent: #d3b06a;
}
.auth-story .wordmark {
  margin-left: 0;
  color: #fbfaf4;
}
.auth-story .wm-accent {
  color: #d3b06a;
}
.auth-story .wordmark small {
  color: #a8bfae;
}
.auth-story .eyebrow {
  color: #b2c8b6;
}
.auth-story h1 {
  margin: 18px 0 0;
  color: #fdfcf6;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 4.1vw, 3.5rem);
  font-weight: 400;
  font-variation-settings: "opsz" 110;
  letter-spacing: -0.024em;
  line-height: 1.04;
}
.auth-story > div > p {
  margin: 22px 0 0;
  max-width: 40ch;
  color: #c6d6c6;
  font-size: 14.5px;
  line-height: 1.65;
}
.workflow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 34px;
}
.workflow span {
  padding: 8px 16px;
  border: 1px solid #ffffff2e;
  border-radius: 999px;
  background: #ffffff14;
  color: #e6efe4;
  font-size: 12px;
  font-weight: 550;
}
.workflow b {
  color: #d3b06a;
  font-weight: 400;
}
.story-foot {
  /* space-between distributes whatever is left, which collapses to nothing on
     a short window — this is the floor under it. */
  margin: 36px 0 0;
  color: #9db3a2;
  font-size: 11.5px;
}
.auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px;
  background: var(--linen);
}
.auth-form > div {
  width: 100%;
  max-width: 400px;
}
.auth-form h2 {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.022em;
}
.auth-form > .text-secondary,
.auth-form > div > .text-secondary {
  margin: 10px 0 0;
  font-size: 13.5px;
}
.auth-form form {
  margin-top: 26px;
}
.auth-form .form-label {
  margin-top: 15px;
}
.auth-form .btn {
  margin-top: 22px;
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px dashed var(--line-strong);
  font-size: 12.5px;
}
.auth-links a {
  text-decoration: none;
}
.auth-links a:hover {
  text-decoration: underline;
}
.auth-card {
  max-width: 460px;
  margin: 14vh auto;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-card h1 {
  margin: 10px 0 12px;
}
.auth-card p {
  color: var(--muted-deep);
  font-size: 13.5px;
}
.auth-card .btn {
  margin-top: 18px;
}

/* --- Mobile nav and skip link -------------------------------------------- */
.mobile-nav {
  display: none;
}
.skip-link {
  position: absolute;
  z-index: 60;
  top: 12px;
  left: 20px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--sage);
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:not(:focus) {
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  padding: 0;
  top: 0;
  overflow: hidden;
  white-space: nowrap;
}
.skip-link:focus {
  clip-path: none;
  width: auto;
  height: auto;
}

/* --- Focus --------------------------------------------------------------- */
button:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ochre);
  outline-offset: 3px;
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1200px) {
  .sidebar {
    width: 210px;
    padding: 22px 15px;
  }
  .workspace {
    margin-left: 210px;
  }
  #main {
    padding: 30px 25px;
  }
  .topbar,
  .workspace-footer {
    padding-left: 25px;
    padding-right: 25px;
  }
  .stats-grid {
    gap: 11px;
  }
  .stat {
    padding: 18px 16px 18px 18px;
  }
  .stat-value {
    font-size: 25px;
  }
  .two-column {
    grid-template-columns: 1fr;
  }
  .auth-story {
    padding: 45px;
  }
  .line-editor .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .doc-header-grid,
  .doc-header-grid.with-expiry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .doc-header-grid > :first-child {
    grid-column: auto;
  }
}
@media (max-width: 760px) {
  .sidebar {
    display: none;
  }
  .workspace {
    margin: 0;
  }
  .topbar {
    height: 58px;
    padding: 0 18px;
  }
  .topbar > span {
    max-width: 150px;
    overflow: hidden;
    font-size: 8.5px;
    letter-spacing: 0.13em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar > div {
    gap: 10px;
  }
  .topbar .working-badge {
    display: none;
  }
  #main {
    padding: 24px 18px 92px;
  }
  h1 {
    font-size: 1.72rem;
  }
  .page-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 23px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }
  .stat {
    padding: 17px 15px 17px 17px;
  }
  .stat-value {
    font-size: 20px;
  }
  .stat-label {
    font-size: 9.5px;
  }
  .welcome-banner {
    padding: 22px;
    gap: 10px;
  }
  .welcome-banner h2 {
    font-size: 1.3rem;
  }
  .banner-mark {
    display: none;
  }
  .card-header {
    padding: 17px 18px;
  }
  .card-body,
  .form-card .card-body {
    padding: 18px;
  }
  .table td {
    padding: 14px 13px;
  }
  .table th {
    padding: 11px 13px;
  }
  .field-grid,
  .line-editor .field-grid,
  .doc-header-grid,
  .doc-header-grid.with-expiry {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    flex-wrap: wrap;
  }
  .filter-bar .form-control,
  .filter-bar .form-select {
    max-width: none;
  }
  .detail-meta {
    gap: 16px;
  }
  .total-list {
    max-width: none;
  }
  .board {
    grid-template-columns: repeat(4, 235px);
  }
  .btn {
    font-size: 12.5px;
  }
  .workspace-footer {
    display: none;
  }
  .skip-link {
    left: 10px;
  }
  .mobile-nav {
    position: fixed;
    z-index: 20;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 10px 8px 24px;
    border-top: 1px solid var(--line);
    background: #faf7f0f7;
    backdrop-filter: blur(8px);
  }
  .mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    color: var(--muted-deep);
    font-size: 10.5px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
  }
  .mobile-nav a[aria-current="page"] {
    color: var(--sage-deep);
  }
  .mobile-nav .icon {
    width: 21px;
    height: 21px;
  }
  .auth-wrap {
    display: block;
    min-height: 0;
  }
  .auth-story {
    min-height: 0;
    padding: 26px 24px;
    border-right: 0;
  }
  .auth-story > div,
  .story-foot {
    display: none;
  }
  .auth-form {
    padding: 34px 24px 56px;
  }
  .auth-form > div {
    max-width: 420px;
  }
  .auth-links {
    font-size: 12px;
  }
  .auth-card {
    margin: 8vh 18px;
    padding: 28px;
  }
}
