/* TradeCraft Joinery: shared design system (customer portal + admin dashboard), palette matched to tradecraftjoinery.co.uk */
:root {
  --navy-900: #071328;
  --navy-800: #0b1f3a;
  --navy-700: #142c4d;
  --navy-600: #23406a;
  --navy-100: #e5eaf2;
  --gold-600: #8a6a1c;
  --gold-500: #b8922f;
  --gold-300: #d9b65c;
  --gold-100: #f6eed8;
  --paper: #faf8f2;
  --sand: #f1ece0;
  --line: #e8dfca;
  --line-strong: #d6c9a8;
  --ink: #1c2532;
  --ink-2: #4a5566;
  --ink-3: #7b8594;
  --white: #ffffff;
  --ok: #2f7d4f;
  --ok-bg: #e6f2ea;
  --warn: #9a6a12;
  --warn-bg: #fbf1dc;
  --bad: #a3392f;
  --bad-bg: #f8e5e2;
  --info: #2d5f8f;
  --info-bg: #e5eef7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(7, 19, 40, .06), 0 1px 1px rgba(7, 19, 40, .04);
  --shadow: 0 4px 18px rgba(7, 19, 40, .08), 0 1px 3px rgba(7, 19, 40, .06);
  --shadow-lg: 0 18px 50px rgba(7, 19, 40, .18);
  --serif: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--paper); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; font-variant-numeric: lining-nums; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; color: var(--navy-800); margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: 2.4rem; line-height: 1.1; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
a { color: var(--navy-700); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 600; color: var(--gold-600); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); color: var(--navy-800); font-weight: 500; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; line-height: 1.2; }
.btn:hover { border-color: var(--navy-600); background: #fbfaf7; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--navy-800); color: var(--white); border-color: var(--navy-800); }
.btn.primary:hover { background: var(--navy-700); }
.btn.gold { background: var(--gold-500); border-color: var(--gold-500); color: var(--navy-900); }
.btn.gold:hover { background: var(--gold-300); border-color: var(--gold-300); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(11, 31, 58, .06); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn.xs { padding: 3px 9px; font-size: 12px; }
.icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
.btn svg, .icon-btn svg { width: 16px; height: 16px; flex: none; }

/* form */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .label { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }
.input, select.input, textarea.input { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--white); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(42, 72, 103, .14); }
textarea.input { resize: vertical; min-height: 70px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--navy-800); }

/* cards & pills */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--sand); color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.draft { background: #eef0f3; color: #59626f; }
.pill.submitted { background: var(--warn-bg); color: var(--warn); }
.pill.in_review { background: var(--info-bg); color: var(--info); }
.pill.approved { background: var(--ok-bg); color: var(--ok); }
.pill.sent { background: #e9e4f5; color: #574192; }
.pill.accepted { background: var(--ok-bg); color: var(--ok); }
.pill.declined { background: var(--bad-bg); color: var(--bad); }
.pill.alert { background: var(--bad-bg); color: var(--bad); }
.pill.gold { background: var(--gold-100); color: var(--gold-600); }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-500); display: inline-block; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(7, 19, 40, .45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; animation: fade .15s ease; backdrop-filter: blur(2px); }
.modal { background: var(--white); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(760px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; animation: pop .18s ease; }
.modal.wide { width: min(1000px, 100%); }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: #fcfbf8; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy-800); color: #fff; padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 80; font-size: 14px; animation: pop .2s ease; max-width: calc(100vw - 32px); }
.toast.err { background: var(--bad); }

/* diagram */
.diagram svg { display: block; width: 100%; height: auto; }
.diagram { color: var(--navy-800); }

/* item editor */
.editor-layout { display: grid; grid-template-columns: 1fr 210px; gap: 22px; }
.editor-preview { position: sticky; top: 0; align-self: start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.chipset { display: flex; flex-wrap: wrap; gap: 6px; }
.optchip { border: 1px solid var(--line-strong); background: var(--white); border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.optchip.on { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbf9f5; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fcfaf6; }

.md p { margin: 0 0 .55em; }
.md p:last-child { margin-bottom: 0; }
.md ul { margin: .2em 0 .6em; padding-left: 1.1em; }
.md li { margin: .15em 0; }

@media (max-width: 760px) {
  h1 { font-size: 1.9rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-preview { position: static; max-width: 220px; margin: 0 auto; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; }
}
