:root {
  --bg: #09090b; --bg-2: #0e0e11; --panel: #131316; --panel-2: #1a1a1f; --line: #26262c; --line-2: #33333b;
  --text: #f4f4f5; --muted: #a1a1aa; --dim: #71717a;
  --accent: #f97316; --accent-2: #fbbf24; --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px; --radius-sm: 9px;
  --sidebar: 268px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
code, pre, .mono { font-family: var(--mono); }
code { font-size: .87em; color: #fdba74; background: rgba(249,115,22,.08); padding: .1em .35em; border-radius: 5px; }
::selection { background: rgba(249,115,22,.35); }

.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px; background: var(--bg-2); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 14px; border-bottom: 1px solid var(--line); }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; font-weight: 800; font-size: 13px; letter-spacing: .04em; color: #0a0a0b; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 24px rgba(249,115,22,.3); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { color: var(--dim); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-label { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); padding: 12px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 10px; border-radius: var(--radius-sm); color: var(--muted); border: 1px solid transparent; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); border-color: var(--line-2); }
.nav-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; font-size: 12px; font-weight: 800; flex: none; background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent); color: var(--c, var(--accent)); }
.nav-item .nav-meta { display: flex; flex-direction: column; min-width: 0; }
.nav-item .nav-meta span { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-meta small { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); padding: 10px; border-top: 1px solid var(--line); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.status-dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.status-dot.off { background: var(--warn); }

/* Main */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 58px; padding: 0 28px; background: rgba(9,9,11,.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: .5; }
.crumbs .current { color: var(--text); font-weight: 600; }
.topbar-right { margin-left: auto; }
.pill { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; }
.content { padding: 30px 28px 80px; max-width: 1320px; width: 100%; }

/* Page header */
.page-head { position: relative; padding: 28px 30px; border-radius: 20px; border: 1px solid var(--line); overflow: hidden; margin-bottom: 22px;
  background: radial-gradient(900px 380px at 100% -40%, color-mix(in srgb, var(--c, var(--accent)) 22%, transparent), transparent 65%), var(--panel); }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--c, var(--accent)); margin-bottom: 10px; }
.page-head h1 { font-size: clamp(26px, 3vw, 40px); line-height: 1.08; letter-spacing: -.025em; font-weight: 800; max-width: 26ch; }
.page-head p.lead { margin-top: 12px; font-size: 16.5px; line-height: 1.55; color: var(--muted); max-width: 78ch; }
.head-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); margin-bottom: 22px; overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-2); color: var(--text); border-color: var(--line-2); }
.tab .count { font-family: var(--mono); font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--muted); }
.tab.active .count { background: color-mix(in srgb, var(--c, var(--accent)) 25%, transparent); color: var(--c, var(--accent)); }

/* Cards & grids */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card.hover { transition: border-color .15s, transform .15s; }
.card.hover:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card h2 { font-size: 20px; letter-spacing: -.01em; margin-bottom: 10px; }
.card h3 { font-size: 16px; margin-bottom: 8px; }
.card p, .card li { color: #d4d4d8; line-height: 1.6; font-size: 14.5px; }
.card .muted, .muted { color: var(--muted); }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 14px; }
.section-title h2 { font-size: 19px; letter-spacing: -.01em; }
.section-title span { color: var(--dim); font-size: 13px; }
ul.clean { list-style: none; display: grid; gap: 8px; }
ul.clean li { position: relative; padding-left: 1.3em; }
ul.clean li::before { content: "▸"; position: absolute; left: 0; color: var(--c, var(--accent)); }

