/* Maceful Finance: an IDE for money. One font, quiet chrome, syntax colored data. */

:root, :root[data-theme="dark"] {
  --bg0: #0a0c0f;      /* title bar, activity bar */
  --bg1: #0f1216;      /* sidebar, panel */
  --bg2: #13171c;      /* editor */
  --bg3: #1a1f26;      /* hover, inputs */
  --bg4: #222831;      /* raised, selection */
  --line: #1f252d;
  --line2: #2a313b;
  --text: #d7dce3;
  --dim: #8a94a1;
  --faint: #545d69;
  --ghost: #343b45;
  --accent: #ff5370;
  --accent2: #ff7a8e;
  --accent-bg: rgba(255, 83, 112, .12);
  --kw: #c792ea;       /* keywords, types */
  --str: #c3e88d;      /* strings, income */
  --num: #f78c6c;      /* numbers */
  --fn: #82aaff;       /* functions, links */
  --ty: #ffcb6b;       /* types, warnings */
  --cm: #5c6773;       /* comments */
  --cy: #89ddff;
  --inc: #a6e07a;
  --exp: #ff6b81;
  --xfer: #8a94a1;
  --sel: rgba(130, 170, 255, .14);
  --sel-line: rgba(130, 170, 255, .45);
  --shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  --glow: rgba(255, 83, 112, .18);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg0: #e9ecf0; --bg1: #f1f3f6; --bg2: #fafbfc; --bg3: #eceff3; --bg4: #e1e5eb;
  --line: #e1e5ea; --line2: #d3d8df;
  --text: #1d232b; --dim: #5d6773; --faint: #959da8; --ghost: #c9ced6;
  --accent: #e0244a; --accent2: #f04566; --accent-bg: rgba(224, 36, 74, .09);
  --kw: #8e44c4; --str: #3f8a1d; --num: #c2521c; --fn: #2f5fd0; --ty: #a77400; --cm: #8b95a1; --cy: #087ea4;
  --inc: #2f8a1d; --exp: #d6274a; --xfer: #6b7480;
  --sel: rgba(47, 95, 208, .1); --sel-line: rgba(47, 95, 208, .4);
  --shadow: 0 18px 50px rgba(20, 30, 50, .18), 0 2px 8px rgba(20, 30, 50, .1);
  --glow: rgba(224, 36, 74, .1);
  color-scheme: light;
}

:root {
  --mono: 'JetBrains Mono', 'Cascadia Code', 'Cascadia Mono', Consolas, ui-monospace, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);          /* expo out: settles softly */
  --spring: cubic-bezier(.34, 1.56, .64, 1);     /* tiny overshoot */
  --swift: cubic-bezier(.4, 0, .2, 1);
  --side: 280px;
  --panel: 220px;
  --row: 28px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg2);
  color: var(--text);
  font: 13px/1.5 var(--mono);
  font-feature-settings: 'calt' 1, 'liga' 1, 'zero' 1;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
::selection { background: var(--accent-bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ghost); border: 3px solid transparent; background-clip: content-box; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.calm *, .calm *::before, .calm *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }

/* ---------------------------------------------------------------- app grid */
.app {
  display: grid;
  height: 100vh; height: 100dvh;
  grid-template-rows: 34px 1fr 24px;
  grid-template-columns: 48px var(--side) minmax(0, 1fr);
  grid-template-areas: 'title title title' 'act side main' 'status status status';
}
.app.side-hidden { grid-template-columns: 48px 0 minmax(0, 1fr); }

/* ---------------------------------------------------------------- title bar */
.titlebar {
  grid-area: title; display: flex; align-items: center; gap: 12px;
  background: var(--bg0); border-bottom: 1px solid var(--line); padding: 0 10px 0 12px;
  user-select: none; position: relative; z-index: 3;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .02em; }
