:root {
  --bg: #f3f5f8; --panel: #ffffff; --ink: #151a2b; --muted: #636b7d; --line: #e2e6ee; --accent: #2456e0; --accent-ink: #ffffff; --soft: #eaf0ff;
  --good: #17794a; --warn: #8f5f00; --bad: #b3261e; --chip: #eef1f6; --radius: 10px;
  --side: #12172b; --side-ink: #c9cfe0; --side-hover: #1f2742; --side-on: #2a3458; --side-line: #283154;
  --c0: #2456e0; --c1: #12a184; --c2: #d98214; --c3: #8a4fd6; --c4: #d64570; --c5: #5a6785;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e111b; --panel: #171b29; --ink: #eef0f6; --muted: #9aa2b6; --line: #272d40; --accent: #6f95ff; --accent-ink: #0b1020; --soft: #1b2545; --chip: #222839; --good: #5fcf96; --warn: #e3b341; --bad: #ff8a80;
    --c0: #6f95ff; --c1: #3fd0b2; --c2: #f0a544; --c3: #b48cf2; --c4: #f07a9d; --c5: #93a0bf; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14.500px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 21px; margin: 0; letter-spacing: -0.010em; } h2 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 12.500px; } .big { font-size: 16px; } .right { margin-left: auto; } .grow { flex: 1; min-width: 0; } .pad { padding: 12px; } .cut { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; flex-wrap: nowrap; } .row.tightrow { gap: 2px; flex-wrap: nowrap; }
.stack { display: grid; gap: 14px; align-content: start; } .stack.tight { gap: 8px; }
.hidden { display: none !important; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.700; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 12px 10px; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand-logo { background: #0b0912; border-radius: 10px; padding: 8px 12px; display: flex; justify-content: center; } .brand-logo img { max-width: 140px; height: auto; display: block; }
.brand-logo.inline { display: inline-flex; } .login .brand-logo { margin: 0; }
.brand { font-weight: 700; font-size: 16px; padding: 6px 10px; color: #fff; }
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.080em; color: #8089a6; padding: 12px 10px 4px; }
.nav { display: flex; gap: 11px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--side-ink); }
.nav:hover { background: var(--side-hover); color: #fff; } .nav.on { background: var(--side-on); color: #fff; font-weight: 600; }
.nav.back { border-bottom: 1px solid var(--side-line); border-radius: 0; padding: 12px 10px; color: #fff; font-weight: 600; }
.side .foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--side-line); }
.switch-wrap { position: relative; }
.switcher { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: var(--side-hover); border: 1px solid var(--side-line); color: #fff; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.switcher b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .switcher .small { color: #98a1bd; }
.switch-pop { position: absolute; left: 0; top: calc(100% + 6px); width: 300px; max-width: 86vw; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28); padding: 10px; z-index: 20; display: grid; gap: 8px; }
.switch-list { max-height: 320px; overflow-y: auto; display: grid; gap: 2px; }
.switch-item { display: flex; gap: 10px; align-items: center; text-align: left; background: none; border: 0; border-radius: 8px; padding: 7px 8px; cursor: pointer; width: 100%; }
.switch-item:hover, .switch-item.on { background: var(--soft); }
.body { display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 9px 22px; position: sticky; top: 0; z-index: 5; }
.top-title { font-weight: 600; } .top-title .chip { margin-left: 8px; }
.round { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; padding: 0; }
.round:hover { border-color: var(--accent); } .round.me { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; font-size: 12.500px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); padding: 6px; z-index: 20; }
.menu-head { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 7px; cursor: pointer; } .menu-item:hover { background: var(--chip); }
.main { padding: 22px 26px 60px; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* controls */
.btn { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 7px; cursor: pointer; white-space: nowrap; font-weight: 500; }
a.btn { text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--accent); } .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); } .btn.tiny { padding: 4px 10px; font-size: 12.500px; } .btn.ghost { border-style: dashed; background: none; } .btn:disabled { opacity: 0.500; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { display: grid; gap: 5px; align-content: start; } .field label { font-size: 12.500px; color: var(--muted); font-weight: 500; } .field.full { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=search], input[type=file], select, textarea {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; }
input:disabled, select:disabled { opacity: 0.650; }
input[type=search] { min-width: 150px; }
textarea { min-height: 84px; resize: vertical; } textarea.tall { min-height: 180px; } .check { display: flex; gap: 8px; align-items: center; }
select.tiny-select { width: auto; padding: 3px 8px; font-size: 12.500px; }
.title-input { font-size: 18px !important; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.error { color: var(--bad); font-size: 14px; } .notice { background: var(--soft); border-radius: 8px; padding: 10px 12px; font-size: 13.500px; margin-bottom: 12px; } .stack > .notice { margin-bottom: 0; }
.rows { display: grid; gap: 6px; } .rows-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .rows-row .wide { flex-basis: 100%; } .rows-row input[type=time] { width: auto; } .day { min-width: 120px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 50; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); } .toast.bad { background: var(--bad); color: #fff; }

/* cards, tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; } .cards.wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.three { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.300fr) minmax(250px, 1fr); gap: 14px; align-items: start; }
.stat { display: grid; gap: 2px; } .stat b { font-size: 24px; letter-spacing: -0.020em; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-bottom: 2px solid transparent; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); font-weight: 500; margin-bottom: -1px; } .tab:hover { color: var(--ink); } .tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.lists { margin-bottom: 12px; gap: 4px; } .lists .tab, .inbox .tab { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; margin: 0; } .lists .tab.on, .inbox .tab.on { background: var(--soft); border-color: var(--accent); }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 9px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.500px; text-transform: uppercase; letter-spacing: 0.050em; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--bg); }
tr:last-child td { border-bottom: 0; } td.actions { white-space: nowrap; text-align: right; } .narrow { width: 36px; } tr.click { cursor: pointer; } tr.click:hover td { background: var(--soft); }
.cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 2px 9px; font-size: 12px; margin: 0 4px 2px 0; white-space: nowrap; }
.chip.good { color: var(--good); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--accent); display: inline-grid; place-items: center; font-size: 11.500px; font-weight: 700; flex: none; }
.avatar.sq { border-radius: 8px; } .avatar.big { width: 42px; height: 42px; font-size: 14px; }
.line { padding: 8px 0; border-bottom: 1px solid var(--line); } .line:last-child { border-bottom: 0; }
.bulk { background: var(--soft); border-radius: 8px; padding: 8px 12px; }
.step .tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; flex: none; } .step.done .tick { background: var(--good); border-color: var(--good); color: #fff; }
.account .mini { gap: 26px; padding: 12px 0; margin: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; } .unread { border-left: 3px solid var(--accent); }
.switches { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.switch { display: flex; gap: 10px; align-items: center; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.pick-item { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; } .pick-item:hover { border-color: var(--accent); background: var(--soft); }

.invoice { display: grid; gap: 18px; background: #fff; color: #111; } .invoice .muted { color: #555; } .invoice th { background: #f3f3f3; color: #444; } .invoice td, .invoice th { border-color: #ddd; } .invoice .table-wrap { background: #fff; border-color: #ddd; }
@media print { body * { visibility: hidden; } .printable, .printable * { visibility: visible; } .printable { position: fixed; left: 0; top: 0; width: 100%; border: 0; } .noprint { display: none; } }

/* overlay */
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 24, 0.500); display: flex; justify-content: flex-end; z-index: 30; }
.drawer { background: var(--bg); width: min(620px, 100vw); height: 100%; overflow-y: auto; padding: 22px; display: grid; gap: 16px; align-content: start; } .drawer.wide { width: min(900px, 100vw); }

