:root {
  --charcoal: #332f2a;
  --charcoal-2: #27231f;
  --gold: #aa8734;
  --gold-light: #d1ad54;
  --cream: #f6f0e6;
  --paper: #ffffff;
  --line: #ded4c3;
  --muted: #766f63;
  --green: #3b6d45;
  --red: #b23b3b;
  --hot: #c0612f;
  --warm: #c9a227;
  --cold: #7d8790;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--cream);
  color: var(--charcoal);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 18px; }

.topbar { background: var(--charcoal); color: #f4f0e7; border-bottom: 1px solid rgba(255,255,255,.08); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 18px; }
.brand { font-family: Georgia, serif; font-size: 21px; letter-spacing: .16em; }
.brand small { display: block; margin-top: 2px; color: var(--gold-light); font: 9px sans-serif; letter-spacing: .28em; }
.owner-seg { display: flex; gap: 4px; background: rgba(255,255,255,.07); border-radius: 8px; padding: 3px; }
.owner-seg a { color: #d8d1c3; padding: 6px 12px; border-radius: 6px; font-size: 13px; }
.owner-seg a:hover { background: var(--gold); color: #241f16; }
.logout-form { display: flex; align-items: center; gap: 10px; color: #d8d1c3; font-size: 12.5px; }
.logout-form button { border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.08); color: #f4f0e7; border-radius: 999px; padding: 6px 10px; }
.logout-form button:hover { background: var(--gold); color: #241f16; }

.nav { background: var(--charcoal-2); border-bottom: 1px solid #45413a; }
.navlinks { display: flex; gap: 4px; overflow-x: auto; }
.nav a { color: #bbb4a8; padding: 13px 14px; font-size: 13.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover, .nav a.on { color: #f4f0e7; border-bottom-color: var(--gold); }
main.wrap { padding-top: 24px; padding-bottom: 56px; }

.viewhead { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 2px 0 16px; }
h1, h2, h3 { margin: 0; font-family: Georgia, serif; line-height: 1.2; }
h1 { font-size: 25px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
.viewhead p, .panel p { color: var(--muted); margin: 5px 0 0; }
.viewhead .sub { color: var(--muted); font-size: 13px; text-align: right; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 8px 13px;
  background: var(--gold);
  color: #241f16;
  font-weight: 650;
  line-height: 1.15;
}
.btn:hover { background: var(--gold-light); border-color: var(--gold-light); }
.btn.ghost { background: var(--paper); border-color: var(--line); color: var(--charcoal); }
.btn.ghost:hover { background: #f2eadc; border-color: var(--gold); }
.btn.sm { min-height: 30px; padding: 5px 10px; font-size: 12.5px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.kpi strong, .kpi .n { display: block; font-family: Georgia, serif; font-size: 25px; color: var(--charcoal); overflow-wrap: anywhere; }
.kpi span, .kpi .l { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.kpi.alert strong { color: var(--red); }
.kpi.alert .n { color: var(--hot); }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(51,47,42,.03);
}
.panel > h2, .panel > h3 { display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 13px 16px; border-bottom: 1px solid var(--line); background: #fbf9f4; font-size: 15px; }
.panel > h2 span, .panel > h3 .badge { font: 600 12px sans-serif; background: #efeae0; padding: 2px 9px; border-radius: 999px; }
.panel.form-grid, .panel > .panel-pad { padding: 15px 16px; }
.empty { color: var(--faint, #b7b1a2); font-style: italic; padding: 16px; font-size: 13.5px; }

.row, .enquiry-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 16px;
  border-bottom: 1px solid #f1ece2;
  cursor: pointer;
}
.row:last-child, .enquiry-card:last-child { border-bottom: 0; }
.row:hover, .enquiry-card:hover { background: #fbf8f2; }
.row .main { flex: 1; min-width: 0; }
.row .nm { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .right { text-align: right; font-size: 12.5px; color: var(--muted); flex: none; }
.row .right .v { font-weight: 600; color: var(--charcoal); font-size: 14px; }
.row small, .card span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.linkrow:hover, .card:hover { color: var(--gold); }

.pill { border-radius: 999px; padding: 2px 9px; color: white; font-size: 11px; font-weight: 700; }
.pill.hot { background: var(--hot); }
.pill.warm { background: var(--warm); color: #241f16; }
.pill.cold { background: var(--cold); }
.pill.status-new { background: #9aa0a622; color: #7d8790; }
.pill.status-quoting { background: #8a7bc022; color: #6d5da0; }
.pill.status-proposal-sent { background: #c9a22722; color: #8a6d14; }
.pill.status-deposit-paid { background: #3b8fa622; color: #2e7589; }
.pill.status-confirmed { background: #3b6d4522; color: var(--green); }
.pill.status-delivered { background: #6e695c22; color: #6e695c; }
.pill.status-lost { background: #b23b3b22; color: var(--red); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; margin-right: 6px; vertical-align: middle; }
.dot.hot { background: var(--hot); }
.dot.warm { background: var(--warm); }
.dot.cold { background: var(--cold); }
.ctag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.ctag.ok { background: #e3f0e3; color: var(--green); }
.ctag.warn { background: #fbf0cf; color: #7b5b0d; }

.board { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.column { background: #eee6d9; border: 1px solid #e2d7c5; border-radius: 8px; padding: 9px; min-height: 120px; }
.column h2 { font: 700 11px sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 2px 4px 8px; }
.col { background: #f3efe7; border-radius: 11px; padding: 8px; min-height: 80px; }
.col h4 { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 6px 8px; display: flex; justify-content: space-between; }
.col-empty { color: #b7b1a2; padding: 6px; font-size: 11.5px; }
.col-total { color: var(--muted); font-size: 11.5px; padding: 4px 6px 0; text-align: right; }
.card { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-bottom: 8px; cursor: pointer; }
.card:hover { border-color: var(--gold); color: inherit; }
.card strong { display: block; font-size: 13.5px; }
.card .ct { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 0; }
.card .cm { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.card .cv { font-size: 12px; color: var(--charcoal); font-weight: 600; margin-top: 4px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label, .stack label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .check { flex-direction: row; align-items: center; color: var(--charcoal); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: var(--paper);
  color: var(--charcoal);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(170,135,52,.22);
  border-color: var(--gold);
}
textarea { min-height: 92px; resize: vertical; }
.actions { display: flex; justify-content: flex-end; }
.stack { display: grid; gap: 10px; }
.button-row, .inline-form, .date-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.inline-form { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.inline-form input, .inline-form select { width: auto; min-width: 120px; }
.date-filter input { width: auto; min-width: 160px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { color: var(--muted); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); padding: 8px 7px; }
td { border-bottom: 1px solid #f1ece2; padding: 8px 7px; vertical-align: top; }
td input, td select { min-width: 120px; padding: 7px 8px; }
.num { text-align: right; }
.details { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 14px 0 0; font-size: 13.5px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.note { background: #fbf8f1; border-left: 3px solid var(--gold); padding: 9px 11px; margin: 8px 0; }
.over { color: var(--red); font-weight: 600; }
.footnote { color: #b7b1a2; font-size: 12px; text-align: center; margin-top: 24px; padding: 0 16px; }

.enq { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.enqhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.enqname { font-weight: 600; font-size: 15px; }
.enqage { font-size: 12px; color: var(--muted); white-space: nowrap; }
.enqmeta { font-size: 13px; color: var(--muted); margin-top: 5px; }
.enqnote { font-size: 12.5px; color: #6e695c; background: #fbf8f1; border-left: 3px solid var(--gold); border-radius: 0 7px 7px 0; padding: 7px 10px; margin-top: 8px; }
.enqact { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.enqact form { display: inline-flex; }
.btnrow { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 4px; }
.tag { display: inline-block; font-size: 11px; border-radius: 5px; padding: 1px 7px; background: #efeae0; color: #6e695c; margin-left: 6px; }

.scrim { position: fixed; inset: 0; background: rgba(40,37,32,.4); opacity: 0; pointer-events: none; transition: .2s; z-index: 40; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(520px, 94vw); background: var(--cream); box-shadow: -12px 0 40px rgba(0,0,0,.18); transform: translateX(100%); transition: .24s; z-index: 50; overflow-y: auto; }
.drawer.on { transform: translateX(0); }
.dh { background: var(--charcoal); color: #f2eee6; padding: 18px 20px; position: sticky; top: 0; z-index: 2; }
.dh .x { position: absolute; top: 14px; right: 16px; background: none; border: 0; color: #cfc9bc; font-size: 22px; line-height: 1; }
.dh h2 { font-size: 20px; margin: 0 30px 4px 0; color: #f6f2ea; }
.dh .dsub { font-size: 12.5px; color: #c7c1b4; }
.dbody { padding: 18px 20px; }
.sec { background: var(--paper); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 14px; overflow: hidden; }
.sec h4 { font-size: 13px; margin: 0; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fbf9f4; text-transform: uppercase; letter-spacing: .05em; color: #6e695c; display: flex; justify-content: space-between; align-items: center; }
.sec .in { padding: 13px 14px; }
.kv { display: flex; justify-content: space-between; gap: 18px; font-size: 13.5px; padding: 4px 0; }
.kv .k { color: var(--muted); }
.spine { list-style: none; margin: 0; padding: 6px 14px 12px; }
.spine li { display: flex; align-items: center; gap: 11px; padding: 6px 0; }
.spine .mk { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; background: var(--paper); }
.spine li.done .mk { background: var(--green); border-color: var(--green); }
.spine .ml { flex: 1; font-size: 13.5px; }
.spine li:not(.done) .ml { color: #b7b1a2; }
.spine .md { font-size: 12px; color: var(--muted); }
.admin-actions form { display: flex; gap: 8px; align-items: center; }
.admin-actions input { min-width: 150px; }
.mini-check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mini-check input, .check input { width: auto; }
.subrow td { background: #fbf8f1; }

.auth-body {
  min-height: 100vh;
  background: var(--charcoal);
  color: var(--charcoal);
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-wrap { width: min(420px, 100%); }
.auth-card {
  background: var(--paper);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 18px 48px rgba(0,0,0,.24);
}
.auth-mark {
  font-family: Georgia, serif;
  letter-spacing: .18em;
  color: var(--charcoal);
  margin-bottom: 22px;
}
.auth-mark small {
  display: block;
  margin-top: 3px;
  color: var(--gold);
  font: 9px Inter, sans-serif;
  letter-spacing: .26em;
}
.auth-card h1 { margin-bottom: 6px; }
.auth-card p, .muted { color: var(--muted); margin: 0 0 16px; }
.alert {
  background: #f9e7e1;
  border: 1px solid #e2b8ac;
  border-radius: 8px;
  color: #83311f;
  margin-bottom: 14px;
  padding: 9px 11px;
  font-weight: 650;
}
.auth-alt { margin-top: 12px; }
.auth-alt button {
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  padding: 0;
}
.secret {
  background: #fbf8f1;
  border: 1px dashed var(--gold);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  font-weight: 700;
}
.secret-box {
  background: #fbf8f1;
  border: 1px dashed var(--gold);
  border-radius: 8px;
  margin: 16px 0;
  padding: 11px 12px;
}
.secret-box span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.secret-box strong { display: block; font-family: Georgia, serif; font-size: 19px; overflow-wrap: anywhere; }
.qr-box {
  display: grid;
  place-items: center;
  background: #fbf8f1;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 16px 0;
  padding: 14px;
}
.qr-box img {
  display: block;
  width: min(260px, 100%);
  height: auto;
}
.code-input { text-align: center; font-size: 20px; letter-spacing: .12em; }
.auth-note { font-size: 12.5px; margin-top: 14px; }
.auth-note code { background: #f1e8d8; border-radius: 5px; padding: 2px 5px; }
.alert-text { color: var(--red); font-weight: 650; }

@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid.two, .form-grid { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr; }
  .col { min-height: 0; }
  .viewhead { align-items: flex-start; flex-direction: column; }
  .viewhead .sub { text-align: left; }
  .topbar .wrap { align-items: flex-start; flex-direction: column; padding-top: 12px; padding-bottom: 12px; }
  .logout-form { width: 100%; justify-content: space-between; }
  .admin-actions form { align-items: stretch; flex-direction: column; }
}