.brand-mark { width: 18px; height: 18px; }
.brand .caret { width: 7px; height: 14px; background: var(--accent); animation: blink 1.1s steps(1) infinite; border-radius: 1px; }
@keyframes blink { 50% { opacity: 0; } }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--dim); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs span { transition: color .2s; }
.crumbs span:last-child { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.cmd-trigger {
  margin: 0 auto; display: flex; align-items: center; gap: 10px; width: min(460px, 40vw);
  height: 24px; padding: 0 10px; border-radius: 6px; background: var(--bg3); border: 1px solid var(--line2); color: var(--dim);
  transition: border-color .25s var(--ease), background .25s, box-shadow .35s var(--ease), transform .2s var(--ease);
}
.cmd-trigger:hover { border-color: var(--faint); box-shadow: 0 0 0 4px var(--glow); }
.cmd-trigger:active { transform: scale(.985); }
.cmd-trigger kbd { margin-left: auto; }
.cmd-trigger span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: 11px var(--mono); color: var(--faint); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--bg2); }
.title-right { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 28px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--dim);
  transition: background .2s, color .2s, transform .25s var(--spring);
}
.icon-btn:hover { background: var(--bg3); color: var(--text); }
.icon-btn:active { transform: scale(.88); }
.icon-btn.spin svg { animation: spin .9s var(--ease); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- activity bar */
.activity { grid-area: act; background: var(--bg0); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 6px 0; gap: 2px; position: relative; z-index: 2; }
.act-btn {
  width: 48px; height: 46px; display: grid; place-items: center; color: var(--faint); position: relative;
  transition: color .25s var(--ease);
}
.act-btn svg.i { width: 22px; height: 22px; stroke-width: 1.3; transition: transform .35s var(--spring); }
.act-btn:hover { color: var(--text); }
.act-btn:hover svg.i { transform: translateY(-1px) scale(1.06); }
.act-btn.on { color: var(--text); }
.act-ind {
  position: absolute; left: 0; top: 0; width: 2px; height: 46px; background: var(--accent); border-radius: 0 2px 2px 0;
  transition: transform .45s var(--ease), opacity .3s; box-shadow: 0 0 12px var(--accent);
}
.act-btn .badge {
  position: absolute; top: 7px; right: 7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-weight: 700;
  animation: pop .5s var(--spring);
}
.activity .spacer { flex: 1; }
@keyframes pop { from { transform: scale(0); } }

/* ---------------------------------------------------------------- sidebar */
.sidebar { grid-area: side; background: var(--bg1); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; position: relative; }
.side-head { height: 35px; display: flex; align-items: center; padding: 0 8px 0 20px; color: var(--dim); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; gap: 4px; }
.side-head .grow { flex: 1; }
.side-head .icon-btn { width: 24px; height: 22px; opacity: 0; transition: opacity .2s; }
.sidebar:hover .side-head .icon-btn { opacity: 1; }
.side-scroll { flex: 1; overflow: auto; padding-bottom: 20px; }
.section-head {
  display: flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--dim); cursor: pointer; user-select: none; border-top: 1px solid var(--line);
}
.section-head svg.i { width: 14px; height: 14px; transition: transform .35s var(--ease); }
.section-head.closed svg.i { transform: rotate(-90deg); }
.resizer { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 5; }
.resizer::after { content: ''; position: absolute; left: 2px; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: 0; transition: opacity .2s; }
.resizer:hover::after, .resizer.drag::after { opacity: .7; }

/* tree */
.tree { padding: 2px 0; position: relative; }
.node {
  display: flex; align-items: center; height: 24px; padding-right: 10px; gap: 5px; cursor: pointer; position: relative; user-select: none;
  color: var(--text); white-space: nowrap; border: 1px solid transparent;
  transition: background .15s, color .15s;
}
.node:hover { background: var(--bg3); }
.node.on { background: var(--sel); border-color: var(--sel-line); }
.node.drop { background: var(--accent-bg); border-color: var(--accent); border-style: dashed; animation: droppulse 1s var(--ease) infinite; }
@keyframes droppulse { 50% { box-shadow: inset 0 0 0 1px var(--accent), 0 0 18px var(--glow); } }
.node .chev { width: 14px; height: 14px; color: var(--faint); transition: transform .35s var(--ease); flex: none; }
.node.open .chev { transform: rotate(90deg); }
.node .chev.none { visibility: hidden; }
.node .ico { width: 15px; height: 15px; flex: none; }
.node .name { overflow: hidden; text-overflow: ellipsis; text-transform: lowercase; }
.node .amt { margin-left: auto; color: var(--faint); font-size: 11.5px; padding-left: 8px; font-variant-numeric: tabular-nums; transition: color .2s; }
.node:hover .amt { color: var(--dim); }
.node .guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line2); opacity: .7; }
.kids { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .4s var(--ease); }
.kids > div { overflow: hidden; }
.kids.shut { grid-template-rows: 0fr; }
.kids > div > .node { animation: slidein .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms); }
.kids.shut > div > .node { animation: none; }
@keyframes slidein { from { opacity: 0; transform: translateX(-8px); } }
.rename { background: var(--bg2); border: 1px solid var(--fn); outline: none; height: 20px; padding: 0 4px; width: 100%; border-radius: 3px; text-transform: none; }