/* charts */
.bars { display: grid; gap: 8px; } .bar-row { display: grid; grid-template-columns: minmax(80px, 150px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .bar-track { background: var(--chip); border-radius: 999px; height: 10px; overflow: hidden; } .bar-track.tall { height: 12px; } .bar-fill { height: 100%; border-radius: 999px; } .bar-value { font-weight: 600; min-width: 34px; text-align: right; }
.c0 { background: var(--c0); } .c1 { background: var(--c1); } .c2 { background: var(--c2); } .c3 { background: var(--c3); } .c4 { background: var(--c4); } .c5 { background: var(--c5); }
.s0 { stroke: var(--c0); } .s1 { stroke: var(--c1); } .s2 { stroke: var(--c2); } .s3 { stroke: var(--c3); } .s4 { stroke: var(--c4); } .s5 { stroke: var(--c5); }
.chart svg { width: 100%; height: auto; display: block; } .grid-line { stroke: var(--line); stroke-width: 1; } .axis { fill: var(--muted); font-size: 11px; }
.line { } path.line { fill: none; stroke: var(--c0); stroke-width: 2.200; stroke-linejoin: round; padding: 0; border: 0; } path.area { fill: var(--c0); opacity: 0.120; }
.donut { width: 140px; height: 140px; flex: none; } .donut-bg { fill: none; stroke: var(--chip); stroke-width: 18; } .donut-part { fill: none; stroke-width: 18; } .donut-total { fill: var(--ink); font-size: 22px; font-weight: 700; }
.donut-wrap { gap: 22px; } .legend { display: grid; gap: 6px; } .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* pipeline board */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 10px; align-items: flex-start; margin-top: 12px; }
.col { background: var(--chip); border: 1px solid var(--line); border-radius: var(--radius); min-width: 264px; width: 264px; padding: 10px; display: grid; gap: 8px; } .col.over { outline: 2px dashed var(--accent); }
.col-head { padding: 2px 4px 6px; border-bottom: 2px solid var(--accent); }
.deal { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 5px; background: var(--panel); cursor: grab; } .deal:hover { border-color: var(--accent); }

/* inbox */
.inbox { display: grid; grid-template-columns: 290px 1fr 270px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 560px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: 720px; } .inbox-side { border-left: 1px solid var(--line); }
.inbox-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; cursor: pointer; } .inbox-item:hover, .inbox-item.on { background: var(--soft); }
.inbox-thread { display: flex; flex-direction: column; min-width: 0; }
.thread { display: flex; flex-direction: column; gap: 8px; padding: 12px; overflow-y: auto; max-height: 460px; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 12px; background: var(--chip); align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; } .bubble.out { align-self: flex-end; background: var(--soft); }

