:root {
  --bg: #F7F6F2;
  --card: #FFFFFF;
  --line: #E4E1D8;
  --line-soft: #EEECE5;
  --ink: #16181D;
  --ink-2: #3A3F47;
  --ink-3: #5B6068;
  --accent: #F2B705;
  --ua: #B7791F;
  --en: #2F5BEA;
  --good: #1B7F4B;
  --bad: #B42318;
  --orange: #E8892B;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: 'Manrope', 'Inter', sans-serif; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.side {
  width: 250px; flex: none;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 28px 20px;
  display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.brand-name { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 20px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; min-height: 44px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500;
}
.nav a:hover { background: #F3F1EA; }
.nav a[aria-current="page"] { background: var(--accent); color: var(--ink); font-weight: 600; }
.side-channels { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-title { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.side-ch { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.side-ch .soon { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-ua { background: var(--ua); }
.dot-en { background: var(--en); }

/* Main */
#view { flex: 1; min-width: 0; padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 24px; outline: none; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.head h1 { font-weight: 800; font-size: 32px; }
.head .sub { font-size: 14px; color: var(--ink-3); margin-top: 6px; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill-demo { background: #FBEFD0; color: #6B4505; padding: 6px 10px; }
.pill-ua { background: #FBEFD0; color: #6B4505; }
.pill-en { background: #E3EAFD; color: #1E3FA8; }

.btn {
  min-height: 44px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid #D8D5CC; background: var(--card); font-size: 14px; font-weight: 500;
}
.btn:hover { background: #F3F1EA; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.btn-dark:hover { background: #2a2d34; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.btn-accent:hover { background: #e0aa04; }
.btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card h2 { font-weight: 700; font-size: 18px; }
.card h3 { font-weight: 700; font-size: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.row > * { flex: 1 1 300px; }
.row > .w2 { flex: 2 1 460px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.kpi .label { font-size: 13px; color: var(--ink-3); }
.kpi .value { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 30px; }
.kpi .delta { font-size: 13px; font-weight: 600; }
.up { color: var(--good); }
.down { color: var(--bad); }

/* Chart */
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart { width: 100%; height: auto; display: block; max-height: 280px; }

/* Dark AI card */
.ai-card { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.ai-card .tag { font-size: 13px; font-weight: 600; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.ai-card h2 { font-weight: 700; font-size: 20px; line-height: 1.3; }
.ai-card p { font-size: 14px; line-height: 1.6; color: #D9DBDF; }
.ai-card .btn-accent { align-self: flex-start; margin-top: auto; display: inline-flex; align-items: center; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--ink-3); font-size: 13px; font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 14px 12px; border-bottom: 1px solid var(--line-soft); }
th:first-child, td:first-child { padding-left: 0; font-weight: 500; }
.num { text-align: right; }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; align-items: start; }
.col { background: #EFEDE6; border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.col-head h2 { font-size: 15px; font-weight: 700; }
.col-head span { font-size: 13px; color: var(--ink-3); }
.idea { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.idea .t { font-weight: 600; font-size: 14px; line-height: 1.35; }
.idea .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.idea .score { margin-left: auto; font-weight: 600; color: var(--ink); }
.idea select { min-height: 40px; border: 1px solid #D8D5CC; border-radius: 8px; background: #fff; padding: 0 8px; font-size: 13px; }
.add-form { display: flex; flex-wrap: wrap; gap: 8px; }
.add-form input[type=text] { flex: 1 1 260px; min-height: 48px; padding: 0 16px; border-radius: 10px; border: 1px solid #C9C5B9; background: #fff; }
.add-form select { min-height: 48px; border-radius: 10px; border: 1px solid #C9C5B9; background: #fff; padding: 0 12px; }
.add-form .btn { min-height: 48px; }

.hint { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 20px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.hint > div { flex: 1 1 320px; }
.hint .tag { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
.hint p { font-size: 15px; line-height: 1.5; color: #D9DBDF; }

/* Models */
.sum { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.sum-top { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.sum-bar { display: flex; align-items: center; gap: 10px; }
.sum-bar .track { flex: 1; height: 8px; border-radius: 4px; background: #EFEDE6; }
.sum-bar .fill { height: 8px; border-radius: 4px; }
.sum-bar span { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.scale { display: flex; gap: 6px; padding: 3px; }
.seg { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.seg .bar { height: 14px; border-radius: 7px; }
.seg .mark { font-size: 12px; font-weight: 600; text-align: center; min-height: 18px; }
.scale-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); }
.mrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.mrow .info { flex: 1 1 220px; min-width: 0; }
.mrow .name { font-weight: 600; font-size: 14px; }
.mrow .note { font-size: 12px; color: var(--ink-3); }
.badge { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; background: #F3F1EA; color: var(--ink-2); }
.badge-active { background: #DFF3E7; color: #14573A; }
.badge-limit { background: #FDE7D3; color: #8A3B05; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 92%; padding: 14px 18px; font-size: 14px; line-height: 1.6; }
.msg-user { align-self: flex-end; background: var(--ink); color: #fff; border-radius: 16px 16px 4px 16px; }
.msg-ai { align-self: flex-start; background: #F3F1EA; border-radius: 16px 16px 16px 4px; }
.msg-ai ol { margin: 8px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 10px 14px; border-radius: 999px; border: 1px solid #D8D5CC; background: #fff; font-size: 13px; font-weight: 500; }
.chip:hover { background: #F3F1EA; }
.chat-form { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-form input { flex: 1 1 240px; min-height: 48px; padding: 0 16px; border-radius: 10px; border: 1px solid #C9C5B9; background: #fff; }
.chat-form .btn { min-height: 48px; }
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-row .l { display: flex; justify-content: space-between; font-size: 13px; }
.bar-row .tr { height: 10px; border-radius: 6px; background: #EFEDE6; }
.bar-row .f { height: 10px; border-radius: 6px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.muted { font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* Phone */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .side {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 10;
    width: auto; height: auto; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    flex-direction: row; gap: 0; border-right: 0; border-top: 1px solid var(--line);
  }
  .brand, .side-channels { display: none; }
  .nav { flex-direction: row; width: 100%; gap: 4px; }
  .nav a { flex: 1; flex-direction: column; gap: 2px; padding: 8px 4px; font-size: 12px; text-align: center; justify-content: center; }
  #view { padding: 20px 16px 96px; }
  .head h1 { font-size: 26px; }
  .card, .ai-card { padding: 18px; }
  .kpi .value { font-size: 26px; }
}