.upnext { padding: 4px 0 8px; }
.up-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 8px; padding: 2px 12px 2px 20px; font-size: 12px; color: var(--dim); align-items: center; }
.up-row .d { color: var(--cy); }
.up-row .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.up-row .a { color: var(--exp); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- main */
.main { grid-area: main; display: grid; grid-template-rows: 35px 1fr auto; min-width: 0; min-height: 0; background: var(--bg2); position: relative; }
.tabs { display: flex; background: var(--bg1); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; position: relative; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 7px; padding: 0 10px 0 13px; height: 35px; color: var(--dim); border-right: 1px solid var(--line);
  white-space: nowrap; cursor: pointer; position: relative; flex: none; user-select: none; max-width: 240px;
  transition: color .2s, background .2s;
  animation: tabin .45s var(--ease) both;
}
@keyframes tabin { from { opacity: 0; transform: translateY(6px); } }
.tab:hover { color: var(--text); background: var(--bg3); }
.tab.on { color: var(--text); background: var(--bg2); }
.tab .t { overflow: hidden; text-overflow: ellipsis; }
.tab .x { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; opacity: 0; color: var(--dim); transition: opacity .15s, background .15s; }
.tab:hover .x, .tab.on .x { opacity: 1; }
.tab .x:hover { background: var(--bg4); color: var(--text); }
.tab .x svg.i { width: 13px; height: 13px; }
.tab.closing { animation: tabout .28s var(--swift) forwards; }
@keyframes tabout { to { opacity: 0; max-width: 0; padding: 0; } }
.tab-ind { position: absolute; top: 0; left: 0; height: 2px; background: var(--accent); transition: transform .45s var(--ease), width .45s var(--ease); pointer-events: none; z-index: 2; box-shadow: 0 0 10px var(--accent); }
.ext { font-size: 10px; font-weight: 800; letter-spacing: .02em; }

.editor { position: relative; overflow: hidden; min-height: 0; }
.view { position: absolute; inset: 0; overflow: auto; }
.view-enter { animation: viewin .5s var(--ease) both; }
@keyframes viewin { from { opacity: 0; transform: translateY(10px); filter: blur(3px); } }
.spot { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(420px circle at var(--mx, -999px) var(--my, -999px), var(--glow), transparent 60%); opacity: .55; transition: opacity .4s; z-index: 0; }

/* Only the editor animates; the rest of the page stays put and keeps taking clicks mid transition. */
::view-transition { pointer-events: none; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(editor) { animation: vt-out .22s var(--swift) both; }
::view-transition-new(editor) { animation: vt-in .5s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); filter: blur(2px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); filter: blur(3px); } }

/* ---------------------------------------------------------------- code page (overview etc) */
.page { padding: 18px 28px 60px 0; position: relative; z-index: 1; max-width: 1280px; }
.cl { display: flex; min-height: 22px; align-items: baseline; }
.cl > span { white-space: pre; }
.ln { width: 64px; flex: none; text-align: right; padding-right: 22px; color: var(--ghost); user-select: none; font-size: 12px; font-variant-numeric: tabular-nums; transition: color .2s; }
.cl:hover .ln { color: var(--faint); }
.c-cm { color: var(--cm); font-style: italic; }
.c-kw { color: var(--kw); }
.c-str { color: var(--str); }
.c-num { color: var(--num); }
.c-fn { color: var(--fn); }
.c-ty { color: var(--ty); }
.c-cy { color: var(--cy); }
.c-dim { color: var(--dim); }
.c-p { color: var(--faint); }
.inc { color: var(--inc); }
.exp { color: var(--exp); }
.xfer { color: var(--xfer); }

.block { margin: 6px 0 18px 64px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 10px 0 22px 64px; }
.stat {
  position: relative; padding: 14px 16px 14px; border: 1px solid var(--line2); border-radius: 10px; background: linear-gradient(180deg, var(--bg3), transparent 140%);
  overflow: hidden; animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms);
  transition: border-color .3s, transform .4s var(--ease), box-shadow .4s var(--ease);
}
.stat:hover { border-color: var(--faint); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.stat::before { content: ''; position: absolute; inset: 0; background: radial-gradient(300px circle at var(--sx, 50%) var(--sy, 0%), var(--glow), transparent 50%); opacity: 0; transition: opacity .4s; }
.stat:hover::before { opacity: 1; }
.stat .k { color: var(--cm); font-style: italic; font-size: 12px; }
.stat .v { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .s { font-size: 12px; color: var(--dim); }
.stat .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: currentColor; opacity: .7; transform-origin: left; animation: grow 1.2s var(--ease) both; animation-delay: calc(.3s + var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes grow { from { transform: scaleX(0); } }

.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; margin-left: 64px; }
.card { border: 1px solid var(--line2); border-radius: 10px; background: var(--bg1); position: relative; overflow: hidden; animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 80ms + 150ms); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.card-h .file { color: var(--text); display: flex; align-items: center; gap: 7px; }
.card-h .grow { flex: 1; }
.card-b { padding: 12px 14px; }

/* chart */
.chart { position: relative; height: 220px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-dasharray: 2 4; }
.chart .axis text { fill: var(--faint); font: 10.5px var(--mono); }
.chart .draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.6s var(--ease) forwards; animation-delay: .25s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .area { opacity: 0; animation: fadein 1.2s var(--ease) .6s forwards; }
@keyframes fadein { to { opacity: 1; } }
.chart .barr { transform-box: fill-box; transform-origin: bottom; animation: growy .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms + .15s); }
@keyframes growy { from { transform: scaleY(0); } }
.chart .xhair { stroke: var(--faint); stroke-dasharray: 3 3; transition: transform .18s var(--ease), opacity .2s; }
.chart .dot { transition: transform .18s var(--ease), opacity .2s; }
.tip {
  position: absolute; pointer-events: none; background: var(--bg0); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 10px; font-size: 12px;
  box-shadow: var(--shadow); white-space: nowrap; transition: transform .2s var(--ease), opacity .2s; z-index: 4;
}
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--dim); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

