:root {
  color-scheme: dark;
  --ground: #141513;
  --rail: #10110f;
  --panel: #1d1f1c;
  --field: #161815;
  --line: #363932;
  --line-strong: #51564b;
  --text: #f3f2e9;
  --muted: #b4b8aa;
  --yellow: #f2d317;
  --ink: #151610;
  --green: #a8d897;
  --red: #ffada0;
  --sidebar-width: 222px;
  --gutter: clamp(18px, 3vw, 48px);
  --mono: "Consolas", "Liberation Mono", monospace;
  --display: "Manrope", Arial, sans-serif;
  font: 400 14px/1.5 var(--display);
  color: var(--text);
  background: var(--ground);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .62; cursor: default; }
button, input, select, textarea { border-radius: 3px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--yellow); outline-offset: 3px;
}
::selection { color: var(--ink); background: var(--yellow); }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.wordmark {
  display: block; width: 100%; aspect-ratio: 266/48; background: currentColor;
  -webkit-mask: url("./assets/aidtool.svg") center / contain no-repeat;
  mask: url("./assets/aidtool.svg") center / contain no-repeat;
}
.shell, .main { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 2; width: var(--sidebar-width); overflow-y: auto;
  display: flex; flex-direction: column; padding: 30px 16px 16px;
  background: var(--rail); border-right: 1px solid var(--line);
}
.brand { display: block; width: 100%; padding: 0 10px; border: 0; background: none; color: var(--yellow); }
.brand-sub { display: block; margin-top: 8px; font: 600 9px/1.4 var(--display); letter-spacing: .21em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 5px; margin-top: 36px; border-top: 1px solid var(--line); padding-top: 20px; }
.nav-item, .account-password, .logout, .row-menu, .text-link, .modal-close {
  border: 0; background: none; color: var(--muted);
}
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 13px; text-align: left; font-weight: 650; }
.nav-item:hover, .account-password:hover, .logout:hover, .row-menu:hover { background: var(--panel); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--yellow); color: var(--ink); }
.nav-count { margin-left: auto; padding: 1px 5px; border: 1px solid var(--line); min-width: 22px; text-align: center; font: 12px/1.4 var(--mono); }
.nav-item[aria-current="page"] .nav-count { border-color: #938129; }
.sidebar-bottom { margin-top: auto; padding-top: 24px; }
.account-password, .sync { display: flex; align-items: center; gap: 10px; padding: 10px; font-size: 12px; }
.account-password { width: 100%; text-align: left; }
.sync { color: var(--muted); font-size: 11px; }
.sync i, .status-pill i { width: 6px; height: 6px; flex: none; background: currentColor; border-radius: 50%; }
.sync i { color: var(--green); }
.user-card { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 15px; }
.avatar, .tool-avatar { display: grid; place-items: center; background: #33372c; color: #ecebcf; flex: none; }
.avatar { width: 32px; height: 34px; clip-path: polygon(50% 0, 98% 24%, 98% 76%, 50% 100%, 2% 76%, 2% 24%); font-weight: 750; }
.user-meta { flex: 1; min-width: 0; display: grid; }
.user-meta b { font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.user-meta span, .muted-cell { color: var(--muted); font-size: 11px; }
.logout, .row-menu, .modal-close { padding: 8px; }
.main { margin-left: var(--sidebar-width); }
.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 12px var(--gutter); }
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb span { margin: 0 7px; color: #878d7d; }
.breadcrumb b { color: var(--text); font-weight: 600; }
.top-actions, .modal-actions { display: flex; align-items: center; gap: 8px; }
.primary-btn, .secondary-btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  padding: 9px 15px; min-height: 38px; font-size: 12px; font-weight: 750; line-height: 1.35; border: 1px solid transparent;
}
.primary-btn { color: var(--ink); background: var(--yellow); }
.primary-btn:hover:enabled { background: #ffe644; }
.secondary-btn { background: transparent; border-color: var(--line-strong); color: var(--text); }
.secondary-btn:hover { background: #292c25; border-color: #7b806e; }
.text-link { display: inline-flex; align-items: center; gap: 6px; color: var(--yellow); font-size: 12px; font-weight: 650; padding: 4px 0; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.text-link .icon { width: 15px; }
.content { max-width: 1610px; margin: auto; padding: 24px var(--gutter) 48px; }
.plate { background: var(--yellow); color: var(--ink); position: relative; isolation: isolate; overflow: hidden; clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px); }
.plate::after {
  content: ""; position: absolute; inset: 8px; pointer-events: none;
  --rivet: radial-gradient(circle, #11120e 0 2.5px, #a49316 3px, transparent 3.8px);
  background: var(--rivet) left top, var(--rivet) right top, var(--rivet) left bottom, var(--rivet) right bottom;
  background-repeat: no-repeat; background-size: 9px 9px;
}
.dashboard-plate { min-height: 148px; display: flex; align-items: center; margin-bottom: 16px; }
.plate-copy { position: relative; max-width: 63%; z-index: 1; padding: 23px clamp(25px, 3.2vw, 48px); }
.plate-date { display: flex; align-items: center; gap: 8px; font: 12px/1.4 var(--mono); }
.plate-date .icon { width: 15px; height: 15px; }
.plate-copy h1 { margin-top: 10px; font-size: clamp(34px, 3.5vw, 60px); font-weight: 800; letter-spacing: -.06em; line-height: 1.06; }
.plate-photo, .poster-photo {
  position: absolute; pointer-events: none; background: url("./assets/pipe-wrench.webp") center / cover no-repeat;
  mix-blend-mode: multiply;
}
.plate-photo { inset: 0 4% 0 auto; width: 37%; background-position: 50% 40%; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card, .panel, .modal { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.stat-card { min-width: 0; padding: 16px clamp(13px, 1.4vw, 21px) 13px; }
.stat-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: #dde0d4; font-size: 12px; font-weight: 600; }
.stat-top .icon { color: var(--muted); width: 16px; height: 16px; }
.stat-value, .chart-total { font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.055em; line-height: 1.15; }
.stat-value { display: block; margin: 9px 0 5px; font-size: clamp(22px, 2.1vw, 36px); overflow-wrap: anywhere; }
.stat-card:first-child .stat-value { color: var(--yellow); }
.stat-foot, .panel-heading p { color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; margin-bottom: 16px; }
.panel { --pad: clamp(15px, 1.6vw, 25px); min-width: 0; padding: var(--pad); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.panel-heading h2, .modal h2 { font-size: clamp(17px, 1.45vw, 23px); line-height: 1.2; letter-spacing: -.045em; }
.panel-heading p { margin-top: 4px; }
.select-control, .field select { border: 1px solid var(--line-strong); background-color: var(--field); color: var(--text); padding: 7px; }
.select-control { font-size: 12px; }
.chart-total { font-size: 30px; margin-top: 17px; }
.chart { height: 97px; display: flex; gap: 3px; margin-top: 10px; position: relative; }
.chart::before { position: absolute; content: ""; inset: 0 0 20px; background: repeating-linear-gradient(to top, var(--line) 0 1px, transparent 1px 33%); }
.chart-col { flex: 1; min-width: 0; display: flex; flex-direction: column; z-index: 1; }
.bar-wrap { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: 76%; max-width: 25px; background: var(--yellow); }
.chart-col > span { display: block; text-align: center; height: 20px; padding-top: 6px; color: var(--muted); font: 10px/1 var(--mono); }
.tool-list { margin: 15px 0 0; padding: 0; list-style: none; }
.tool-list li { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); padding: 8px 0; }
.tool-name { overflow-wrap: anywhere; }
.tool-count, .records-count { color: var(--muted); font: 12px/1.4 var(--mono); }
.empty-mini { min-height: 145px; display: grid; justify-items: center; align-content: center; gap: 3px; text-align: center; }
.empty-mini .icon { color: #8b917f; width: 32px; height: 32px; margin-bottom: 6px; }
.empty-mini span, .empty-state p { font-size: 12px; color: var(--muted); }
.empty-state { display: flex; align-items: center; gap: 14px; border-top: 1px solid var(--line); margin-top: 18px; padding: 21px 0 3px; }
.empty-state h3 { font-size: 14px; font-weight: 650; }
.empty-state .secondary-btn { margin-left: auto; }
.empty-art, .tool-avatar { background: #2b2e27; color: #bfc5b0; padding: 9px; border: 1px solid var(--line); }
.empty-art .icon { width: 21px; height: 21px; }
.journal-heading { margin: 7px 0 24px; padding-left: 15px; border-left: 4px solid var(--yellow); }
.journal-heading h1, .auth-title, .setup-card h1 { font-size: clamp(28px, 3vw, 44px); letter-spacing: -.055em; line-height: 1.12; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.search-box { display: flex; align-items: center; gap: 8px; padding: 4px 10px; width: min(350px, 70%); color: var(--muted); }
input, textarea, .search-box, .field select { background: var(--field); color: var(--text); border: 1px solid var(--line-strong); }
input::placeholder, textarea::placeholder { color: #92998b; opacity: 1; }
.search-box input { width: 100%; min-width: 0; padding: 6px 0; background: none; border: 0; }
.table-wrap { margin: 16px calc(-1 * var(--pad)) 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th, td { padding: 12px var(--pad); border-top: 1px solid var(--line); }
th { color: var(--muted); background: var(--field); font: 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
td { font-size: 13px; }
.primary-cell { display: flex; align-items: center; gap: 9px; }
.tool-avatar { width: 29px; height: 29px; padding: 0; }
.price-cell { font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 8px; border-radius: 3px; }
.status-pill.active { background: #2b3828; color: var(--green); }
.status-pill.completed { background: #2a3033; color: #cad5db; }
.status-pill.cancelled { background: #402c29; color: var(--red); }
.notice { position: relative; margin-bottom: 14px; padding: 12px 36px 12px 14px; border: 1px solid currentColor; font-size: 13px; }
.success { color: var(--green); }
.error, .modal-error { color: var(--red); }
.notice button { position: absolute; right: 8px; top: 4px; border: 0; background: none; color: inherit; font-size: 21px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: #070806ba; }
.modal { width: min(525px, 100%); max-height: 94vh; overflow: auto; padding: 22px; box-shadow: 0 16px 65px #0006; border-top: 3px solid var(--yellow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-close { font-size: 24px; line-height: 1; }
.field, .auth-field { display: grid; gap: 6px; min-width: 0; margin-bottom: 14px; }
.field label, .auth-field label { font-size: 12px; font-weight: 650; }
.field em { color: var(--yellow); font-style: normal; }
.field input, .field select, .field textarea, .auth-field input { min-width: 0; width: 100%; padding: 9px 11px; }
.field textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(2,minmax(0, 1fr)); gap: 12px; }
.modal-actions { justify-content: flex-end; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.login-page, .setup-page { display: grid; min-height: 100vh; place-items: center; padding: clamp(16px, 4vw, 64px); }
.access-shell { width: min(100%, 1040px); display: grid; grid-template-columns: 1.08fr 1fr; background: var(--panel); border: 1px solid var(--line); padding: 9px; }
.brand-poster { min-height: 485px; display: flex; flex-direction: column; gap: 12px; padding: clamp(30px, 4vw, 56px); }
.poster-mark, .poster-caption { position: relative; z-index: 1; }
.poster-photo { inset: 38% 0 0; background-position: center top; background-size: 100% auto; }
.poster-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font: 700 clamp(12px, 1.25vw, 18px)/1.2 var(--display); text-transform: uppercase; letter-spacing: .08em; }
.login-card { align-self: center; padding: clamp(25px, 3.6vw, 52px); min-width: 0; }
.login-card > p, .setup-card p { margin: 12px 0 24px; color: var(--muted); }
.auth-field input { min-height: 45px; }
.full { width: 100%; min-height: 43px; font-size: 14px; }
.form-message { font-size: 12px; }
.form-message:not(:empty) { margin-top: 10px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; margin-top: 18px; }
.setup-card { max-width: 540px; border: 1px solid var(--line); border-top: 3px solid var(--yellow); background: var(--panel); padding: 32px; }
.setup-wordmark { width: 155px; color: var(--yellow); margin: 0 0 28px; }
.setup-card ol { padding-left: 20px; }
.setup-foot { padding-top: 12px; color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) {
  :root { --sidebar-width: 195px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .stat-top, .stat-foot { font-size: 12px; }
}
@media (max-width: 780px) {
  :root { --gutter: 16px; }
  .sidebar { width: auto; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 12px var(--gutter) 0; border-right: 0; border-bottom: 1px solid var(--line); gap: 9px; overflow: visible; }
  .brand { width: 130px; align-self: center; padding: 0; }
  .brand-sub { margin-top: 4px; font-size: 7px; }
  .sidebar nav { grid-column: 1/-1; grid-row: 2; margin: 0; border-top: 0; display: flex; padding: 0 0 8px; }
  .nav-item { padding: 8px 12px; }
  .sidebar-bottom { grid-row: 1; grid-column: 2; display: flex; align-items: center; margin: 0; padding: 0; gap: 4px; }
  .account-password { font-size: 11px; padding: 7px; gap: 3px; }
  .sync, .avatar, .user-meta { display: none; }
  .user-card { border: 0; margin: 0; padding: 0; }
  .main { margin-left: 0; min-height: 0; }
  .topbar { min-height: 54px; }
  .content { padding-top: 16px; }
  .brand-poster { min-height: 360px; padding: 28px; }
  .login-card { padding: 25px; }
}
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; gap: 6px; }
  .topbar .breadcrumb { font-size: 11px; }
  .top-actions { margin-left: auto; }
  .dashboard-plate { min-height: 125px; }
  .plate-copy { padding: 19px 19px; max-width: 66%; }
  .plate-copy h1 { font-size: clamp(25px, 6.8vw, 37px); }
  .plate-date { gap: 4px; font-size: 10px; }
  .plate-photo { right: 0; width: 36%; background-position: 64% center; mask-image: linear-gradient(to right, transparent, #000 16%); }
  .stat-card { padding: 13px; }
  .stat-foot { font-size: 11px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .empty-mini { min-height: 115px; }
  .empty-state { flex-wrap: wrap; }
  .empty-state .secondary-btn { margin-left: 0; }
  .access-shell { grid-template-columns: 1fr; max-width: 430px; }
  .brand-poster { min-height: 125px; padding: 20px; justify-content: center; align-items: flex-start; gap: 8px; }
  .poster-mark { width: 56%; }
  .poster-photo { inset: 0 0 0 auto; width: 38%; background-size: cover; background-position: 64% center; mask-image: linear-gradient(to right, transparent, #000 16%); }
  .poster-caption { font-size: 9px; gap: 4px; }
  .login-card { padding: 25px 14px 18px; }
  .auth-field input, .field input, .field select, .field textarea { font-size: 16px; }
  .modal { padding: 16px; }
  .modal-actions { position: sticky; bottom: -16px; background: var(--panel); padding: 10px 0; }
}
@media (max-width: 400px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .topbar .breadcrumb { display: none; }
  .topbar { justify-content: flex-end; }
  .primary-btn, .secondary-btn { padding: 8px 10px; }
}

.stock-panel { padding:20px; margin-bottom:16px; }
.stock-panel .panel-heading { align-items:center; flex-wrap:wrap; gap:12px; }
.stock-panel p { color:var(--muted); }
.stock-panel td { overflow-wrap:anywhere; }
.members { border:1px solid var(--line); padding:12px; max-height:210px; overflow:auto; }
.members label { display:flex; align-items:center; gap:8px; padding:5px 0; }
.phone-field { display:flex; align-items:center; gap:8px; }
.phone-field input { min-width:0; }
.nearest { color:var(--yellow); background:var(--ink); font-weight:700; }
.rental-clock { display:block; white-space:nowrap; margin-top:5px; font-variant-numeric:tabular-nums; }
.rental-clock.late { color:var(--red); font-weight:700; }
.rental-actions { display:flex; flex-wrap:wrap; gap:4px 10px; }
.rental-actions button { padding:5px 0; border:0; background:none; color:var(--text); text-decoration:underline; cursor:pointer; }
.rental-actions button[data-operation="return"] { color:var(--yellow); }
.rental-actions button[data-operation="delete"] { color:var(--red); }
.sidebar nav { overflow-x:auto; }

.stock-tabs { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.position-picker { min-width:0; padding:12px; margin:0 0 14px; border:1px solid var(--line); }
.position-picker legend { padding:0 6px; font-weight:650; }
.position-row { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.position-search { flex:1; min-width:0; position:relative; }
.position-search input { width:100%; padding:9px; background:var(--panel); color:var(--text); border:1px solid var(--line); }
.position-options { position:relative; max-height:180px; overflow:auto; border:1px solid var(--line); padding:4px; }
.position-options button { display:block; width:100%; text-align:left; background:var(--panel); color:var(--text); padding:8px; border:0; cursor:pointer; }
.position-options button:hover,.position-options button:focus { background:var(--yellow); color:var(--ink); }
.line-price,.rental-total { font-variant-numeric:tabular-nums; }
.rental-total { font-size:1.3rem; font-weight:700; }
.remove-position { background:transparent; border:0; color:var(--text); font-size:20px; cursor:pointer; }
.remove-position:disabled { opacity:.25; }

.status-pill.booked {color:var(--yellow);}
.stock-tabs {overflow-x:auto;}
.desk-line {display:flex;align-items:center;gap:12px;justify-content:space-between;padding:12px 0;border-top:1px solid var(--line);flex-wrap:wrap;}
.desk-line>span {flex:1;min-width:170px;}
.desk-line small,.receive-list label,.price-cell small {display:block;}
.desk-line small,.receive-list small {color:var(--muted);}
.desk-line a {color:var(--text);}
.receive-list {padding:12px;border:1px solid var(--line);margin:10px 0;}
.receive-list label {padding:6px 0;}
.position-options button:disabled {opacity:.6;cursor:default;}
.sync::before {content:'';width:7px;height:7px;border-radius:50%;background:var(--yellow);flex:none;}
.sync[data-live=yes]::before {background:var(--green);}
@media(max-width:780px){.sidebar .sync {display:flex;font-size:10px;padding:2px;gap:3px;} .sidebar nav button {white-space:nowrap;}}

.lead-filters {display:flex;gap:14px;align-items:end;flex-wrap:wrap;margin-bottom:18px}
.lead-filters .field {min-width:140px;flex:1;margin:0}
.lead-report td small {display:block;color:var(--muted);margin-top:4px}
.journal-heading:has([data-add-lead]) {display:flex;align-items:center;justify-content:space-between;gap:12px}
#lead-first:not(:empty) {display:block;margin-bottom:12px;color:var(--muted)}
@media(max-width:600px){.top-actions {flex-wrap:wrap;justify-content:flex-end}.lead-filters .field {flex-basis:42%}}

.kit-slot { border:1px solid var(--line); margin:12px 0; padding:10px; min-width:0; }
.kit-slot .field { margin:0 0 8px; }
.slot-options { display:grid; gap:4px; max-height:120px; overflow:auto; margin-bottom:8px; }
.slot-options label { display:flex; align-items:center; gap:6px; cursor:pointer; }
.slot-options input { accent-color:var(--yellow); }
.position-row { flex-wrap:wrap; }
.kit-selection:empty { display:none; }
.kit-selection { flex:0 0 100%; display:grid; gap:5px; padding:6px 0; }
.kit-selection p { color:var(--muted); }
.kit-selection label { display:grid; gap:3px; }
.kit-selection select { width:100%; max-width:100%; padding:6px; background:var(--panel); color:var(--text); border:1px solid var(--line); }
.tool-specs-modal { width:min(680px,100%); }
.tool-specs-name { color:var(--muted); margin-bottom:14px; overflow-wrap:anywhere; }
.tool-specs-table { white-space:normal; table-layout:fixed; }
.tool-specs-table th, .tool-specs-table td { vertical-align:top; overflow-wrap:anywhere; padding:9px 12px; }
.tool-specs-table th { width:55%; text-transform:none; letter-spacing:normal; font:inherit; color:var(--muted); }
.tool-specs-table td { font-size:inherit; }
.tool-specs-plain { overflow-wrap:anywhere; }
.specs-hint { color:var(--muted); }
.stock-search { margin:0 0 12px; width:min(100%,420px); }
