:root {
  --bg: #0c0d0f; --panel: #131518; --panel-2: #191b1f; --line: #292c31; --line-2: #34373d;
  --text: #f2f0ed; --muted: #a3a5aa; --faint: #777b82;
  --chrome: linear-gradient(135deg, #ffffff 0%, #d9dce2 45%, #9ea3ad 100%);
  --ok: #7fd4a0; --warn: #f0c674; --bad: #f08a7e; --info: #9fc3f0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
.wrap { width: min(1160px, calc(100% - 48px)); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.inline { display: inline; margin: 0; }

.topbar { position: sticky; top: 0; z-index: 20; background: rgba(12,13,15,.9); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(255,255,255,.07); }
.nav { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: .28em; font-size: .85rem; text-decoration: none; }
.brand small { display: block; color: var(--muted); font-size: .56rem; letter-spacing: .25em; font-weight: 600; margin-top: -2px; }
.mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #3d4047; border-radius: 9px; }
.mark img { width: 26px; height: 26px; object-fit: contain; }
.navlinks { display: flex; align-items: center; gap: 22px; color: #c4c5c8; font-size: .88rem; }
.navlinks a { text-decoration: none; }
.navlinks a:hover, .linkish:hover { color: #fff; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; color: #c4c5c8; font-size: .88rem; }

.button, .nav-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 7px;
  border: 1px solid #d6d9df; background: var(--chrome); color: #0c0d0f !important; font-weight: 750; font-size: .9rem;
  text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease;
}
.button:hover, .nav-cta:hover { background: #fff; transform: translateY(-1px); }
.button.secondary { background: transparent; border-color: #41444a; color: var(--text) !important; }
.button.secondary:hover { border-color: #8f9298; }
.button.danger { background: transparent; border-color: #6b3a35; color: var(--bad) !important; }
.button.danger:hover { border-color: var(--bad); }
.button.small { padding: 7px 12px; font-size: .8rem; }
.button[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

main.app { flex: 1; padding: 44px 0 80px; }
.eyebrow { color: #c9ccd2; text-transform: uppercase; letter-spacing: .2em; font-size: .72rem; font-weight: 800; }
h1.page { margin: 8px 0 6px; font-size: clamp(2rem, 4.5vw, 2.9rem); line-height: 1.05; letter-spacing: -.05em; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head p { margin: 0; }

.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 24px; margin-bottom: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 1.12rem; letter-spacing: -.01em; }
.panel h2 .muted { font-weight: 500; font-size: .85rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel.highlight { border-color: #5b5f67; background: radial-gradient(ellipse at 100% 0%, rgba(214,218,226,.08), transparent 55%), var(--panel); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.narrow { max-width: 460px; margin: 30px auto; }
.mid { max-width: 760px; margin: 0 auto; }

.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 650; font-size: .86rem; margin-bottom: 6px; color: #dcdde0; }
.field .hint { color: var(--faint); font-size: .8rem; margin-top: 5px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; background: #0f1012; border: 1px solid var(--line-2); border-radius: 8px; padding: 11px 13px; outline: none;
  transition: border-color .15s ease;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #a3a5aa; }
input[type=file] { width: 100%; padding: 12px; border: 1px dashed var(--line-2); border-radius: 8px; background: #0f1012; color: var(--muted); }
.code-input { font: 700 1.8rem/1 ui-monospace, SFMono-Regular, Menlo, monospace !important; letter-spacing: .5em; text-align: center; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.check { display: flex; gap: 8px; align-items: center; font-size: .88rem; color: #c9ccd2; }

.alert { border: 1px solid var(--line-2); border-radius: 9px; padding: 12px 16px; margin-bottom: 18px; font-size: .92rem; }
.alert-ok { border-color: #2f5a41; background: rgba(127,212,160,.08); color: #c6ecd4; }
.alert-error { border-color: #6b3a35; background: rgba(240,138,126,.08); color: #f6c9c3; }
.alert-info { border-color: #34465e; background: rgba(159,195,240,.08); color: #d3e3f7; }

.badge { display: inline-block; vertical-align: middle; letter-spacing: .01em; line-height: 1.5; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; border: 1px solid var(--line-2); color: #d5d6d9; white-space: nowrap; }
.s-new { border-color: #34465e; color: var(--info); }
.s-quoted { border-color: #5e5234; color: var(--warn); }
.s-approved, .s-in_progress { border-color: #4a4d55; color: #e6e7ea; }
.s-waiting_parts { border-color: #5e5234; color: var(--warn); }
.s-ready { border-color: #2f5a41; color: var(--ok); }
.s-completed { border-color: #2f5a41; color: #a9d9bb; }
.s-declined, .s-cancelled { border-color: #4a3431; color: #b98c86; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #fff; margin-left: 6px; vertical-align: middle; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--faint); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 800; border-top: 1px solid var(--line-2); border-bottom: 0; }
.table a.ref { font-weight: 750; text-decoration: none; font-family: ui-monospace, monospace; }
.table a.ref:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; }
.clickable tbody tr { cursor: pointer; }
.clickable tbody tr:hover td { background: var(--panel-2); }

.progress { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); padding: 0; margin: 4px 0 0; counter-reset: p; }
.progress li { position: relative; text-align: center; font-size: .75rem; color: var(--faint); padding-top: 22px; }
.progress li span { position: absolute; top: 0; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 2px solid #41444a; background: var(--bg); z-index: 1; }
.progress li:before { content: ""; position: absolute; top: 6px; left: -50%; width: 100%; height: 2px; background: #2c2f34; }
.progress li:first-child:before { display: none; }
.progress li.done, .progress li.current { color: #e6e7ea; }
.progress li.done span { background: #d6d9df; border-color: #d6d9df; }
.progress li.done:before, .progress li.current:before { background: #8f9298; }
.progress li.current span { border-color: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.1); }

.dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; font-size: .92rem; }
.dl dt { color: var(--faint); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.details-text { white-space: pre-wrap; color: #d5d6d9; font-size: .93rem; margin: 14px 0 0; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 14px; }
.photos a { position: relative; display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: .68rem; background: rgba(0,0,0,.65); color: #ddd; }

.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; max-height: 460px; overflow-y: auto; }
.msg { max-width: 85%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.msg.mine { align-self: flex-end; background: #1f2126; border-color: #3a3d44; }
.msg-meta { font-size: .72rem; color: var(--faint); margin-bottom: 3px; }
.msg-body { font-size: .92rem; overflow-wrap: anywhere; }

.slots { display: grid; gap: 14px; }
.slot-day h3 { margin: 0 0 8px; font-size: .85rem; color: #c9ccd2; }
.slot-times { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-times label { cursor: pointer; }
.slot-times input { position: absolute; opacity: 0; pointer-events: none; }
.slot-times span { display: inline-block; padding: 8px 13px; border: 1px solid var(--line-2); border-radius: 7px; font-size: .85rem; background: #0f1012; }
.slot-times input:checked + span { border-color: #fff; background: #fff; color: #0c0d0f; font-weight: 700; }
.slot-times input:focus-visible + span { outline: 2px solid #9fc3f0; }
.booking { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 9px; margin-bottom: 10px; }

.money-big { font-size: 2rem; font-weight: 850; letter-spacing: -.04em; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { border: 1px solid var(--line); border-radius: 11px; background: var(--panel); padding: 18px 20px; text-decoration: none; display: block; }
.stat:hover { border-color: #5b5f67; }
.stat b { display: block; font-size: 1.9rem; letter-spacing: -.04em; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .82rem; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { text-decoration: none; padding: 7px 13px; border-radius: 7px; border: 1px solid var(--line); font-size: .84rem; color: #c4c5c8; }
.tabs a.on { border-color: #d6d9df; color: #fff; background: var(--panel-2); }
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.toolbar form { display: flex; gap: 8px; }
.toolbar input { min-width: 240px; }

.items-editor .item { display: grid; grid-template-columns: minmax(0, 1fr) 90px 120px 36px; gap: 8px; margin-bottom: 8px; }
.items-editor .head { font-size: .72rem; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
.remove-item { background: none; border: 1px solid var(--line-2); border-radius: 8px; color: var(--muted); cursor: pointer; }
.remove-item:hover { color: var(--bad); border-color: var(--bad); }
.total-line { text-align: right; font-weight: 800; margin: 10px 0 14px; }

.timeline { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li:before { content: ""; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: #8f9298; }
.timeline .when { color: var(--faint); font-size: .76rem; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--faint); font-size: .8rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.footer-brand { display: flex; align-items: center; gap: 10px; color: #e9e7e3; font-weight: 800; letter-spacing: .12em; }
.footer-brand img { width: 30px; height: 30px; object-fit: contain; }
.footer-link { color: #c4c5c8; text-decoration: none; }
.footer-link:hover { color: #fff; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }
  .nav { min-height: 64px; }
  .navlinks { gap: 14px; font-size: .8rem; }
  .brand { letter-spacing: .2em; font-size: .78rem; }
  .brand > span:last-child { display: none; }
  .nav-cta { padding: 8px 11px; font-size: .78rem; }
  main.app { padding-top: 30px; }
  .panel { padding: 18px; }
  .row, .row-3 { grid-template-columns: 1fr; gap: 0; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .progress li { font-size: 0; }
  .items-editor .item { grid-template-columns: minmax(0, 1fr) 60px 90px 32px; }
  .toolbar input { min-width: 0; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; } }