/* breakdown bars */
.bd { display: grid; gap: 4px; }
.bd-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 5px 6px; border-radius: 6px; cursor: pointer; transition: background .2s; }
.bd-row:hover { background: var(--bg3); }
.bd-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: lowercase; }
.bd-row .nm .c-p { margin: 0 1px; }
.bd-row .vv { font-variant-numeric: tabular-nums; color: var(--dim); }
.bd-track { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--bg3); overflow: hidden; }
.bd-fill { height: 100%; border-radius: 4px; transform-origin: left; animation: grow 1.1s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms + .2s); }
.bd-row.sub { padding-left: 22px; font-size: 12px; }
.bd-row.sub .bd-track { height: 3px; }

/* log list */
.log { display: grid; }
.log-row { display: grid; grid-template-columns: 14px 78px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 4px 6px; border-radius: 6px; font-size: 12.5px; animation: slidein .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms + .2s); }
.log-row:hover { background: var(--bg3); }
.log-row .dot { width: 7px; height: 7px; border-radius: 50%; justify-self: center; box-shadow: 0 0 8px currentColor; background: currentColor; }
.log-row .d { color: var(--faint); }
.log-row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-row .a { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- ledger */
.ledger { display: flex; flex-direction: column; height: 100%; }
.findbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); position: relative; z-index: 2; flex-wrap: wrap;
}
.field {
  display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 9px; border: 1px solid var(--line2); border-radius: 6px; background: var(--bg3);
  transition: border-color .2s, box-shadow .3s var(--ease);
}
.field:focus-within { border-color: var(--fn); box-shadow: 0 0 0 3px rgba(130, 170, 255, .15); }
.field input, .field select { background: none; border: 0; outline: none; min-width: 0; }
.field input { width: 100%; }
.field.search { flex: 1 1 240px; max-width: 420px; }
.field svg.i { color: var(--faint); }
.seg { display: flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; position: relative; background: var(--bg3); }
.seg button { padding: 0 10px; height: 26px; color: var(--dim); position: relative; z-index: 1; transition: color .25s; }
.seg button.on { color: var(--text); }
.seg .pill { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; background: var(--bg4); transition: transform .4s var(--ease), width .4s var(--ease); }
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg3); color: var(--text);
  transition: background .2s, border-color .2s, transform .25s var(--spring), box-shadow .3s var(--ease); white-space: nowrap;
}
.btn:hover { background: var(--bg4); border-color: var(--faint); }
.btn:active { transform: scale(.95); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent2); box-shadow: 0 6px 22px var(--glow); }
.btn.ghost { background: none; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { color: var(--text); background: var(--bg3); }
.btn.danger:hover { border-color: var(--exp); color: var(--exp); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg.i { width: 15px; height: 15px; }

.selbar { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--sel); border-bottom: 1px solid var(--sel-line); animation: dropdown .35s var(--ease); }
@keyframes dropdown { from { opacity: 0; transform: translateY(-100%); } }

.lhead, .lrow {
  display: grid; grid-template-columns: 64px 128px minmax(0, 1fr) minmax(0, 240px) 120px 34px; align-items: center; height: var(--row);
}
.lhead { color: var(--faint); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg2); z-index: 2; height: 30px; }
.lhead > div { cursor: pointer; transition: color .2s; }
.lhead > div:hover { color: var(--dim); }
.lhead .r, .lrow .r { text-align: right; padding-right: 14px; }
.lbody { flex: 1; overflow: auto; position: relative; }
.lrows { position: relative; }
.hl { position: absolute; left: 0; right: 0; height: var(--row); background: var(--bg3); border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line2); pointer-events: none; opacity: 0; transition: transform .16s var(--ease), opacity .2s; z-index: 0; }
.lrow { position: relative; z-index: 1; cursor: default; user-select: none; }
.lrow > div { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 10px; }
.lrow .ln { padding-right: 18px; cursor: pointer; }
.lrow .dt { color: var(--cy); font-variant-numeric: tabular-nums; }
.lrow .ds { color: var(--text); }
.lrow .ct { color: var(--str); }
.lrow .ct.none { color: var(--ty); font-style: italic; }
.lrow .am { font-variant-numeric: tabular-nums; font-weight: 500; }
.lrow.voided { opacity: .45; }
.lrow.voided .ds { text-decoration: line-through; }
.lrow.sel { background: var(--sel); }
.lrow.sel .ln { color: var(--fn); }
.lrow.sel::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--fn); }
.lrow.new { animation: newrow 1.6s var(--ease); }
@keyframes newrow { 0% { background: var(--accent-bg); transform: translateX(-10px); opacity: 0; } 20% { opacity: 1; transform: none; } 100% { background: transparent; } }
.lrow.in { animation: rowin .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 12ms); }
@keyframes rowin { from { opacity: 0; transform: translateY(4px); } }
.lrow.gone { animation: rowgone .35s var(--swift) forwards; }
@keyframes rowgone { to { opacity: 0; transform: translateX(16px); height: 0; } }
.lrow .src { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; color: var(--faint); }
.lrow:hover .act { opacity: 1; }
.lrow .act { opacity: 0; transition: opacity .15s; display: flex; justify-content: center; }
.lrow .act button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--dim); }
.lrow .act button:hover { background: var(--bg4); color: var(--text); }
.lrow .notes { color: var(--cm); font-style: italic; margin-left: 10px; }
.lfoot { display: flex; align-items: center; gap: 18px; padding: 6px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; background: var(--bg1); }
.lfoot b { font-weight: 600; }
.lmore { text-align: center; padding: 14px; color: var(--faint); }
.dayhead { display: flex; align-items: center; height: 26px; padding-left: 64px; color: var(--cm); font-size: 11.5px; font-style: italic; position: relative; z-index: 1; }
.dayhead .tot { margin-left: auto; padding-right: 48px; font-style: normal; }

