/* Tamo dashboard: a calm ledger. Paper, ink, one persimmon accent. */

:root {
  --paper: #f6f1e7;
  --paper-2: #efe8da;
  --card: #fbf8f2;
  --ink: #1f1b16;
  --ink-2: #5b5247;
  --ink-3: #8d8376;
  --rule: #e2d9c8;
  --rule-2: #d4c8b3;
  --accent: #d9481f;
  --accent-ink: #ffffff;
  --accent-soft: #f6dccf;
  --ok: #3f7a4f;
  --ok-soft: #dcebdc;
  --warn: #a0620c;
  --warn-soft: #f3e3c4;
  --bad: #b3261e;
  --bad-soft: #f5d9d5;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --r: 10px;
  --gutter: 16px;
  --maxw: 880px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16130f;
    --paper-2: #1d1914;
    --card: #1f1b16;
    --ink: #f1eadd;
    --ink-2: #bfb4a3;
    --ink-3: #8a7f70;
    --rule: #2f2922;
    --rule-2: #3d362d;
    --accent: #f06a3f;
    --accent-ink: #1a0d06;
    --accent-soft: #3d2117;
    --ok: #7fbf8c;
    --ok-soft: #1e3324;
    --warn: #e2a64b;
    --warn-soft: #3a2c15;
    --bad: #f08a80;
    --bad-soft: #3d1c19;
  }
}
:root[data-theme="dark"] {
  --paper: #16130f;
  --paper-2: #1d1914;
  --card: #1f1b16;
  --ink: #f1eadd;
  --ink-2: #bfb4a3;
  --ink-3: #8a7f70;
  --rule: #2f2922;
  --rule-2: #3d362d;
  --accent: #f06a3f;
  --accent-ink: #1a0d06;
  --accent-soft: #3d2117;
  --ok: #7fbf8c;
  --ok-soft: #1e3324;
  --warn: #e2a64b;
  --warn-soft: #3a2c15;
  --bad: #f08a80;
  --bad-soft: #3d1c19;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* faint ruled-paper lines */
  background-image: linear-gradient(to bottom, transparent 31px, color-mix(in srgb, var(--rule) 45%, transparent) 32px);
  background-size: 100% 32px;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* --- boot --- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); 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: 520px; animation: rise .5s ease-out both; }
.kicker { font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 18px; }
.signin h1 { font: 400 clamp(34px, 7vw, 48px)/1.05 var(--serif); margin: 0 0 18px; letter-spacing: -.01em; }
.signin h1 em { color: var(--accent); }
.lede { color: var(--ink-2); margin: 0 0 28px; font-size: 16px; }
.widget { min-height: 44px; }
.fine { color: var(--ink-3); font-size: 13px; margin-top: 22px; }
.error { color: var(--bad); background: var(--bad-soft); padding: 10px 12px; border-radius: var(--r); font-size: 14px; }

/* --- 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: 14px 0 0;
  background: var(--paper);
  border-bottom: 1px solid var(--rule-2);
}
.brand { display: flex; align-items: center; gap: 8px; font: 400 26px/1 var(--serif); text-decoration: none; padding-bottom: 12px; }
.mark { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; justify-self: center; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 14px;
  padding: 8px 10px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); padding-bottom: 12px; }
.foot { color: var(--ink-3); font-size: 13px; text-align: center; margin-top: 56px; }

/* Inside Telegram there's no sign out, and less room. */
.in-tg .who { display: none; }
@media (max-width: 720px) {
  .top { grid-template-columns: 1fr auto; gap: 0; padding-top: 10px; }
  .brand { padding-bottom: 6px; }
  .who { padding-bottom: 6px; 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: 28px; 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(6px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { font: 400 40px/1 var(--serif); margin: 0; letter-spacing: -.01em; }
.head p { margin: 6px 0 0; color: var(--ink-2); max-width: 52ch; }
h2 { font: 400 26px/1.1 var(--serif); margin: 36px 0 6px; }
h2 + .sub { color: var(--ink-2); margin: 0 0 14px; font-size: 14px; }
.count { font: 500 12px/1 var(--mono); color: var(--ink-3); }

/* --- lists --- */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-2); }
.item {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: start;
  padding: 14px 2px; border-bottom: 1px solid var(--rule);
}
.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: 13px; 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: 13px; }
.empty { padding: 28px 2px; color: var(--ink-3); border-bottom: 1px solid var(--rule); font-style: italic; }