/* calendar */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 12px; }
.month-head { background: var(--bg); padding: 7px 8px; font-size: 11.500px; text-transform: uppercase; letter-spacing: 0.050em; color: var(--muted); font-weight: 600; }
.month .day { background: var(--panel); min-height: 108px; min-width: 0; padding: 6px; display: grid; gap: 3px; align-content: start; } .month .day.off { background: var(--bg); } .month .day.today .day-num { background: var(--accent); color: var(--accent-ink); }
.day-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.500px; font-weight: 600; }
.day-add { border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 6px; width: 22px; height: 22px; } .day-add:hover { background: var(--soft); color: var(--accent); }
.appt { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--c0); background: var(--soft); border-radius: 4px; padding: 2px 6px; font-size: 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt.cancelled { border-left-color: var(--c4); opacity: 0.600; text-decoration: line-through; } .appt.showed { border-left-color: var(--c1); } .appt.noshow { border-left-color: var(--c2); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 12px; } .week .day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 260px; display: grid; gap: 6px; align-content: start; min-width: 0; } .week .day.today { border-color: var(--accent); }
.appt.tall { white-space: normal; padding: 5px 7px; }
.top-search { flex: 1; max-width: 420px; margin-left: 12px; } input[type=color] { width: 48px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
@media (max-width: 800px) { .week { grid-template-columns: 1fr; } .week .day { min-height: 0; } .top-search { display: none; } }

/* workflow builder */
.flow { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 16px; display: flex; flex-direction: column; align-items: center; overflow-x: auto; }
.flow-triggers { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.flow-card { display: flex; gap: 10px; align-items: center; width: 270px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.060); }
.flow-card:hover { border-color: var(--accent); } .flow-card.trigger { border-color: var(--c1); } .flow-card.branch { border-color: var(--c2); } .flow-card.add { border-style: dashed; display: block; text-align: center; box-shadow: none; }
.flow-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--soft); color: var(--accent); display: grid; place-items: center; flex: none; } .trigger .flow-ico { color: var(--c1); }
.flow-col { display: flex; flex-direction: column; align-items: center; } .flow-line, .flow-gap { width: 2px; height: 22px; background: var(--line); }
.flow-plus { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); cursor: pointer; margin: 6px 0; position: relative; color: var(--muted); padding: 0; line-height: 1; } .flow-plus:hover { border-color: var(--accent); color: var(--accent); background: var(--soft); }
.flow-split { display: flex; gap: 18px; align-items: flex-start; margin-top: 8px; padding-top: 10px; border-top: 2px solid var(--line); } .flow-branch { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 280px; }
.flow-end { margin-top: 4px; font-size: 11px; letter-spacing: 0.100em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 14px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--side); } .login .card { width: min(400px, 100%); display: grid; gap: 14px; }

@media (max-width: 1100px) { .three { grid-template-columns: 1fr; } .inbox { grid-template-columns: 240px 1fr; } .inbox-side { display: none; } }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; align-items: center; gap: 6px; }
  .nav-list { flex-direction: row; } .nav { width: auto; white-space: nowrap; } .nav-label { display: none; } .side .foot { margin: 0; padding: 0; border: 0; }
  .side .brand-logo { padding: 5px 8px; flex: none; } .side .brand-logo img { max-width: 78px; } .switch-wrap { flex: none; } .switcher .small { display: none; } .switch-pop { position: fixed; left: 8px; top: 62px; }
  .main { padding: 14px 16px 50px; } .top { padding: 8px 16px; } .drawer, .drawer.wide { width: 100vw; }
  .inbox { grid-template-columns: 1fr; } .inbox-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .month .day { min-height: 70px; padding: 3px; } .appt b { display: none; } .grid2 { grid-template-columns: 1fr; } .flow-split { flex-direction: column; }
}

.login-links { text-align: center; opacity: 0.75; } .login-links a { color: inherit; }