/* inline editor row */
.erow {
  display: grid; grid-template-columns: 64px 128px minmax(0, 1fr) minmax(0, 240px) 120px 34px; align-items: center; min-height: 36px; position: relative; z-index: 3;
  background: var(--bg3); border-top: 1px solid var(--fn); border-bottom: 1px solid var(--fn); box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  animation: erow .4s var(--ease);
}
@keyframes erow { from { opacity: 0; transform: scaleY(.6); } }
.erow .ln { color: var(--fn); }
.erow input, .erow .pick { height: 26px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 5px; outline: none; padding: 0 7px; width: calc(100% - 8px); transition: border-color .2s; }
.erow input:focus, .erow .pick:focus { border-color: var(--fn); }
.erow .am input { text-align: right; }
.erow .pick { display: flex; align-items: center; gap: 6px; text-align: left; overflow: hidden; white-space: nowrap; color: var(--str); text-transform: lowercase; }
.erow .pick.none { color: var(--faint); }
.erow .type { height: 22px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 700; margin-right: 6px; flex: none; }
.erow .ds { display: flex; align-items: center; position: relative; }
.erow .hint { position: absolute; right: 14px; color: var(--faint); font-size: 11px; pointer-events: none; }
.erow .ok { display: flex; justify-content: center; }
.erow .ok button { width: 26px; height: 26px; border-radius: 5px; display: grid; place-items: center; background: var(--accent); color: #fff; transition: transform .25s var(--spring); }
.erow .ok button:active { transform: scale(.88); }

/* dropdown, suggestions, picker */
.pop {
  position: fixed; z-index: 60; background: var(--bg1); border: 1px solid var(--line2); border-radius: 9px; box-shadow: var(--shadow); padding: 4px; min-width: 220px;
  transform-origin: var(--ox, top left); animation: popin .28s var(--ease);
  max-height: min(420px, 60vh); overflow: auto;
}
@keyframes popin { from { opacity: 0; transform: scale(.94) translateY(-4px); } }
.pop.out { animation: popout .16s var(--swift) forwards; }
@keyframes popout { to { opacity: 0; transform: scale(.97); } }
.opt { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 9px; border-radius: 6px; cursor: pointer; white-space: nowrap; position: relative; }
.opt.hi { background: var(--sel); }
.opt .r { margin-left: auto; color: var(--faint); font-size: 11.5px; padding-left: 14px; }
.opt .path { text-transform: lowercase; }
.opt mark { background: none; color: var(--accent); font-weight: 700; }
.opt-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.opt-h { padding: 6px 9px 2px; color: var(--faint); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.pop input.filter { width: 100%; height: 28px; background: var(--bg3); border: 1px solid var(--line2); border-radius: 6px; padding: 0 8px; outline: none; margin-bottom: 4px; }
.pop input.filter:focus { border-color: var(--fn); }

/* command palette */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .35); backdrop-filter: blur(2px); animation: fadein2 .25s var(--ease); }
@keyframes fadein2 { from { opacity: 0; } }
.scrim.out { animation: fadeout .2s var(--swift) forwards; }
@keyframes fadeout { to { opacity: 0; } }
.palette {
  position: fixed; z-index: 51; top: 12vh; left: 50%; width: min(640px, calc(100vw - 32px)); transform: translateX(-50%);
  background: var(--bg1); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, .02); overflow: hidden;
  animation: palin .38s var(--ease);
}
@keyframes palin { from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(.97); filter: blur(4px); } }
.palette.out { animation: palout .18s var(--swift) forwards; }
@keyframes palout { to { opacity: 0; transform: translateX(-50%) scale(.98); } }
.palette .pin { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.palette .pin input { flex: 1; background: none; border: 0; outline: none; font-size: 14px; }
.palette .plist { max-height: min(420px, 55vh); overflow: auto; padding: 6px; position: relative; }
.palette .opt { height: 34px; animation: slidein .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 14ms); }
.palette .opt .k { margin-left: auto; display: flex; gap: 4px; }
.palette .pfoot { display: flex; gap: 14px; padding: 7px 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; }

