/* Tamo dashboard, in heytamo.com's look: light paper, ink text, coral as the
   one brand colour (always a fill, with ink on top), Funnel Display + Sans. */

:root {
  --paper: #faf8f4;
  --surface: #ffffff;
  --sunk: #f3efe8;
  --ink: #1b1714;
  --ink-2: #4b443e;
  --ink-3: #857c74;
  --line: #e6e0d6;
  --line-2: #d6cec2;
  --tamo: #ff6a3d;
  --tamo-hover: #ff7d55;
  --tamo-soft: #ffe3d8;
  --on-tamo: #1b1714; /* ink on coral, in both themes */
  --ok: #2f7a45;
  --ok-soft: #dff1e2;
  --warn: #93600b;
  --warn-soft: #f8ebcf;
  --bad: #c2361b;
  --bad-soft: #fbe1da;

  --display: "Funnel Display", ui-sans-serif, system-ui, sans-serif;
  --body: "Funnel Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r: 12px;
  --r-lg: 18px;
  --gutter: 16px;
  --maxw: 920px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141210;
    --surface: #1d1a17;
    --sunk: #24201c;
    --ink: #f3eee7;
    --ink-2: #c7bdb2;
    --ink-3: #8f857b;
    --line: #2e2924;
    --line-2: #3d3630;
    --tamo-soft: #3b2219;
    --ok: #82c893;
    --ok-soft: #1c3223;
    --warn: #e4ac52;
    --warn-soft: #3a2c15;
    --bad: #f28d7b;
    --bad-soft: #3e1d17;
  }
}
:root[data-theme="dark"] {
  --paper: #141210;
  --surface: #1d1a17;
  --sunk: #24201c;
  --ink: #f3eee7;
  --ink-2: #c7bdb2;
  --ink-3: #8f857b;
  --line: #2e2924;
  --line-2: #3d3630;
  --tamo-soft: #3b2219;
  --ok: #82c893;
  --ok-soft: #1c3223;
  --warn: #e4ac52;
  --warn-soft: #3a2c15;
  --bad: #f28d7b;
  --bad-soft: #3e1d17;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
::selection { background: var(--tamo); color: var(--on-tamo); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

/* --- the mascot --- */
.tamo { width: 28px; height: 28px; flex: none; overflow: visible; }
.tamo.big { width: 72px; height: 72px; margin-bottom: 22px; }
.tamo-body { fill: var(--tamo); }
.tamo-eyes { fill: var(--on-tamo); transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; transition: translate .15s ease-out; }
.tamo-mouth { fill: none; stroke: var(--on-tamo); stroke-width: 3.5; stroke-linecap: round; }
@keyframes blink { 0%, 94%, 100% { scale: 1 1; } 97% { scale: 1 .1; } }

/* --- boot --- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--tamo); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.6); opacity: .5; } }

/* --- sign in --- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 40px var(--gutter); }
.signin-card { max-width: 540px; animation: rise .5s ease-out both; }
.signin h1 { font-size: clamp(36px, 7vw, 54px); line-height: 1.04; margin: 0 0 18px; }
.lede { color: var(--ink-2); margin: 0 0 30px; font-size: 18px; }
.widget { min-height: 44px; }
.fine { color: var(--ink-3); font-size: 14px; margin-top: 22px; }
.error { color: var(--bad); background: var(--bad-soft); padding: 12px 14px; border-radius: var(--r); font-size: 15px; }

/* --- shell --- */
.app { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 48px; }
.top {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px;
  padding: 16px 0;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font: 700 21px/1 var(--display); letter-spacing: -0.03em; text-decoration: none; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; justify-self: center; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  text-decoration: none; color: var(--ink-2); font-size: 15px; font-weight: 500;
  padding: 7px 14px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent;
  transition: color .15s, background .15s;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--surface); border-color: var(--line); font-weight: 600; }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-3); }
.foot { color: var(--ink-3); font-size: 14px; text-align: center; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }

/* Inside Telegram there's no sign out, and less room. */
.in-tg .who { display: none; }
@media (max-width: 760px) {
  .top { grid-template-columns: 1fr auto; gap: 12px 0; padding: 12px 0 10px; }
  .who { grid-row: 1; grid-column: 2; }
  .tabs { grid-column: 1 / -1; justify-self: stretch; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .in-tg .top { grid-template-columns: 1fr; }
}

/* --- views --- */
.view { padding-top: 36px; outline: none; }
.view > * { animation: rise .35s ease-out both; }
.view > *:nth-child(2) { animation-delay: .04s; }
.view > *:nth-child(3) { animation-delay: .08s; }
.view > *:nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { font-size: clamp(32px, 5vw, 42px); line-height: 1.05; margin: 0; }
.head p { margin: 8px 0 0; color: var(--ink-2); max-width: 54ch; }
h2 { font-size: 24px; line-height: 1.15; margin: 44px 0 6px; }
h2 + .sub { color: var(--ink-2); margin: 0 0 16px; font-size: 15px; max-width: 64ch; }
.count { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* --- lists: one white card, rows split by hairlines --- */
.list {
  list-style: none; margin: 0; padding: 0 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.list + .list { margin-top: 12px; }
.item {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center;
  padding: 15px 0; border-bottom: 1px solid var(--line);
}
.item:last-child, .empty:last-child { border-bottom: 0; }
.item .main { min-width: 0; }
.item .title { margin: 0; overflow-wrap: anywhere; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; font-size: 14px; color: var(--ink-3); }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item.paused .title { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: 13.5px; }
.empty { padding: 28px 0; color: var(--ink-3); border-bottom: 1px solid var(--line); }
p.empty { padding: 28px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; line-height: 1; padding: 6px 10px; border-radius: 999px;
  background: var(--sunk); color: var(--ink-2); border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s;
}
button.tag { background: var(--surface); border-color: var(--line); }
.tag:hover { border-color: var(--line-2); }
.tag[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.badge { display: inline-block; font-size: 12.5px; font-weight: 600; line-height: 1; padding: 5px 9px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--tamo); color: var(--on-tamo); }

/* --- controls --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--tamo); border-color: var(--tamo); color: var(--on-tamo); padding: 11px 18px; border-radius: var(--r); font-size: 15px; }
.btn.primary:hover { background: var(--tamo-hover); border-color: var(--tamo-hover); }
.editor .btn.primary { padding: 8px 16px; font-size: 14px; border-radius: 10px; }
.btn.danger { color: var(--bad); }
.btn.danger.sure { background: var(--bad); border-color: var(--bad); color: #fff; }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; }
.link:hover { color: var(--ink); }

.search {
  width: 100%; padding: 12px 16px; border-radius: 14px;
  border: 1.5px solid var(--line-2); background: var(--surface); font-size: 16px;
}
.search::placeholder { color: var(--ink-3); }
.search:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--tamo-soft); }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }

.editor { display: grid; gap: 8px; }
.editor textarea, .editor input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--surface); resize: vertical;
}
.editor textarea:focus, .editor input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--tamo-soft); }
.editor textarea { min-height: 76px; }
.editor .row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.editor .hint { font-size: 13px; color: var(--ink-3); }
.panel { background: var(--tamo-soft); border-radius: var(--r-lg); padding: 16px; margin-bottom: 22px; }

/* --- activity --- */
.day { font: 600 17px/1.2 var(--display); letter-spacing: -0.01em; color: var(--ink); margin: 34px 0 10px; }
.day:first-child { margin-top: 0; }
.log { list-style: none; margin: 0; padding: 6px 18px 6px 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); position: relative; }
.log::before { content: ""; position: absolute; left: 22px; top: 22px; bottom: 22px; width: 1px; background: var(--line); }
.entry { position: relative; padding: 10px 0 12px; }
.entry + .entry { border-top: 1px solid var(--line); }
.entry::before {
  content: ""; position: absolute; left: -23px; top: 16px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--ink-3);
}
.entry.ok::before { border-color: var(--ok); }
.entry.bad::before { border-color: var(--bad); background: var(--bad); }
.entry.ask::before { border-color: var(--tamo); background: var(--tamo); }
.entry .line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.entry time { font-size: 13px; color: var(--ink-3); min-width: 42px; font-variant-numeric: tabular-nums; }
.entry .what { font-weight: 600; }
.entry .detail { color: var(--ink-2); font-size: 15px; margin: 4px 0 0 52px; overflow-wrap: anywhere; }
.steps { list-style: none; margin: 8px 0 0 52px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.step { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); }
.step.bad { background: var(--bad-soft); color: var(--bad); }
.step .mono { font-size: 12px; color: var(--ink-3); }
.more { display: flex; justify-content: center; margin-top: 20px; }
@media (max-width: 560px) {
  .entry .detail, .steps { margin-left: 0; }
}

/* --- usage --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.stat .label { font-size: 14px; color: var(--ink-2); }
.stat .value { font: 600 42px/1.1 var(--display); letter-spacing: -0.03em; margin: 8px 0 12px; font-variant-numeric: tabular-nums; }
.stat .value small { font: 400 15px var(--body); letter-spacing: 0; color: var(--ink-3); }
.meter { height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 4px; transition: width .6s ease-out; }
.meter.high i { background: var(--tamo); }
.stat .note { font-size: 13px; color: var(--ink-3); margin: 10px 0 0; }

.chart {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 4px; height: 160px;
  padding: 20px 20px 0; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.bar { background: var(--ink); border-radius: 4px 4px 0 0; min-height: 1px; opacity: .85; transition: background .15s; }
.bar:hover { background: var(--tamo); opacity: 1; }
.bar.zero { background: var(--line-2); }
.chart-axis {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
  padding: 8px 20px 12px; background: var(--surface); border: 1px solid var(--line); border-top-color: var(--line-2); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.callout { background: var(--tamo-soft); border-radius: var(--r-lg); padding: 18px 20px; color: var(--ink-2); font-size: 15px; }
.callout strong { color: var(--ink); font-weight: 600; }

/* --- toast --- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: var(--r); font-size: 15px;
  display: flex; gap: 14px; align-items: center; box-shadow: 0 8px 28px rgb(0 0 0 / .16); z-index: 20;
  max-width: calc(100vw - 32px); animation: rise .2s ease-out both;
}
.toast .link { color: var(--paper); }
.toast.bad { background: var(--bad); color: #fff; }
