:root {
  --canvas: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --ink: #111318;
  --ink-2: #4b5160;
  --ink-3: #8a909c;
  --line: #e4e6eb;
  --line-strong: #d3d6dd;
  --side: #121418;
  --side-2: #1b1e24;
  --side-ink: #e9ebef;
  --side-ink-2: #9aa0ab;
  --accent: #f6752e;
  --accent-ink: #ffffff;
  --accent-soft: #fdf0e7;
  --ok: #1f8a4c;
  --ok-soft: #e7f5ec;
  --warn: #a8670b;
  --warn-soft: #fbf2e1;
  --bad: #c1353a;
  --bad-soft: #fbeaea;
  --info: #2c5fb3;
  --info-soft: #e9f0fb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(17, 19, 24, 0.04), 0 4px 16px rgba(17, 19, 24, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 620; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.hidden, [hidden] { display: none !important; }

.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; text-decoration: none; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: var(--side-ink-2); font-size: 11.5px; }
.sidebar nav { flex: 1; overflow-y: auto; }
.nav-group { margin-bottom: 14px; }
.nav-group p { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: #6b717c; padding: 0 10px 6px; }
.nav-group a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink-2); text-decoration: none; font-weight: 500; }
.nav-group a svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-group a:hover { background: var(--side-2); color: var(--side-ink); }
.nav-group a[aria-current="page"] { background: var(--side-2); color: #ffffff; box-shadow: inset 2px 0 0 var(--accent); }
.badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 650; text-align: center; line-height: 18px; }
.account { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid #22262d; }
.avatar { width: 34px; height: 34px; border-radius: 9px; background: #2a2e36; display: grid; place-items: center; font-weight: 650; font-size: 13px; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.who { min-width: 0; flex: 1; }
.who strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { display: block; font-size: 11.5px; color: var(--side-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button { border: 0; background: none; color: inherit; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .icon-button:hover { background: var(--side-2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar .menu { display: none; }
.crumb { font-weight: 600; color: var(--ink-2); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.content { padding: 28px 32px 64px; max-width: 1240px; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; color: var(--ink-2); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-body { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.side { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.grid.designer { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { padding: 18px 20px; }
.stat .label { font-size: 12px; color: var(--ink-3); font-weight: 550; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .hint { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(0.96); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; height: 44px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.loading { color: transparent !important; position: relative; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; animation: spin 0.7s linear infinite; }
.btn:not(.primary):not(.dark).loading::after { border-color: var(--ink-2) var(--ink-2) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 550; color: var(--ink); }
label.field small { font-weight: 400; color: var(--ink-3); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(17, 19, 24, 0.06); }
textarea { min-height: 88px; resize: vertical; }
input[type="color"] { padding: 3px; height: 38px; width: 56px; cursor: pointer; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.field-error { color: var(--bad); font-size: 12px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: #fafbfc; }
.table .sub { color: var(--ink-3); font-size: 12px; }

.list-item { display: flex; gap: 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); text-decoration: none; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #fafbfc; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trade-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); flex: none; }
.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 15px; }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }

.lines { display: grid; gap: 10px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 80px 120px 110px 36px; gap: 8px; align-items: center; }
.line-head { font-size: 11.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.totals { display: grid; gap: 6px; margin-left: auto; width: 280px; }
.totals div { display: flex; justify-content: space-between; color: var(--ink-2); }
.totals .grand { padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 650; font-size: 16px; }

.preview { width: 100%; height: 860px; border: 0; border-radius: var(--radius); background: #e9ebef; }
.preview-frame { position: sticky; top: 80px; }
.preview-frame .card-head { border-bottom: 0; }
.logo-box { display: flex; align-items: center; gap: 14px; }
.logo-box .logo { width: 132px; height: 56px; border: 1px dashed var(--line-strong); border-radius: 10px; display: grid; place-items: center; background: #fff; overflow: hidden; color: var(--ink-3); font-size: 12px; }
.logo-box .logo img { max-width: 100%; max-height: 100%; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }

.chat { display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 520px; overflow-y: auto; background: #fafbfc; }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--ink); color: #fff; border-color: var(--ink); }
.msg.system { align-self: center; background: none; border: 0; color: var(--ink-3); font-size: 12.5px; text-align: center; max-width: 85%; }
.msg.staff { border-color: var(--accent); }
.msg .who { font-size: 11px; font-weight: 600; color: var(--ink-3); margin-bottom: 2px; }
.msg.mine .who { color: rgba(255, 255, 255, 0.6); }
.composer { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 42px; height: 42px; }
.split { display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.split > .threads { border-right: 1px solid var(--line); max-height: 640px; overflow-y: auto; }

.steps { display: grid; gap: 0; }
.step { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); font-weight: 650; flex: none; }
.step.done .dot { background: var(--ok-soft); color: var(--ok); }
.callout { padding: 14px 16px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.callout.accent { background: var(--accent-soft); color: #7a3a12; }
.callout.ok { background: var(--ok-soft); color: var(--ok); }
.callout.bad { background: var(--bad-soft); color: var(--bad); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 550; }
.signature { width: 100%; height: 150px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.qr { width: 184px; height: 184px; border: 1px solid var(--line); border-radius: 10px; image-rendering: pixelated; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes span { background: var(--surface-2); border-radius: 8px; padding: 6px; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 550; z-index: 50; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18); }
.toast.bad { background: var(--bad); }
.dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, 92vw); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2); }
.dialog::backdrop { background: rgba(17, 19, 24, 0.45); }
.dialog form { padding: 22px; display: grid; gap: 14px; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }

.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth.single { grid-template-columns: 1fr; }
.auth-side { background: var(--side); color: var(--side-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { color: #fff; font-size: 34px; line-height: 1.15; max-width: 440px; }
.auth-side ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; color: var(--side-ink-2); max-width: 420px; }
.auth-side li strong { color: #fff; display: block; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 16px; }
.auth-card .code { font-size: 26px; letter-spacing: 8px; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.skeleton { background: linear-gradient(90deg, #eef0f3, #f6f7f9, #eef0f3); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1100px) {
  .grid.side, .grid.designer { grid-template-columns: 1fr; }
  .preview-frame { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform 0.2s; }
  body.menu-open .sidebar { transform: none; }
  .topbar { padding: 0 16px; }
  .topbar .menu { display: grid; }
  .content { padding: 20px 16px 48px; }
  .grid.two, .grid.three, .form-grid, .split, .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .line { grid-template-columns: 1fr 60px 90px; }
  .line .vat, .line .remove { display: none; }
}
.logo-box .stack { gap: 6px; align-items: flex-start; }
details summary { cursor: pointer; }
.list-item[aria-current] { background: #fafbfc; box-shadow: inset 2px 0 0 var(--accent); }
.tabs button { white-space: nowrap; }

fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 550; }
fieldset.field legend small { font-weight: 400; color: var(--ink-3); }
input[type="range"] { padding: 0; border: 0; box-shadow: none; accent-color: var(--accent); }
.pill.accent { background: var(--accent-soft); color: #9a4310; }
.prewrap { white-space: pre-wrap; }
.ellipsis { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stack.tight { gap: 8px; }
.card-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.link-button { border: 0; background: none; padding: 0; font: inherit; color: var(--ink-3); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-button:hover { color: var(--ink); }
.dialog.wide { width: min(760px, 94vw); }
.dialog form { max-height: 88vh; overflow-y: auto; }
.dialog .actions.wrap { flex-wrap: wrap; }

.person { display: flex; align-items: center; gap: 12px; }
.person .title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.avatar-sm { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; font-weight: 650; flex: none; }
.avatar-lg { width: 56px; height: 56px; border-radius: 14px; background: var(--side); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 18px; flex: none; }
tr.invited td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

.portfolio { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding: 20px; }
.portfolio.compact { padding: 0; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.project { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.project img, .project-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-2); }
.project-empty { display: grid; place-items: center; color: var(--ink-3); font-size: 12px; }
.project figcaption { padding: 10px 12px 12px; display: grid; gap: 2px; }
.project figcaption .btn { justify-self: start; margin: 6px 0 0 -10px; }
.profile-preview { display: grid; gap: 18px; }
.review { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 4px; }
.stars-static { color: var(--ink); letter-spacing: 1px; }
.stars-static span, .star-off { color: var(--line-strong); }
.stars { display: flex; gap: 2px; }
.stars button { border: 0; background: none; padding: 0 2px; font-size: 26px; line-height: 1; color: var(--line-strong); cursor: pointer; }
.stars button.on { color: var(--accent); }
.mini-list { display: grid; gap: 8px; }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day { border-right: 1px solid var(--line); min-height: 380px; display: flex; flex-direction: column; min-width: 0; }
.day:last-child { border-right: 0; }
.day.past { background: #fbfbfc; }
.day-head { display: flex; align-items: baseline; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.day-head strong { font-size: 16px; color: var(--ink); letter-spacing: 0; }
.day.today .day-head strong { color: var(--accent-ink); background: var(--accent); border-radius: 999px; min-width: 26px; text-align: center; padding: 0 6px; }
.day-body { padding: 8px; display: grid; gap: 8px; align-content: start; }
.visit { display: grid; gap: 2px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink); border-radius: 8px; padding: 8px 10px; }
.visit:hover { background: #fafbfc; }
.visit.proposed { border-left-color: var(--accent); }
.visit.completed { border-left-color: var(--line-strong); }
.visit.declined, .visit.cancelled { border-left-color: var(--line); opacity: 0.6; }
.visit.cancelled .visit-title { text-decoration: line-through; }
.visit .pill { justify-self: start; margin-top: 4px; }
.visit-time { font-weight: 650; font-size: 12.5px; }
.visit-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visit-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-empty { padding: 12px 20px; border-top: 1px solid var(--line); margin: 0; }
.agenda-day { display: grid; grid-template-columns: 150px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.agenda-day:last-child { border-bottom: 0; }
.agenda-date { padding: 14px 20px; font-weight: 600; color: var(--ink-2); border-right: 1px solid var(--line); }
.agenda-date.today { color: var(--accent); }
.visit-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.visit-row:hover { background: #fafbfc; }
.visit-when { width: 120px; display: grid; flex: none; }

.thread .thread-top, .thread .thread-last { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.thread .thread-last { margin-top: 2px; color: var(--ink-3); }
.thread.unread .title { font-weight: 700; }
.thread.unread .thread-last { color: var(--ink); font-weight: 550; }
.thread .badge { margin-left: 0; flex: none; }
.bubble { display: flex; flex-direction: column; align-items: flex-start; max-width: 72%; gap: 3px; }
.bubble.mine { align-self: flex-end; align-items: flex-end; }
.bubble .msg { max-width: 100%; white-space: normal; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bare { padding: 4px; }
.msg.staff { white-space: normal; }
.msg-meta { font-size: 11px; color: var(--ink-3); display: flex; gap: 8px; padding: 0 4px; }
.msg-meta .link-button { visibility: hidden; font-size: 11px; }
.bubble:hover .msg-meta .link-button, .msg-meta .link-button:focus { visibility: visible; }
.attachments { display: grid; grid-template-columns: repeat(2, minmax(0, 140px)); gap: 4px; margin-top: 6px; }
.msg.bare .attachments, .msg.bare .voice, .msg.bare video, .msg.bare .removed { margin-top: 0; }
.attachments.single { grid-template-columns: minmax(0, 260px); }
.attachments a { display: block; }
.attachments img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; background: var(--surface-2); }
.voice { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.voice audio { width: 260px; max-width: 100%; height: 36px; }
.voice-length { font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.7; }
.msg video { display: block; width: 300px; max-width: 100%; border-radius: 10px; margin-top: 6px; background: #000; }
.removed { display: grid; gap: 2px; margin-top: 6px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 10px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); }
.msg.mine .removed { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.3); color: rgba(255, 255, 255, 0.85); }
.composer { align-items: flex-end; }
.composer .attach { color: var(--ink-2); border: 1px solid var(--line-strong); width: 42px; height: 42px; flex: none; }
.composer .attach:hover { background: var(--surface-2); }
.composer-main { flex: 1; min-width: 0; display: grid; gap: 8px; }
.composer.blocked { justify-content: center; }
.pending-files { display: flex; gap: 8px; flex-wrap: wrap; }
.pending-file { position: relative; }
.pending-file img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.pending-file button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 13px; line-height: 20px; padding: 0; cursor: pointer; }

.table th.check, .table td.check { text-align: center; width: 72px; }
.prefs td { padding-top: 11px; padding-bottom: 11px; }

@media (max-width: 860px) {
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .day:last-child { border-bottom: 0; }
  .agenda-day { grid-template-columns: 1fr; }
  .agenda-date { border-right: 0; padding-bottom: 0; }
  .bubble { max-width: 88%; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
label.btn { position: relative; }
label.btn:focus-within { box-shadow: 0 0 0 3px rgba(17, 19, 24, 0.12); }
.nowrap { white-space: nowrap; }
.grow-row { flex: 1; min-width: 0; }
.grow-row input[type="search"] { max-width: 320px; }
.grow-row select { width: auto; min-width: 160px; }
.card-head input[type="search"] { height: 36px; padding: 6px 11px; }
.card-head select { height: 36px; padding: 6px 11px; }

.table.compact th { padding: 8px 12px; }
.table.compact td { padding: 8px 12px; }
.table tfoot td { border-top: 1px solid var(--line); border-bottom: 0; background: #fafbfc; }
.pricebook td { padding-top: 10px; padding-bottom: 10px; }
.pricebook th:nth-child(2), .pricebook td:nth-child(2) { width: 150px; }
.pricebook th:nth-child(3), .pricebook td:nth-child(3) { width: 110px; }
.pricebook th:nth-child(4), .pricebook td:nth-child(4) { width: 120px; }
.pricebook th:nth-child(5), .pricebook td:nth-child(5) { width: 104px; }
.pricebook th:nth-child(6), .pricebook td:nth-child(6) { width: 110px; }
.pricebook th:last-child, .pricebook td:last-child { width: 196px; }
.pricebook input, .pricebook select { padding: 7px 9px; }
.pricebook td.num input { text-align: right; }
.pricebook .add-row td { background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.pricebook .add-row input, .pricebook .add-row select { background: var(--surface); }
.pricebook .edit-row td { background: #fafbfc; vertical-align: top; }
.pricebook .sub-input { margin-top: 6px; font-size: 12.5px; }
.pricebook tr.inactive td { color: var(--ink-3); }
.pricebook tr.inactive strong { color: var(--ink-2); font-weight: 550; }
.pricebook td .btn + .btn { margin-left: 2px; }

.pick-list { display: grid; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 400; }
.pick:last-child { border-bottom: 0; }
.pick:hover { background: #fafbfc; }
.pick:has(input:checked) { background: var(--accent-soft); }
.pick input { width: auto; flex: none; accent-color: var(--accent); }
.pick .grow { flex: 1; min-width: 0; display: grid; }
.pick .sub, .pick .num .sub { display: block; color: var(--ink-3); font-size: 12px; }
.pick .num { flex: none; }

.quote-tools { gap: 8px; }
[data-save-template] { justify-self: center; align-self: center; }

.grid.templates { grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
.template-item { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.template-item:hover { background: #fafbfc; }
.stages { display: grid; gap: 8px; }
.stage-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 110px 36px; gap: 8px; align-items: center; }
.percent { position: relative; display: block; }
.percent input { padding-right: 28px; text-align: right; }
.percent span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
[data-preset] { width: auto; height: 32px; padding: 4px 10px; font-size: 13px; }

.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.legend .key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.legend .key.net { background: #2a2e36; }
.legend .key.vat { background: var(--line-strong); }
.bar-chart { display: block; width: 100%; height: auto; overflow: visible; }
.bar-chart .grid { stroke: var(--line); stroke-width: 1; }
.bar-chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.bar-chart .tick { font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar-chart .tick.current { fill: var(--ink); font-weight: 650; }
.bar-chart .net { fill: #2a2e36; }
.bar-chart .vat { fill: var(--line-strong); }
.bar-chart .negative { fill: var(--bad); opacity: 0.6; }
.bar-chart .current .net { fill: var(--accent); }
.bar-chart .current .vat { fill: #f9b48b; }
.bar-chart .hit { fill: transparent; }
.bar-chart .bar:hover .hit, .bar-chart .bar:focus .hit { fill: rgba(17, 19, 24, 0.035); }
.bar-chart .bar:focus { outline: none; }
.big-number { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.compare { display: grid; gap: 6px; }
.compare svg, .meter-cell svg { display: block; width: 100%; height: 6px; }
.compare .track, .meter-cell .track { fill: var(--surface-2); }
.compare .fill { fill: var(--accent); }
.meter-cell { display: grid; grid-template-columns: minmax(60px, 1fr) auto; gap: 12px; align-items: center; justify-items: end; }
.meter-cell .fill { fill: var(--ink-2); }
.years td:first-child { color: var(--ink-2); }
details.card-foot summary { list-style: revert; }
details.card-foot[open] { padding-bottom: 0; }
details.card-foot .table { margin: 8px -20px 0; width: calc(100% + 40px); }

.photo-stage { display: grid; gap: 10px; }
.photo-stage + .photo-stage { padding-top: 16px; border-top: 1px solid var(--line); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.shot { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; aspect-ratio: 1; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.shot:hover img { transform: scale(1.03); }
.shot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shot-tag { position: absolute; left: 6px; bottom: 6px; background: rgba(17, 19, 24, 0.72); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.pick-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.pick-photo { position: relative; display: block; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; font-weight: 400; }
.pick-photo:has(input:checked) { border-color: var(--accent); }
.pick-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.pick-photo input { position: absolute; top: 6px; left: 6px; width: auto; }
.pick-photo span { position: absolute; right: 6px; bottom: 6px; background: rgba(17, 19, 24, 0.72); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(10, 11, 14, 0.9); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox figure { margin: 0; display: grid; gap: 10px; justify-items: center; max-width: min(1100px, 88vw); }
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: 10px; display: block; background: #000; }
.lightbox figcaption { color: rgba(255, 255, 255, 0.82); font-size: 13px; text-align: center; }
.lightbox button { position: fixed; border: 0; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lightbox .prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-close { top: 20px; right: 20px; }
label.btn.loading { color: transparent !important; pointer-events: none; }
label.btn.loading::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid; border-color: var(--ink-2) var(--ink-2) transparent transparent; animation: spin 0.7s linear infinite; }

@media (max-width: 1100px) {
  .grid.templates { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .pricebook thead, .pricebook td:nth-child(3), .pricebook td:nth-child(5), .pricebook td:nth-child(6) { display: none; }
  .stage-row { grid-template-columns: minmax(0, 1fr) 90px 36px; }
  .stage-row [data-stage-amount] { display: none; }
}

[data-quote] .line-head { display: none; }
[data-quote] .lines { gap: 0; border: 1px solid var(--line); border-radius: 10px; }
[data-quote] .line { grid-template-columns: 64px minmax(0, 1fr) 92px 32px; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
[data-quote] .line:last-child { border-bottom: 0; }
[data-quote] .line [name="description"] { grid-column: 1 / -1; }
[data-quote] .line .vat, [data-quote] .line .remove { display: initial; }
[data-quote] .line .remove { padding: 0; width: 32px; }
input.upper { text-transform: uppercase; }
.check-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 10px; }
.check-list .check { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.check-list .check:last-child { border-bottom: 0; }
.check-list .check p { margin: 2px 0 0; }