/* modal / peek */
.modal {
  position: fixed; z-index: 51; top: 50%; left: 50%; width: min(520px, calc(100vw - 32px)); transform: translate(-50%, -50%);
  background: var(--bg1); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); animation: modalin .42s var(--ease);
}
@keyframes modalin { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); filter: blur(4px); } }
.modal.out { animation: modalout .18s var(--swift) forwards; }
@keyframes modalout { to { opacity: 0; transform: translate(-50%, -50%) scale(.97); } }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-h .grow { flex: 1; }
.modal-b { padding: 14px 16px; display: grid; gap: 12px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.frow { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 12px; }
.frow > label { color: var(--kw); font-size: 12.5px; }
.frow .field { height: 30px; }
.frow .pickbtn { height: 30px; width: 100%; display: flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line2); border-radius: 6px; background: var(--bg3); color: var(--str); text-transform: lowercase; text-align: left; transition: border-color .2s; }
.frow .pickbtn:hover { border-color: var(--faint); }
.inline2 { display: flex; gap: 8px; }
.err { color: var(--exp); font-size: 12px; min-height: 18px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 2px solid transparent; transition: transform .25s var(--spring), border-color .2s; }
.swatch:hover { transform: scale(1.15); }
.swatch.on { border-color: var(--text); }

/* recurring */
.cron { padding: 14px 0 60px; position: relative; z-index: 1; }
.cron-row {
  display: grid; grid-template-columns: 64px 104px 110px minmax(0, 1fr) minmax(0, 210px) 112px 96px; align-items: center; min-height: 34px; position: relative;
  border-radius: 0; transition: background .2s; animation: slidein .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms);
}
.cron-row:hover { background: var(--bg3); }
.cron-row > div { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 12px; }
.cron-row .at { color: var(--kw); }
.cron-row .nm { color: var(--text); }
.cron-row .ct { color: var(--str); text-transform: lowercase; }
.cron-row .nx { color: var(--cy); }
.cron-row.paused { opacity: .55; }
.cron-row.cancelled { opacity: .35; }
.cron-row .acts { display: flex; gap: 2px; opacity: 0; transition: opacity .2s; }
.cron-row:hover .acts { opacity: 1; }
.cron-row .acts button { width: 24px; height: 24px; border-radius: 5px; display: grid; place-items: center; color: var(--dim); }
.cron-row .acts button:hover { background: var(--bg4); color: var(--text); }
.cron-head { color: var(--faint); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; animation: none; }
.cron-head:hover { background: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 10px; font-size: 11px; background: var(--bg4); color: var(--dim); }
.chip.ok { color: var(--inc); background: rgba(166, 224, 122, .1); }
.chip.warn { color: var(--ty); background: rgba(255, 203, 107, .1); }
.chip.bad { color: var(--exp); background: rgba(255, 107, 129, .1); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; position: relative; }
.pulse::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: ping 2s var(--ease) infinite; }
@keyframes ping { 70%, 100% { transform: scale(2.6); opacity: 0; } }