.tag {
  display: inline-block; font: 500 12px/1 var(--mono); padding: 4px 7px; border-radius: 999px;
  background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--rule); cursor: pointer;
}
.tag[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.badge { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px; border-radius: 4px; background: var(--paper-2); 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(--accent-soft); color: var(--accent); }

/* --- controls --- */
.btn {
  border: 1px solid var(--rule-2); background: var(--card); color: var(--ink);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.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: 13px; }

.search {
  width: 100%; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--rule-2); background: var(--card);
}
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }

.editor { display: grid; gap: 8px; }
.editor textarea, .editor input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--rule-2); background: var(--card); resize: vertical;
}
.editor textarea { min-height: 70px; }
.editor .row { display: flex; gap: 8px; justify-content: flex-end; }
.editor .hint { font-size: 12px; color: var(--ink-3); }
.panel { background: var(--card); border: 1px solid var(--rule-2); border-radius: var(--r); padding: 14px; margin-bottom: 18px; }

/* --- activity --- */
.day { font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 26px 0 8px; }
.day:first-child { margin-top: 0; }
.log { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 1px solid var(--rule-2); }
.entry { position: relative; padding: 8px 0 14px; }
.entry::before {
  content: ""; position: absolute; left: -23px; top: 14px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); 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(--accent); background: var(--accent); }
.entry .line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.entry time { font: 400 12px/1 var(--mono); color: var(--ink-3); min-width: 40px; }
.entry .what { font-weight: 500; }
.entry .detail { color: var(--ink-2); font-size: 14px; margin: 4px 0 0 50px; overflow-wrap: anywhere; }
.steps { list-style: none; margin: 6px 0 0 50px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.step { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--paper-2); border: 1px solid var(--rule); color: var(--ink-2); }
.step.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.step .mono { font-size: 11px; color: var(--ink-3); }
.more { display: flex; justify-content: center; margin-top: 18px; }
@media (max-width: 560px) {
  .entry .detail, .steps { margin-left: 0; }
}

/* --- usage --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--rule-2); border-radius: var(--r); padding: 16px; }
.stat .label { font-size: 13px; color: var(--ink-2); }
.stat .value { font: 400 40px/1.1 var(--serif); margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.stat .value small { font: 400 14px var(--sans); color: var(--ink-3); }
.meter { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 3px; transition: width .6s ease-out; }
.meter.high i { background: var(--accent); }
.stat .note { font-size: 12px; color: var(--ink-3); margin-top: 8px; }

.chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 3px; height: 140px; padding: 0 2px; border-bottom: 1px solid var(--rule-2); }
.bar { background: var(--ink-2); border-radius: 2px 2px 0 0; min-height: 1px; position: relative; opacity: .85; }
.bar:hover { background: var(--accent); opacity: 1; }
.bar.zero { background: var(--rule-2); }
.chart-axis { display: flex; justify-content: space-between; font: 400 11px/1 var(--mono); color: var(--ink-3); margin-top: 6px; }
.callout { border: 1px dashed var(--rule-2); border-radius: var(--r); padding: 16px; color: var(--ink-2); font-size: 14px; }
.callout strong { color: var(--ink); font-weight: 500; }

/* --- toast --- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 10px; font-size: 14px;
  display: flex; gap: 14px; align-items: center; box-shadow: 0 6px 24px rgb(0 0 0 / .18); 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; }
