/* Admin dashboard */
body.admin { background: #f4f2ee; --brand: #5b3df5; --brand-rgb: 91,61,245; }
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #16131f; color: #d8d4e4; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; color: #fff; font-weight: 800; font-size: 17px; }
.brand-row .logo-mark { width: 30px; height: 30px; border-radius: 9px; margin: 0; }
.biz-switch { margin: 0 4px 14px; }
.biz-switch select { width: 100%; background: #221e2e; color: #fff; border: 1px solid #332d44; border-radius: 10px; padding: 9px 10px; font-weight: 600; }
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7f7991; padding: 14px 12px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #d8d4e4; text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a:hover { background: #221e2e; color: #fff; }
.nav a.active { background: #2c2640; color: #fff; }
.nav a svg { width: 18px; height: 18px; opacity: .8; flex: none; }
.nav .count { margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; border-radius: 99px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; padding: 12px; font-size: 13px; border-top: 1px solid #2a2538; display: flex; flex-direction: column; gap: 6px; }
.sidebar-foot a, .sidebar-foot button { color: #b3adc4; text-decoration: none; background: none; border: 0; text-align: left; padding: 0; cursor: pointer; font-size: 13px; }
.sidebar-foot a:hover, .sidebar-foot button:hover { color: #fff; }
.main { padding: 26px 32px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 26px; font-weight: 800; }
.topbar .sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.topbar .tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mobile-bar { display: none; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.panel .desc { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols-even { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.table-wrap { overflow-x: auto; margin: 0 -20px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t th:first-child, .t td:first-child { padding-left: 20px; }
.t th:last-child, .t td:last-child { padding-right: 20px; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: #faf9f7; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #eee; color: #444; white-space: nowrap; }
.pill.partial { background: #fff4e5; color: #8a4b00; }
.pill.booked, .pill.signed, .pill.won, .pill.confirmed, .pill.synced { background: #e6f6ee; color: #17744a; }
.pill.quoted, .pill.submitted { background: #ecebff; color: #4633c9; }
.pill.contract_requested, .pill.contract_sent { background: #fde9f1; color: #a2295a; }
.pill.callback_requested, .pill.contacted { background: #e7f2fb; color: #1d5f8f; }
.pill.lost, .pill.declined, .pill.cancelled, .pill.failed { background: #f3f1f1; color: #8a7f7f; }
.progress-mini { display: inline-flex; gap: 3px; vertical-align: middle; }
.progress-mini i { width: 14px; height: 6px; border-radius: 3px; background: var(--line-2); }
.progress-mini i.on { background: var(--brand); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .input, .filters .select { width: auto; padding: 8px 12px; border-radius: 10px; }
.seg { display: inline-flex; background: #ece9e3; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-danger { color: var(--err); border-color: #f0caca; background: #fff; }
.btn-danger:hover { border-color: var(--err); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ""; position: absolute; left: 6.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; font-size: 12px; color: var(--muted); }
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 90px; gap: 12px; align-items: center; font-size: 13px; }
.funnel-row .lbl { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-row .bar { height: 26px; background: #efedf6; border-radius: 8px; overflow: hidden; }
.funnel-row .bar span { display: block; height: 100%; background: var(--brand); border-radius: 8px; min-width: 2px; }
.funnel-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.funnel-row .drop { color: var(--err); font-size: 11px; display: block; }
.spark { width: 100%; height: 120px; display: block; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state h3 { color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #16131f; color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 100; box-shadow: var(--shadow); animation: fadeUp .2s; }
.toast.err { background: var(--err); }
.drawer-back { position: fixed; inset: 0; background: rgba(20, 16, 30, .4); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: 100%; max-width: 720px; background: #f7f6f3; height: 100%; overflow-y: auto; padding: 22px; animation: slideIn .2s ease; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.drawer-head h2 { font-size: 22px; font-weight: 800; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.help { font-size: 13px; color: var(--muted); margin-top: -2px; }
.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.toggle input { position: absolute; opacity: 0; }
.toggle .sw { width: 40px; height: 23px; background: var(--line-2); border-radius: 99px; position: relative; transition: background .15s; flex: none; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .sw { background: var(--brand); }
.toggle input:checked + .sw::after { transform: translateX(17px); }
.toggle input:focus-visible + .sw { box-shadow: 0 0 0 3px var(--brand-soft); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--brand); }
.hours-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hours-row:last-child { border-bottom: 0; }
.hours-intervals { display: flex; flex-direction: column; gap: 8px; }
.interval { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.interval .select { width: auto; padding: 7px 10px; }
.icon-x { width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 18px; }
.icon-x:hover { background: #f1eeea; color: var(--err); }
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.et-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.et-card .top { height: 5px; }
.et-card .body { padding: 16px 18px; flex: 1; }
.et-card h3 { font-size: 16px; font-weight: 800; }
.et-card .foot { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 6px; justify-content: space-between; align-items: center; }
.step-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.step-card-head { display: flex; gap: 10px; align-items: center; }
.step-num { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: none; }
.step-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.q-edit { border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px; margin-top: 10px; background: #fcfbfa; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: #16131f; color: #e9e6f2; border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; word-break: break-all; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .panel { width: 100%; max-width: 420px; padding: 30px; }
.auth h1 { font-size: 26px; font-weight: 800; margin: 14px 0 4px; }
.warn-box { background: #fff7e8; border: 1px solid #f3d9a4; color: #7a4d00; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.ok-box { background: #e9f7ef; border: 1px solid #bfe5cf; color: #17603d; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.svc-row { display: flex; gap: 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.svc-row:last-child { border-bottom: 0; }
.svc-row .grow { flex: 1; min-width: 0; }
.drag { cursor: grab; color: var(--muted); }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } .cols-2, .cols-even { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.3); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #16131f; color: #fff; position: sticky; top: 0; z-index: 30; font-weight: 800; }
  .mobile-bar button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
  .main { padding: 18px 16px 60px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .v { font-size: 22px; }
  .funnel-row { grid-template-columns: 100px 1fr 60px; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  .hours-row { grid-template-columns: 1fr; }
  .drawer { padding: 16px; }
  .table-wrap { margin: 0 -20px; }
}