/* analytics */
.mtable { margin-left: 64px; border-collapse: collapse; font-size: 12px; min-width: 600px; }
.mtable th, .mtable td { padding: 5px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mtable th { color: var(--faint); font-weight: 400; position: sticky; top: 0; background: var(--bg2); }
.mtable td:first-child, .mtable th:first-child { text-align: left; text-transform: lowercase; }
.mtable tr { animation: slidein .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); }
.mtable tr:hover td { background: var(--bg3); }
.heat { border-radius: 3px; padding: 1px 4px; }

/* settings */
.json { padding: 14px 0 80px; position: relative; z-index: 1; }
.json .cl { min-height: 30px; align-items: center; }
.json .indent { display: inline-block; width: 24px; flex: none; }
.json .key { color: var(--fn); }
.json .val { margin-left: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.json .row-anim { animation: slidein .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms); }
.sess { display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------- panel (terminal) */
.panel { border-top: 1px solid var(--line); background: var(--bg1); display: flex; flex-direction: column; height: var(--panel); min-height: 0; position: relative; transition: height .45s var(--ease); }
.panel.shut { height: 0; border-top-color: transparent; }
.panel-tabs { display: flex; align-items: center; gap: 2px; height: 32px; padding: 0 10px; flex: none; }
.ptab { padding: 0 9px; height: 32px; color: var(--faint); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; position: relative; transition: color .2s; }
.ptab.on { color: var(--text); }
.ptab.on::after { content: ''; position: absolute; left: 9px; right: 9px; bottom: 4px; height: 1px; background: var(--text); animation: grow .4s var(--ease); }
.panel-tabs .grow { flex: 1; }
.term { flex: 1; overflow: auto; padding: 2px 16px 10px; font-size: 12.5px; cursor: text; }
.tline { white-space: pre-wrap; word-break: break-word; min-height: 19px; animation: termin .3s var(--ease) both; }
@keyframes termin { from { opacity: 0; transform: translateX(-4px); } }
.tprompt { display: flex; align-items: center; gap: 8px; }
.tprompt .ps { color: var(--inc); flex: none; }
.tprompt .ps b { color: var(--fn); font-weight: 400; }
.tprompt input { flex: 1; background: none; border: 0; outline: none; caret-color: var(--accent); }
.panel-resize { position: absolute; top: -3px; left: 0; right: 0; height: 6px; cursor: row-resize; z-index: 3; }
.panel-resize::after { content: ''; position: absolute; top: 2px; left: 0; right: 0; height: 2px; background: var(--accent); opacity: 0; transition: opacity .2s; }
.panel-resize:hover::after, .panel-resize.drag::after { opacity: .7; }

/* ---------------------------------------------------------------- status bar */
.status {
  grid-area: status; display: flex; align-items: center; gap: 2px; background: var(--bg0); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--dim);
  padding: 0 6px; position: relative; overflow: hidden; z-index: 3; white-space: nowrap;
}
.status::before { content: ''; position: absolute; left: 0; top: -1px; height: 1px; width: 30%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: scan 6s linear infinite; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(400%); } }
.sb { display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 3px; transition: background .2s, color .2s; cursor: default; }
button.sb { cursor: pointer; }
button.sb:hover { background: var(--bg3); color: var(--text); }
.sb svg.i { width: 13px; height: 13px; }
.sb.brand-sb { background: var(--accent); color: #fff; border-radius: 0; margin-left: -6px; padding: 0 10px; font-weight: 600; }
.status .grow { flex: 1; }
.sb .live { color: var(--inc); }
.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0% { background: var(--accent-bg); color: var(--text); } }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 16px; bottom: 36px; z-index: 70; display: grid; gap: 8px; justify-items: end; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 280px; max-width: 420px; padding: 10px 12px; border-radius: 9px; background: var(--bg1); border: 1px solid var(--line2);
  box-shadow: var(--shadow); animation: toastin .5s var(--spring); position: relative; overflow: hidden;
}
.toast .grow { flex: 1; }
.toast .tbar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); transform-origin: left; animation: shrink var(--ttl, 5s) linear forwards; }
@keyframes shrink { to { transform: scaleX(0); } }
.toast.out { animation: toastout .3s var(--swift) forwards; }
@keyframes toastin { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes toastout { to { opacity: 0; transform: translateX(30px); } }

/* ---------------------------------------------------------------- boot and login */
.boot { position: fixed; inset: 0; z-index: 90; background: var(--bg0); display: grid; place-items: center; }
.boot.reveal { animation: reveal .9s var(--ease) forwards; }
@keyframes reveal { to { clip-path: circle(0% at 50% 50%); opacity: 0; } }
.boot-in { width: min(560px, calc(100vw - 40px)); }
.boot-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; font-size: 18px; font-weight: 700; animation: rise .8s var(--ease) both; }
.boot-logo svg { width: 36px; height: 36px; }
.boot-lines { font-size: 13px; min-height: 120px; }
.boot-line { color: var(--dim); animation: termin .35s var(--ease) both; white-space: pre; }
.boot-line .okk { color: var(--inc); }
.boot-bar { height: 2px; background: var(--bg3); border-radius: 2px; overflow: hidden; margin-top: 18px; }
.boot-bar div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent), var(--fn)); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .5s var(--ease); }

