:root {
  --bg: #0b0908;
  --bg-2: #120f0d;
  --card: #161210;
  --card-2: #1c1714;
  --input: #100d0b;
  --line: rgba(232, 201, 154, .1);
  --line-2: rgba(232, 201, 154, .2);
  --text: #f6ead7;
  --muted: #9a8770;
  --faint: #6b5d4d;
  --gold: #d7b36a;
  --gold-2: #f0d7a0;
  --wine: #8f2d3a;
  --rose: #e8a0b0;
  --green: #8fca9a;
  --red: #e07a7a;
  --blue: #8eafd4;
  --violet: #c2a6e0;
  --shadow: 0 24px 60px rgba(0,0,0,.45);
  --radius: 20px;
  --sidebar: 268px;
  --ease: cubic-bezier(.2,.7,.2,1);
  --sans: "Outfit", "Segoe UI", sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --ink-rgb: 255 255 255;
  --gold-rgb: 215 179 106;
  --gold-deep-rgb: 184 137 60;
  --wine-rgb: 143 45 58;
  --line-rgb: 232 201 154;
  --green-rgb: 143 202 154;
  --red-rgb: 224 122 122;
  --blue-rgb: 142 175 212;
  --violet-rgb: 194 166 224;
  --rose-rgb: 196 91 98;
  --sidebar-bg: linear-gradient(180deg, #14100e, #0d0b0a);
  --day: #120f0d;
  --day-2: #14100e;
  --backdrop: rgba(5,4,3,.7);
  --glass: rgba(11,9,8,.86);
  --scroll: #2a221c;
  --avatar-mix: 100%;
  --chart-grid: rgba(255,255,255,.04);
  --chart-legend: #cfc6b8;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -8%, rgb(var(--gold-rgb) / .09), transparent 50%),
    radial-gradient(700px 380px at 100% 0%, rgb(var(--wine-rgb) / .16), transparent 46%),
    var(--bg);
  background-attachment: fixed;
  transition: background-color .3s, color .3s;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: rgb(var(--gold-rgb) / .3); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; position: relative; overflow: hidden; }
.login-wrap::before { content: ""; position: absolute; inset: 24px; border: 1px solid var(--line); pointer-events: none; }
.sprockets { position: absolute; left: 24px; right: 24px; height: 10px; opacity: .45; pointer-events: none;
  background: radial-gradient(circle at 7px 5px, rgb(var(--line-rgb) / .18) 3px, transparent 3.5px) 0 0 / 30px 10px repeat-x; }
.sprockets.top { top: 34px; } .sprockets.bot { bottom: 34px; }
.login-card {
  position: relative; z-index: 1;
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgb(var(--ink-rgb) / .03), transparent), var(--card);
  border: 1px solid var(--line); border-radius: 28px; padding: 36px 32px 30px; box-shadow: var(--shadow);
  animation: rise .6s var(--ease) both;
}
.login-mark {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(145deg, #f0d7a0, #8f2d3a 70%);
  color: #140c0a; font-family: var(--serif); font-size: 26px; font-weight: 600; margin-bottom: 18px;
  box-shadow: 0 10px 30px rgb(var(--wine-rgb) / .35);
}
.login-card h1 { font-family: var(--serif); font-size: 44px; font-weight: 500; line-height: .9; }
.login-card .tag { letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-size: 11px; margin: 12px 0 26px; }
.login-card .field { margin-bottom: 14px; }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 12px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px; overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column; gap: 2px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand { gap: 10px; padding-right: 0; }
.brand h1 { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .theme-btn { margin-left: auto; width: 30px; height: 30px; border-radius: 9px; }
.brand .theme-btn svg.i { width: 16px; height: 16px; }
.brand > div:nth-child(2) { min-width: 0; }
.mark {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  background: linear-gradient(145deg, #f0d7a0, #8f2d3a);
  color: #140c0a; display: grid; place-items: center;
  font-family: var(--serif); font-weight: 600; font-size: 18px;
}
.brand h1 { font-family: var(--serif); font-size: 24px; font-weight: 500; line-height: 1; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.nav-label { color: var(--faint); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; padding: 16px 12px 6px; }
.nav-btn {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: transparent; border: 0;
  color: var(--muted); padding: 9px 12px; border-radius: 12px; font-size: 14px; transition: background .2s, color .2s;
}
.nav-btn:hover { background: rgb(var(--ink-rgb) / .035); color: var(--text); }
.nav-btn.active { background: rgb(var(--gold-rgb) / .11); color: var(--gold-2); }
.nav-btn.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.whoami { margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.whoami .name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.whoami .meta { color: var(--muted); font-size: 11px; }
.whoami > div:nth-child(2) { min-width: 0; flex: 1; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); flex: none; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

.mobile-bar { display: none; }
.scrim { display: none; }

.main { padding: 28px 32px 64px; min-width: 0; }
.view { animation: rise .35s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h2 { font-family: var(--serif); font-weight: 500; font-size: 42px; letter-spacing: -.01em; line-height: 1; }
.topbar p { color: var(--muted); margin-top: 8px; font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card-2); padding: 9px 14px; border-radius: 12px; font-size: 13px; transition: border-color .2s, transform .1s, filter .2s; }
.btn svg.i { width: 15px; height: 15px; }
.btn:hover { border-color: rgb(var(--gold-rgb) / .45); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #ead39a, #b8893c); color: #1a1208; border: 0; font-weight: 600; box-shadow: 0 6px 18px rgb(var(--gold-deep-rgb) / .22); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgb(var(--red-rgb) / .28); }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 10px; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }
.btn.icon { padding: 6px; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 14px; }
.mt { margin-top: 14px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.card {
  background: linear-gradient(180deg, rgb(var(--ink-rgb) / .02), transparent), var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.card.flush { padding: 6px 4px; }
.card.flush .section-title { padding: 12px 16px 0; }
.kpi { position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.kpi .label svg.i { width: 15px; height: 15px; color: var(--gold); opacity: .8; }
.kpi .value { font-family: var(--serif); font-size: 36px; line-height: 1; margin: 12px 0 6px; font-variant-numeric: lining-nums tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kpi.gold { background: linear-gradient(160deg, rgb(var(--gold-rgb) / .16), var(--card) 70%); border-color: rgb(var(--gold-rgb) / .24); }
.kpi.gold::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; border: 1px solid rgb(var(--gold-rgb) / .18); }
.kpi.wine { background: linear-gradient(160deg, rgb(var(--wine-rgb) / .24), var(--card) 70%); }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.delta.up { color: var(--green); background: rgb(var(--green-rgb) / .12); }
.delta.down { color: var(--red); background: rgb(var(--red-rgb) / .12); }
.cols-2 { grid-template-columns: 1.35fr 1fr; }
.section-title { font-size: 11px; color: var(--muted); margin-bottom: 14px; letter-spacing: .12em; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: rgb(var(--ink-rgb) / .018); }
.right { text-align: right; }
.money { font-variant-numeric: tabular-nums; }
.bar-cell { position: relative; }
.bar { height: 4px; border-radius: 4px; background: rgb(var(--ink-rgb) / .05); margin-top: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #b8893c, var(--gold-2)); border-radius: 4px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; background: rgb(var(--ink-rgb) / .05); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.active, .badge.paid, .badge.done, .badge.hired { color: var(--green); background: rgb(var(--green-rgb) / .12); }
.badge.vacation, .badge.talking { color: var(--blue); background: rgb(var(--blue-rgb) / .12); }
.badge.trial { color: var(--gold); background: rgb(var(--gold-rgb) / .14); }
.badge.paused, .badge.cancelled, .badge.rejected, .badge.missed { color: var(--red); background: rgb(var(--red-rgb) / .12); }
.badge.pending, .badge.open, .badge.new { color: var(--gold-2); background: rgb(var(--gold-rgb) / .12); }
.badge.planned { color: var(--violet); background: rgb(var(--violet-rgb) / .12); }
.badge.owner { color: var(--gold-2); background: rgb(var(--gold-rgb) / .14); }
.badge.teamlead { color: var(--rose); background: rgb(var(--rose-rgb) / .14); }
.badge.operator { color: var(--blue); background: rgb(var(--blue-rgb) / .14); }
.badge.model { color: var(--violet); background: rgb(var(--violet-rgb) / .14); }

/* ---------- people ---------- */
.avatar { --c: var(--gold); width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; letter-spacing: .02em;
  color: color-mix(in srgb, var(--c) var(--avatar-mix), #2a1f16); background: color-mix(in srgb, var(--c) 15%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent); }
.avatar.lg { width: 46px; height: 46px; border-radius: 15px; font-size: 14px; }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who .meta, .meta { color: var(--muted); font-size: 12px; }

/* ---------- forms ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { flex: 0 1 180px; }
input, select, textarea { background: var(--input); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; min-width: 0; font-size: 14px; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: rgb(var(--gold-rgb) / .5); box-shadow: 0 0 0 3px rgb(var(--gold-rgb) / .1); }
input[type="checkbox"] { accent-color: var(--gold); width: 16px; height: 16px; }
input[type="date"], input[type="time"] { color-scheme: dark; }
textarea { min-height: 80px; resize: vertical; width: 100%; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); flex: 1; min-width: 140px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
.check-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.check-row span { min-width: 110px; font-size: 13px; }
.check-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { display: inline-flex; gap: 7px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; cursor: pointer; }
.check-chip:has(input:checked) { border-color: rgb(var(--gold-rgb) / .45); background: rgb(var(--gold-rgb) / .08); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal-back.show { display: flex; animation: fade .2s both; }
.modal { width: min(680px, 100%); max-height: 90vh; overflow: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 22px; padding: 24px; box-shadow: var(--shadow); animation: rise .3s var(--ease) both; }
.modal h3 { font-family: var(--serif); font-size: 30px; font-weight: 500; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.preview { padding: 12px 14px; border-radius: 12px; background: rgb(var(--gold-rgb) / .07); border: 1px dashed rgb(var(--gold-rgb) / .25); color: var(--muted); font-size: 13px; }
.preview b { color: var(--gold-2); font-size: 15px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- charts ---------- */
.chart-box { height: 250px; position: relative; }

/* ---------- models ---------- */
.model-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.model-card { display: flex; flex-direction: column; gap: 14px; transition: border-color .2s, transform .2s var(--ease); }
.model-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.model-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.model-card .stage { font-family: var(--serif); font-size: 22px; line-height: 1.05; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: rgb(var(--ink-rgb) / .025); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.stat .k { color: var(--muted); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.stat .v { font-size: 15px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 44px; display: block; color: var(--gold); }
.spark .g0 { stop-color: var(--gold); stop-opacity: .28; } .spark .g1 { stop-color: var(--gold); stop-opacity: 0; }
.spark-cap { display: flex; justify-content: space-between; color: var(--faint); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; margin-top: -4px; }
.plats { display: flex; gap: 6px; flex-wrap: wrap; }
.plat-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 3px 9px; border-radius: 999px; background: rgb(var(--ink-rgb) / .04); border: 1px solid var(--line); white-space: nowrap; }
.plat-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--gold)); }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }

/* ---------- list rows ---------- */
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .t { font-size: 14px; }
.list-row.done .t { color: var(--muted); text-decoration: line-through; }
.time-chip { font-variant-numeric: tabular-nums; color: var(--gold-2); font-size: 12px; background: rgb(var(--gold-rgb) / .08); padding: 3px 8px; border-radius: 8px; }

/* ---------- calendar ---------- */
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-h { color: var(--muted); font-size: 11px; text-align: center; letter-spacing: .1em; text-transform: uppercase; padding-bottom: 2px; }
.day { min-height: 116px; background: var(--day); border: 1px solid var(--line); border-radius: 14px; padding: 9px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.day.past { opacity: .62; }
.day.weekend { background: var(--day-2); }
.day.today { border-color: rgb(var(--gold-rgb) / .55); box-shadow: inset 0 0 0 1px rgb(var(--gold-rgb) / .2); }
.day .n { color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.day.today .n { color: var(--gold-2); }
.pill { font-size: 11px; padding: 4px 7px; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 2px solid currentColor; background: rgb(var(--violet-rgb) / .1); color: var(--violet); }
.pill.done { color: var(--green); background: rgb(var(--green-rgb) / .09); }
.pill.missed { color: var(--red); background: rgb(var(--red-rgb) / .1); text-decoration: line-through; }
.pill.click { cursor: pointer; }
.pill.click:hover { filter: brightness(1.25); }
.pill b { font-weight: 500; color: var(--text); opacity: .9; }

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgb(var(--ink-rgb) / .015); }
.empty { color: var(--muted); padding: 34px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; }
.empty svg.i { width: 28px; height: 28px; color: var(--faint); }
.hidden { display: none !important; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; align-items: center; gap: 9px; background: var(--card-2); border: 1px solid rgb(var(--gold-rgb) / .35); color: var(--gold-2); padding: 11px 15px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: rise .3s var(--ease) both; }
.toast.err { color: var(--red); border-color: rgb(var(--red-rgb) / .4); }

/* skeleton */
.sk { background: linear-gradient(90deg, rgb(var(--ink-rgb) / .03) 25%, rgb(var(--ink-rgb) / .07) 50%, rgb(var(--ink-rgb) / .03) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: 12px; }
.sk-title { height: 40px; width: 220px; margin-bottom: 26px; }
.sk-card { height: 120px; border-radius: var(--radius); }
.sk-big { height: 300px; border-radius: var(--radius); margin-top: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--shadow); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--backdrop); z-index: 35; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; padding: 12px 16px; background: var(--glass); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .mobile-bar .mark { width: 34px; height: 34px; border-radius: 11px; font-size: 15px; }
  .mobile-bar b { font-family: var(--serif); font-weight: 500; font-size: 20px; }
  .main { padding: 20px 16px 48px; }
  .topbar h2 { font-size: 34px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .cal-wrap { overflow-x: auto; }
  .cal-wrap .cal { min-width: 680px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: 28px; }
  .card { padding: 15px 16px; }
  .filters .field { flex: 1 1 140px; }
  .hide-sm { display: none; }
  td, th { padding-left: 10px; padding-right: 10px; }
}

/* ---------- светлая тема ---------- */
:root[data-theme="light"] {
  --bg: #f4eee5;
  --bg-2: #fbf8f3;
  --card: #fffdf9;
  --card-2: #f6f0e7;
  --input: #fffdfa;
  --line: rgba(110, 78, 40, .13);
  --line-2: rgba(110, 78, 40, .26);
  --text: #2a1f16;
  --muted: #7a6650;
  --faint: #a6927b;
  --gold: #a7782a;
  --gold-2: #8a6020;
  --wine: #8f2d3a;
  --rose: #b4485a;
  --green: #2f8a4a;
  --red: #c0453f;
  --blue: #3a6ea8;
  --violet: #7b55ad;
  --shadow: 0 1px 2px rgba(70,45,20,.05), 0 12px 32px rgba(70,45,20,.08);
  --ink-rgb: 70 45 20;
  --gold-rgb: 176 128 44;
  --gold-deep-rgb: 184 137 60;
  --wine-rgb: 143 45 58;
  --line-rgb: 110 78 40;
  --green-rgb: 47 138 74;
  --red-rgb: 192 69 63;
  --blue-rgb: 58 110 168;
  --violet-rgb: 123 85 173;
  --rose-rgb: 180 72 90;
  --sidebar-bg: linear-gradient(180deg, #fbf7f0, #f3ece1);
  --day: #fffdf9;
  --day-2: #faf5ec;
  --backdrop: rgba(60,40,20,.35);
  --glass: rgba(251,247,240,.88);
  --scroll: #d8cbb8;
  --avatar-mix: 58%;
  --chart-grid: rgba(70,45,20,.08);
  --chart-legend: #5c4a38;
  color-scheme: light;
}
:root[data-theme="light"] body {
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(215,179,106,.22), transparent 50%),
    radial-gradient(700px 380px at 100% 0%, rgba(143,45,58,.08), transparent 46%),
    var(--bg);
}
:root[data-theme="light"] .kpi.gold { background: linear-gradient(160deg, rgba(215,179,106,.22), var(--card) 70%); }
:root[data-theme="light"] .kpi.wine { background: linear-gradient(160deg, rgba(143,45,58,.09), var(--card) 70%); }
:root[data-theme="light"] .btn.primary { color: #2a1a06; }
:root[data-theme="light"] .pill b { color: inherit; }

/* ---------- выбор темы ---------- */
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.theme-opt { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card-2); cursor: pointer; text-align: left; font-size: 13px; transition: border-color .2s; }
.theme-opt:hover { border-color: var(--line-2); }
.theme-opt.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgb(var(--gold-rgb) / .15); }
.theme-opt .sw { height: 74px; border-radius: 10px; display: grid; grid-template-columns: 30% 1fr; overflow: hidden; border: 1px solid var(--line); }
.theme-opt .sw i { display: block; }
.sw.dark i:first-child { background: #14100e; } .sw.dark i:last-child { background: linear-gradient(#0b0908 40%, #1c1714 40% 70%, #0b0908 70%); }
.sw.light i:first-child { background: #f3ece1; } .sw.light i:last-child { background: linear-gradient(#f4eee5 40%, #fffdf9 40% 70%, #f4eee5 70%); }
.sw.system { grid-template-columns: 1fr 1fr; } .sw.system i:first-child { background: #f4eee5; } .sw.system i:last-child { background: #0b0908; }
.theme-opt .row { justify-content: space-between; }
.theme-opt .row svg.i { width: 16px; height: 16px; color: var(--gold); }
.settings-grid { display: grid; gap: 14px; max-width: 640px; }
@media (max-width: 520px) { .theme-pick { grid-template-columns: 1fr 1fr 1fr; gap: 8px; } .theme-opt .sw { height: 54px; } }

/* =====================================================================
   v3: первый запуск, планы, смены, импорт, аналитика, финансы, поиск
   ===================================================================== */
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; padding: 1px 6px; border-radius: 6px; background: rgb(var(--ink-rgb) / .06); border: 1px solid var(--line); }
kbd { font-family: inherit; font-size: 10px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); background: rgb(var(--ink-rgb) / .04); }
.nowrap { white-space: nowrap; }
.dim { opacity: .5; }
.up-txt { color: var(--green); display: inline-flex; align-items: center; gap: 5px; }
.down-txt { color: var(--red); display: inline-flex; align-items: center; gap: 5px; }
.up-txt svg.i, .down-txt svg.i { width: 15px; height: 15px; }
.section-title svg.i { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; color: var(--gold); }
.section-title > span { display: inline-flex; align-items: center; gap: 2px; }
.flash { animation: flash 1.6s ease-out 1; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px rgb(var(--gold-rgb) / .45); background: rgb(var(--gold-rgb) / .08); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* первый запуск */
.setup-card { width: min(480px, 100%); }
.setup-card h1 { font-size: 40px; }
.demo-check { margin-top: 4px; font-size: 13px; color: var(--muted); }
.demo-check span { min-width: 0; }
.secret-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; letter-spacing: .08em; padding: 14px 16px; margin: 12px 0; border-radius: 12px; text-align: center; color: var(--gold-2); background: rgb(var(--gold-rgb) / .08); border: 1px dashed rgb(var(--gold-rgb) / .35); user-select: all; }
.secret-box.small { font-size: 14px; padding: 10px 12px; text-align: left; word-break: break-all; }

/* поиск в сайдбаре */
.search-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; margin: 0 0 4px; border-radius: 12px; border: 1px solid var(--line); background: rgb(var(--ink-rgb) / .02); color: var(--muted); font-size: 13px; text-align: left; }
.search-btn:hover { border-color: var(--line-2); color: var(--text); }
.search-btn span { flex: 1; }
.search-btn svg.i { width: 16px; height: 16px; }

/* кнопки */
.btn.go { color: var(--green); border-color: rgb(var(--green-rgb) / .35); background: rgb(var(--green-rgb) / .08); }
.btn.go:hover { border-color: rgb(var(--green-rgb) / .6); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--card-2); }
.seg button { border: 0; background: transparent; padding: 6px 11px; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgb(var(--gold-rgb) / .14); color: var(--gold-2); }
.seg svg.i { width: 15px; height: 15px; }
.presets { align-self: flex-end; margin-bottom: 1px; }
.tabs { display: flex; gap: 6px; margin: -6px 0 16px; border-bottom: 1px solid var(--line); }
.tabs button { display: inline-flex; gap: 7px; align-items: center; border: 0; background: none; padding: 10px 14px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--gold-2); border-bottom-color: var(--gold); }
.tabs svg.i { width: 16px; height: 16px; }

/* план месяца */
.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.goal-now { font-family: var(--serif); font-size: 32px; }
.goal-pct { font-family: var(--serif); font-size: 26px; color: var(--gold-2); }
.goal-bar { position: relative; height: 10px; border-radius: 10px; background: rgb(var(--ink-rgb) / .06); overflow: visible; }
.goal-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; }
.goal-bar .fc { background: repeating-linear-gradient(45deg, rgb(var(--gold-rgb) / .22) 0 6px, rgb(var(--gold-rgb) / .1) 6px 12px); }
.goal-bar .done { background: linear-gradient(90deg, rgb(var(--gold-deep-rgb)), var(--gold-2)); box-shadow: 0 0 12px rgb(var(--gold-rgb) / .3); }
.goal-bar i { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--text); opacity: .35; }
.goal-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.goal-mini { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.goal-mini b { color: var(--gold-2); font-weight: 500; }
.model-card .goal-bar { height: 6px; }
.model-card .goal-bar i { top: -3px; bottom: -3px; }
.bar.nogoal { opacity: 0; }
.goal-rows { display: grid; gap: 8px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.goal-row { display: grid; grid-template-columns: 1fr auto 140px; gap: 12px; align-items: center; font-size: 14px; }
.goal-row input { width: 100%; text-align: right; }

/* требует внимания */
.alert-list { display: grid; gap: 6px; }
.alert-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px; border-left: 3px solid var(--gold); background: rgb(var(--gold-rgb) / .07); cursor: pointer; }
.alert-row.crit { border-left-color: var(--red); background: rgb(var(--red-rgb) / .08); }
.alert-row.crit span { color: var(--red); }
.alert-row span { color: var(--muted); text-align: right; }
.alert-row:hover { filter: brightness(1.08); }
.doc-flag { display: inline-flex; gap: 4px; align-items: center; font-size: 11px; padding: 3px 7px; border-radius: 999px; color: var(--gold); background: rgb(var(--gold-rgb) / .12); }
.doc-flag.crit { color: var(--red); background: rgb(var(--red-rgb) / .12); }
.doc-flag svg.i { width: 13px; height: 13px; }
.form-section { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgb(var(--ink-rgb) / .015); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }

/* смена модели */
.shift-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.shift-banner.live { border-color: rgb(var(--gold-rgb) / .45); background: linear-gradient(120deg, rgb(var(--gold-rgb) / .14), var(--card) 60%); }
.big-timer { font-family: var(--serif); font-size: 38px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.shift-banner .btn { padding: 12px 18px; font-size: 14px; }
.badge.live { color: var(--gold-2); background: rgb(var(--gold-rgb) / .16); }
.badge.live::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .2; } }

/* календарь */
.pill { display: flex; align-items: center; gap: 4px; }
.pill.live { color: var(--gold-2); background: rgb(var(--gold-rgb) / .16); }

/* импорт */
.modal.wide { width: min(900px, 100%); }
.drop { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: rgb(var(--ink-rgb) / .015); margin-bottom: 14px; transition: border-color .2s, background .2s; }
.drop > svg.i { width: 28px; height: 28px; color: var(--gold); }
.drop > div { flex: 1; font-size: 14px; }
.drop.over { border-color: var(--gold); background: rgb(var(--gold-rgb) / .08); }
.link { color: var(--gold-2); text-decoration: underline; cursor: pointer; }
.imp-table { max-height: 42vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.imp-table th { position: sticky; top: 0; background: var(--bg-2); }
.imp-table tr.bad td { color: var(--muted); }

/* аналитика */
.heat { display: grid; grid-template-columns: 34px repeat(var(--cols), minmax(56px, 1fr)); gap: 4px; overflow-x: auto; }
.hh { font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.hd { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; display: flex; align-items: center; }
.hc { height: 38px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-variant-numeric: tabular-nums;
  background: rgb(var(--gold-rgb) / calc(.07 + var(--k) * .6)); color: var(--text); }
.hc span { opacity: calc(.55 + var(--k) * .45); }
.hc.none { background: rgb(var(--ink-rgb) / .025); }
.hc.best { box-shadow: inset 0 0 0 2px var(--gold-2); font-weight: 600; }
.rank { font-family: var(--serif); font-size: 18px; color: var(--muted); width: 28px; }
.rank.r1 { color: var(--gold-2); } .rank.r2 { color: #c0c4cc; } .rank.r3 { color: #c68b5a; }
.matrix th .plat-chip { font-size: 10px; }
.best-cell { background: rgb(var(--green-rgb) / .1); color: var(--green); font-weight: 500; }
.best-cell .meta { color: var(--green); opacity: .75; }

/* финансы */
.pnl td:first-child { white-space: nowrap; }
.pnl tr.strong td { font-weight: 500; }
.pnl tr.neg td:not(:first-child) { color: var(--muted); }
.pnl tr.neg td:not(:first-child)::before { content: "−"; margin-right: 2px; }
.pnl tr.sub-row td { font-size: 12px; color: var(--muted); padding-top: 6px; padding-bottom: 6px; }
.pnl tr.sub-row td:first-child { padding-left: 28px; }
.pnl tr.total td { font-weight: 600; font-size: 14px; color: var(--gold-2); border-top: 1px solid var(--line-2); }

/* настройки */
.settings-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.settings-grid { max-width: none; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; padding-bottom: 0; }
.set-row:first-of-type { padding-top: 0; }
.set-row b { font-weight: 500; }
.set-row .meta { margin-top: 3px; line-height: 1.5; }
.inline-num { width: 64px; padding: 3px 6px; font-size: 12px; text-align: center; }
.tg-link { display: grid; gap: 8px; padding: 14px; margin-top: 12px; border-radius: 12px; background: rgb(var(--gold-rgb) / .06); border: 1px dashed rgb(var(--gold-rgb) / .3); }
.tg-link .btn { justify-self: start; }
.tg-preview { padding: 14px 16px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); line-height: 1.65; font-size: 14px; }
.qr-wrap { display: flex; gap: 16px; align-items: center; margin: 6px 0 16px; }
.qr { width: 164px; height: 164px; flex: none; border-radius: 12px; background: #fff; display: grid; place-items: center; padding: 6px; color: #999; }
.qr svg { width: 100%; height: 100%; }
.qr svg.i { width: 40px; height: 40px; }
.steps { margin: 0 0 12px 18px; color: var(--muted); font-size: 14px; line-height: 1.7; }

/* поиск */
.palette-modal { padding: 0; width: min(620px, 100%); align-self: flex-start; margin-top: 10vh; overflow: hidden; }
.pal-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pal-input input { flex: 1; border: 0; background: transparent; font-size: 16px; padding: 4px 0; box-shadow: none; }
.pal-input input:focus { box-shadow: none; }
.pal-input svg.i { color: var(--muted); }
.pal-list { max-height: 56vh; overflow: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.pal-item > div:not(.avatar) { flex: 1; min-width: 0; }
.pal-item .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item.on { background: rgb(var(--gold-rgb) / .12); }
.pal-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: rgb(var(--ink-rgb) / .04); color: var(--gold); flex: none; }
.pal-kind { font-size: 11px; color: var(--faint); }

@media (max-width: 900px) {
  .search-btn { display: none; }
  .form-grid.three { grid-template-columns: 1fr; }
  .settings-cols { grid-template-columns: 1fr; }
  .goal-row { grid-template-columns: 1fr 110px; }
  .goal-row .meta { display: none; }
  .shift-banner { flex-direction: column; align-items: stretch; }
  .qr-wrap { flex-direction: column; align-items: flex-start; }
  .palette-modal { margin-top: 4vh; }
}
.modal-actions { flex-wrap: wrap; align-items: center; }

a { color: var(--gold-2); }
.model-card header > .row { flex-wrap: nowrap; }


/* режим «посмотреть как» */
.imp-bar { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 12px; margin: -28px -32px 22px; padding: 11px 32px;
  background: linear-gradient(90deg, rgb(var(--violet-rgb) / .22), rgb(var(--gold-rgb) / .14)); border-bottom: 1px solid rgb(var(--violet-rgb) / .4); font-size: 13px; backdrop-filter: blur(8px); }
.imp-bar > svg.i { color: var(--violet); flex: none; }
.imp-bar span { flex: 1; }
.imp-bar .btn { flex: none; }
.list-row.clickable { cursor: pointer; border-radius: 10px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.list-row.clickable:hover { background: rgb(var(--ink-rgb) / .03); }
.color-input { height: 42px; padding: 4px; cursor: pointer; }
.field .meta { font-size: 11px; }
@media (max-width: 900px) { .imp-bar { margin: -20px -16px 16px; padding: 10px 16px; flex-wrap: wrap; top: 59px; } }

/* доход смены: все площадки сразу */
.modal.earn-modal { width: min(720px, 100%); }
.earn-plats { display: grid; gap: 6px; max-height: 46vh; overflow: auto; padding-right: 2px; }
.ep-row { display: grid; grid-template-columns: 1fr 170px 96px; align-items: center; gap: 12px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgb(var(--ink-rgb) / .015); cursor: text; transition: border-color .15s, background .15s; }
.ep-row.mine { background: rgb(var(--gold-rgb) / .045); }
.ep-row.filled { border-color: rgb(var(--gold-rgb) / .5); background: rgb(var(--gold-rgb) / .09); }
.ep-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ep-name .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-input { position: relative; }
.ep-input input { width: 100%; padding: 8px 46px 8px 11px; text-align: right; font-variant-numeric: tabular-nums; }
.ep-input em { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 11px; color: var(--muted); pointer-events: none; }
.ep-usd { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.ep-row.filled .ep-usd { color: var(--gold-2); font-weight: 500; }
.earn-total { font-size: 14px; color: var(--muted); }
.earn-total b { font-family: var(--serif); font-size: 26px; color: var(--gold-2); font-weight: 500; margin-left: 6px; }
@media (max-width: 600px) { .ep-row { grid-template-columns: 1fr 96px; gap: 8px 10px; } .ep-name { grid-column: 1 / -1; } }
.kpi.earn { background: linear-gradient(160deg, rgb(var(--violet-rgb) / .18), var(--card) 70%); border-color: rgb(var(--violet-rgb) / .3); }
.kpi.earn .label svg.i { color: var(--violet); }

/* ---------- фото баланса ---------- */
th.center, td.center { text-align: center; }
.proof-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; border: 1px solid rgb(var(--gold-rgb) / .45); background: rgb(var(--gold-rgb) / .1); color: var(--gold-2); font-size: 12px; font-weight: 500; }
.proof-chip .i { width: 14px; height: 14px; }
.proof-chip.none { border-style: dashed; border-color: var(--line-2); background: transparent; color: var(--muted); padding: 4px 7px; }
.proof-chip:hover { filter: brightness(1.15); }
.proof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.proof-grid.big { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 60vh; overflow: auto; padding: 2px; }
.proof-thumb { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--card-2); }
.proof-thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; }
.proof-thumb a { display: block; }
.proof-meta { font-size: 11px; color: var(--muted); padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proof-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgb(0 0 0 / .6); color: #fff; }
.proof-x .i { width: 14px; height: 14px; }
.proof-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 128px; border: 1.5px dashed var(--line-2); border-radius: 12px; color: var(--muted); font-size: 12px; text-align: center; cursor: pointer; padding: 10px; transition: border-color .15s, color .15s; }
.proof-grid.big .proof-add { min-height: 200px; }
.proof-add:hover { border-color: rgb(var(--gold-rgb) / .6); color: var(--gold-2); }
.proof-add input { display: none; }
.proof-add small { font-size: 10.5px; opacity: .75; }
.proof-sum { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 14px; font-size: 13px; }
.proof-sum span { display: inline-flex; align-items: center; gap: 6px; }
.section-title .req { font-style: normal; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); border: 1px solid rgb(var(--gold-rgb) / .5); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.modal.proof-modal { width: min(820px, 100%); }
@media (max-width: 640px) { .proof-grid { grid-template-columns: repeat(3, 1fr); } .proof-grid.big { grid-template-columns: repeat(2, 1fr); } }

/* ---------- логотип студии ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.logo { display: inline-block; line-height: 0; }
.logo img { display: block; width: 100%; height: auto; }
.logo .logo-l { display: none; }
:root[data-theme="light"] .logo .logo-d { display: none; }
:root[data-theme="light"] .logo .logo-l { display: block; }
.login-logo { width: 250px; max-width: 80%; margin: 2px auto 6px; }
.login-logo .logo { width: 100%; }
.login-logo.small { width: 170px; margin-bottom: 18px; }
.login-card .tag { text-align: center; }
.setup-card h1, .setup-card .tag { text-align: center; }
.side-logo { flex: 1; min-width: 0; padding: 2px 4px 0 2px; }
.side-logo .logo { width: 150px; max-width: 100%; }
.bar-logo .logo { height: 40px; width: auto; }
.bar-logo .logo img { height: 40px; width: auto; }