.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); min-width: 150px; }
.stat b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat small { font-size: 11px; color: var(--dim); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); background: var(--bg-2); }
.badge.accent { color: var(--c, var(--accent)); border-color: color-mix(in srgb, var(--c, var(--accent)) 45%, transparent); background: color-mix(in srgb, var(--c, var(--accent)) 10%, transparent); }
.badge.ok { color: var(--ok); border-color: rgba(52,211,153,.4); }
.badge.warn { color: var(--warn); border-color: rgba(251,191,36,.4); }
.badge.bad { color: var(--bad); border-color: rgba(248,113,113,.4); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Solutions */
.solution { display: flex; flex-direction: column; gap: 14px; position: relative; }
.solution.recommended { border-color: color-mix(in srgb, var(--c, var(--accent)) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c, var(--accent)) 25%, transparent), 0 20px 60px -30px var(--c, var(--accent)); }
.solution-head { display: flex; gap: 14px; align-items: flex-start; }
.solution-num { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 10px; font-family: var(--mono); font-weight: 700; background: color-mix(in srgb, var(--c, var(--accent)) 15%, transparent); color: var(--c, var(--accent)); }
.solution-head h3 { font-size: 18px; margin-bottom: 3px; }
.solution-head p { color: var(--muted); font-size: 14px; }
.meter { display: flex; gap: 3px; }
.meter i { width: 14px; height: 6px; border-radius: 3px; background: var(--line-2); }
.meter i.on { background: var(--c, var(--accent)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; align-items: center; }
.kv dt { color: var(--dim); }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; }
.flow span { padding: 5px 9px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.flow em { color: var(--dim); font-style: normal; }
.procon { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.procon h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
.procon .pro h4 { color: var(--ok); } .procon .con h4 { color: var(--bad); }
.procon li { font-size: 13.5px; }

/* Diagrams */
.diagram { padding: 0; overflow: hidden; }
.diagram-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.diagram-head h3 { margin: 0; }
.diagram-body { padding: 20px; overflow-x: auto; background: var(--bg-2); min-height: 200px; }
.diagram-body > svg { max-width: 100%; height: auto; }
.bpmn-canvas svg { max-width: none; height: 100%; }
.bpmn-canvas { height: 460px; background: #fafafa; border-radius: 10px; }
.bpmn-canvas .djs-container { border-radius: 10px; }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.column { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.column-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.task { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; display: flex; flex-direction: column; gap: 8px; cursor: grab; }
.task:hover { border-color: var(--line-2); }
.task.dragging { opacity: .4; }
.column.drop { border-color: var(--c, var(--accent)); }
.task-title { font-size: 14px; font-weight: 600; line-height: 1.4; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--dim); }
.task-id { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filter { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); font-size: 13px; color: var(--muted); }
.filter.active { color: var(--text); border-color: var(--c, var(--accent)); }

/* Forms (for demos) */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
textarea, input[type=text], input[type=url], select { width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; outline: none; }
textarea { min-height: 180px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.55; }
textarea:focus, input:focus, select:focus { border-color: var(--c, var(--accent)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 14px; border: 1px solid var(--line-2); background: var(--panel-2); }
.btn:hover { border-color: var(--muted); }
.btn.primary { border: none; color: #0a0a0b; background: linear-gradient(135deg, var(--c, var(--accent)), color-mix(in srgb, var(--c, var(--accent)) 60%, #fff)); }
.btn:disabled { opacity: .5; cursor: progress; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(0,0,0,.2); border-top-color: currentColor; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.callout { padding: 14px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 40%, transparent); background: color-mix(in srgb, var(--c, var(--accent)) 8%, transparent); font-size: 14px; line-height: 1.55; }
.prose { line-height: 1.7; color: #d4d4d8; }
.prose h1, .prose h2, .prose h3 { color: var(--text); margin: 1.1em 0 .45em; line-height: 1.25; }
.prose p, .prose ul, .prose ol { margin-bottom: .8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose table { border-collapse: collapse; width: 100%; margin: .8em 0; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line-2); padding: 7px 10px; text-align: left; }
.prose th { background: var(--panel-2); }

/* Home */
.hero { padding: 44px 36px; border-radius: 24px; border: 1px solid var(--line); margin-bottom: 26px; position: relative; overflow: hidden;
  background: radial-gradient(1000px 500px at 95% -20%, rgba(249,115,22,.2), transparent 60%), radial-gradient(700px 400px at -10% 120%, rgba(96,165,250,.12), transparent 60%), var(--panel); }
.hero h1 { font-size: clamp(32px, 4.4vw, 58px); line-height: 1.02; letter-spacing: -.035em; font-weight: 800; max-width: 18ch; }
.hero p { margin-top: 16px; font-size: 18px; color: var(--muted); max-width: 64ch; line-height: 1.55; }
.problem-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 9%, transparent), transparent 55%), var(--panel); transition: transform .18s, border-color .18s; }
.problem-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.problem-card h2 { font-size: 21px; letter-spacing: -.015em; line-height: 1.2; }
.problem-card p { color: var(--muted); line-height: 1.55; font-size: 14.5px; }
.problem-card .go { margin-top: auto; color: var(--c); font-weight: 700; font-size: 14px; }

.toast { position: fixed; right: 22px; bottom: 22px; padding: 12px 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 14px; opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none; z-index: 100; max-width: 420px; }
.toast.show { opacity: 1; transform: none; }
.empty { padding: 40px; text-align: center; color: var(--dim); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { transform: translateY(6px); } to { transform: none; } }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: block; }
  .g2, .g3, .g4, .board, .procon { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 60px; }
  .topbar { padding: 0 16px; }
  .topbar-right { display: none; }
}

.tma-pre { max-height: 360px; overflow: auto; font-size: 12.5px; line-height: 1.5; padding: 12px; border-radius: 10px; background: rgba(0,0,0,.25); white-space: pre-wrap; word-break: break-word; }
details { margin-top: 8px; }
details > summary { cursor: pointer; font-size: 13.5px; }