.login { position: fixed; inset: 0; z-index: 80; background: var(--bg0); display: grid; place-items: center; overflow: hidden; }
.login canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.login-box {
  position: relative; width: min(500px, calc(100vw - 32px)); background: color-mix(in srgb, var(--bg1) 88%, transparent); border: 1px solid var(--line2); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; backdrop-filter: blur(10px); animation: modalin2 .8s var(--ease);
}
@keyframes modalin2 { from { opacity: 0; transform: translateY(20px) scale(.97); filter: blur(6px); } }
.login-bar { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.login-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--ghost); }
.login-bar i:first-child { background: var(--accent); }
.login-bar span { margin-left: 8px; }
.login-body { padding: 18px 18px 22px; font-size: 13px; }
.login-body .tline { color: var(--dim); }
.pw-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; position: relative; }
.pw-line .ps { color: var(--kw); }
.pw-line input { position: absolute; opacity: 0; pointer-events: none; width: 1px; }
.pw-dots { display: flex; align-items: center; gap: 4px; min-height: 20px; cursor: text; flex: 1; }
.pw-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--text); animation: pop .3s var(--spring); }
.pw-dots .cur { width: 8px; height: 16px; border-radius: 1px; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
.login.shake .login-box { animation: shake .5s var(--swift); }
@keyframes shake { 20% { transform: translateX(-10px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.login.ok .login-box { animation: granted .9s var(--ease) forwards; }
@keyframes granted { 40% { transform: scale(1.02); box-shadow: 0 0 0 1px var(--inc), 0 0 60px rgba(166, 224, 122, .25); } 100% { transform: scale(.9); opacity: 0; filter: blur(8px); } }
.login .hint2 { margin-top: 16px; color: var(--faint); font-size: 11.5px; }
.scramble { color: var(--inc); }

/* ---------------------------------------------------------------- empty, skeleton */
.empty { display: grid; place-items: center; height: 100%; color: var(--faint); text-align: center; padding: 30px; }
.empty .big { font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.skel { background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 4px; height: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- phone */
@media (max-width: 760px) {
  .app { grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: 44px 1fr 52px; grid-template-areas: 'title title' 'side main' 'act act'; }
  .app.side-hidden { grid-template-columns: 0 minmax(0, 1fr); }
  .brand > span:not(.caret) { display: none; }
  .titlebar { gap: 8px; padding: 0 8px; }
  .cmd-trigger { min-width: 0; }
  .cmd-trigger span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .title-right .icon-btn:not(#sync-btn) { display: none; }
  .activity { flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 0; }
  .activity .spacer, .act-ind, .status, .crumbs { display: none; }
  .act-btn { height: 52px; }
  .sidebar { position: fixed; z-index: 40; top: 44px; bottom: 52px; left: 0; width: min(86vw, 340px); transform: translateX(-102%); transition: transform .45s var(--ease); box-shadow: var(--shadow); }
  .app.side-open .sidebar { transform: none; }
  .cmd-trigger { width: auto; flex: 1; margin: 0; }
  .cmd-trigger kbd { display: none; }
  .resizer, .panel { display: none; }
  .page { padding: 12px 16px 40px 0; }
  .ln { width: 30px; padding-right: 10px; }
  .stats, .cols, .block, .mtable { margin-left: 16px; }
  .cols { grid-template-columns: 1fr; }
  .lhead, .lrow, .erow { grid-template-columns: 30px 70px minmax(0, 1fr) 96px 0; }
  .lhead > :nth-child(4), .lrow > :nth-child(4), .lrow > :nth-child(6), .lhead > :nth-child(6) { display: none; }
  .erow { grid-template-columns: 30px 1fr; row-gap: 6px; padding: 8px 0; }
  .erow > * { grid-column: 2; }
  .erow > .ln { grid-column: 1; grid-row: 1; }
  .cron-row { grid-template-columns: 30px 80px 1fr 90px; }
  .cron-row > :nth-child(2), .cron-row > :nth-child(5), .cron-row > :nth-child(7) { display: none; }
  .frow { grid-template-columns: 1fr; gap: 4px; }
  .dayhead { padding-left: 30px; }
  .dayhead .tot { padding-right: 16px; }
  .toasts { bottom: 64px; left: 16px; right: 16px; }
  .toast { min-width: 0; width: 100%; }
}
