/* obnamia.tech — one stylesheet, public + private. */

:root {
  --bg:      #0b0d10;
  --panel:   #14181d;
  --panel-2: #1b2027;
  --line:    #262d36;
  --ink:     #e8ecf1;
  --dim:     #8b97a6;
  --accent:  #4ade80;
  --danger:  #f87171;
  --radius:  12px;
  --wrap:    initial;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.center {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; }
h2 { font-size: 17px; letter-spacing: -0.01em; margin: 0 0 8px; }
p  { margin: 0 0 14px; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font: 13px/1.5 ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 6px;
}

.lede  { color: var(--dim); font-size: 17px; max-width: 62ch; }
.dim   { color: var(--dim); }
.small { font-size: 13px; }
.num   { text-align: right; font-variant-numeric: tabular-nums; }

.mark { color: var(--accent); margin-bottom: 14px; }

/* ---------------------------------------------------------------- public -- */

.hero { padding: 40px 0 20px; }

.btn {
  display: inline-block;
  margin-top: 10px;
  padding: 11px 20px;
  background: var(--accent);
  color: #07110b;
  font-weight: 600;
  border-radius: var(--radius);
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 36px 0;
}

.card, .panel, .module {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card p, .module p { color: var(--dim); font-size: 14px; margin: 0; }

.foot {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 18px; margin-top: 40px;
  font-size: 13px; color: var(--dim);
}

/* ------------------------------------------------------------------ auth -- */

.auth {
  width: 100%; max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px 24px;
}
.auth h1 { font-size: 22px; margin-bottom: 20px; }

label {
  display: block;
  font-size: 13px; color: var(--dim);
  margin: 14px 0 6px;
}

input[type=text], input[type=password] {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font-size: 16px; /* 16px stops iOS zooming the field on focus */
}
input:focus-visible, button:focus-visible, .dropzone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  margin-top: 20px;
  width: 100%;
  padding: 11px 16px;
  background: var(--accent);
  color: #07110b;
  border: 0; border-radius: 9px;
  font: inherit; font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }

.error {
  background: rgba(248, 113, 113, .1);
  border: 1px solid rgba(248, 113, 113, .4);
  color: var(--danger);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 14px;
  margin-bottom: 4px;
}

/* ------------------------------------------------------------------- app -- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink); font-weight: 600; letter-spacing: -0.01em;
}
.brand svg { color: var(--accent); }
.brand:hover { text-decoration: none; }

button.link {
  width: auto; margin: 0; padding: 6px 12px;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
}
button.link:hover { color: var(--ink); filter: none; }

.crumb { font-size: 13px; color: var(--dim); margin-bottom: 8px; }

.modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 28px 0;
}
.module { display: block; color: inherit; transition: border-color .15s, transform .15s; }
.module:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }

.badge {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 999px;
  margin-bottom: 10px;
  background: var(--panel-2); color: var(--dim);
  border: 1px solid var(--line);
}
.badge.porting { background: rgba(74, 222, 128, .12); color: var(--accent); border-color: rgba(74, 222, 128, .35); }

.panel { margin-top: 28px; }
.panel h2 { font-size: 15px; }

/* ---------------------------------------------------------------- upload -- */

.drop input[type=file] {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; overflow: hidden;
}
.dropzone {
  display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center; text-align: center;
  margin: 14px 0 0;
  padding: 26px 18px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--panel-2); }
.dropzone strong { font-weight: 600; }

.recent {
  width: 100%;
  border-collapse: collapse;
  margin-top: 22px;
  font-size: 13px;
}
.recent caption { text-align: left; padding-bottom: 8px; }
.recent th, .recent td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.recent th { color: var(--dim); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.recent th.num, .recent td.num { text-align: right; }
.recent tr:last-child td { border-bottom: 0; }

@media (max-width: 520px) {
  .wrap { padding: 32px 18px 56px; }
  .topbar { padding: 12px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ── Trading Journal ────────────────────────────────────────────────────────
   Tables are the primary interface here, and phones are a first-class reader,
   so every table scrolls inside its own container rather than forcing the page
   to scroll sideways. */

.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .5rem 0; }
.tablewrap table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tablewrap th, .tablewrap td { padding: .45rem .6rem; text-align: left; white-space: nowrap; }
.tablewrap thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel-2); color: var(--dim);
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
}
.tablewrap tbody tr { border-top: 1px solid var(--line); }
.tablewrap tbody tr:hover { background: var(--panel-2); }
.tablewrap td.num, .tablewrap th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Gain/loss carries a shape as well as a colour: the sign is always printed,
   so the table stays readable to anyone who cannot separate red from green. */
.up   { color: var(--accent); }
.down { color: var(--danger); }

.verdict {
  display: inline-block; padding: .05rem .45rem; border-radius: 999px;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid var(--line); color: var(--dim);
}
.verdict.aligned { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.verdict.counter { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.verdict.chop    { color: #fbbf24; border-color: #fbbf2455; }

.statgrid {
  display: grid; gap: .75rem; margin: 1rem 0;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem .9rem;
}
.stat .k { display: block; color: var(--dim); font-size: .78rem;
           text-transform: uppercase; letter-spacing: .04em; }
.stat .v { display: block; font-size: 1.45rem; font-weight: 650;
           margin: .15rem 0; font-variant-numeric: tabular-nums; }
.stat .s { display: block; color: var(--dim); font-size: .8rem; }

.panel.accent { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.warn { color: #fbbf24; }

.equity { width: 100%; height: 140px; color: var(--accent); display: block; }

.filters { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin: .5rem 0; }
.filters input {
  flex: 1 1 240px; padding: .5rem .7rem;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.filters input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.charts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.charts figure { margin: 0; }
.charts img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
}
.charts figcaption { margin-top: .35rem; }

.note h3, .note h4 { margin: 1.1rem 0 .4rem; }
.note blockquote {
  margin: .6rem 0; padding: .5rem .8rem;
  border-left: 3px solid var(--line); color: var(--dim); background: var(--panel-2);
  border-radius: 0 8px 8px 0;
}
.note ul, .note ol { padding-left: 1.2rem; }
.note li { margin: .2rem 0; }

/* Tagging */
.progress {
  height: 8px; border-radius: 999px; background: var(--panel-2);
  overflow: hidden; margin: .6rem 0;
}
.progress span { display: block; height: 100%; background: var(--accent); }

/* An untagged row is the work still to do, so it is marked structurally rather
   than only by colour. */
#daytrades tr.untagged { background: color-mix(in srgb, #fbbf24 7%, transparent); }
#daytrades tr.untagged td:first-child { box-shadow: inset 3px 0 0 #fbbf24; }

select.tag {
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: .3rem .4rem; font: inherit; font-size: .85rem; max-width: 15rem;
}
select.tag:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
select.tag:disabled { opacity: .7; }
.saved { min-width: 4.5rem; display: inline-block; }

/* Section nav — the journal is one thing with sections, not four pages. */
.subnav {
  display: flex; gap: .25rem; flex-wrap: wrap;
  margin: .75rem 0 1.25rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--line);
}
.subnav a {
  padding: .35rem .7rem; border-radius: 999px;
  color: var(--dim); text-decoration: none; font-size: .9rem;
}
.subnav a:hover { background: var(--panel-2); color: var(--ink); }
.subnav a.on { background: var(--panel-2); color: var(--ink); font-weight: 600; }
.subnav a.away { margin-left: auto; }

.daynav { display: flex; gap: 1rem; margin: .25rem 0 1rem; flex-wrap: wrap; }

.badge.live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.check { display: inline-flex; align-items: center; gap: .35rem; color: var(--dim); font-size: .9rem; }

/* Sortable headers must look and behave like controls, keyboard included. */
th.sortcol { cursor: pointer; user-select: none; }
th.sortcol:hover { color: var(--ink); }
th.sortcol:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
th.sortcol::after { content: ' ⇅'; opacity: .35; }
th[aria-sort="ascending"]::after  { content: ' ↑'; opacity: 1; }
th[aria-sort="descending"]::after { content: ' ↓'; opacity: 1; }

/* Playbook */
.levels { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.level { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; }
.level .num {
  display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem;
  border-radius: 999px; background: var(--accent); color: #0b0d10;
  font-weight: 700; font-size: .85rem;
}
.level h3 { margin: .5rem 0 .3rem; font-size: 1.05rem; }
.level p { margin: .3rem 0; }
.punchline {
  margin-top: 1rem; padding: .7rem .9rem; border-radius: 8px;
  background: var(--panel-2); border-left: 3px solid var(--accent);
}

ol.steps { list-style: none; counter-reset: step; padding: 0; margin: .5rem 0 0; }
ol.steps li {
  counter-increment: step; position: relative;
  padding: .55rem 0 .55rem 2.4rem; border-top: 1px solid var(--line);
}
ol.steps li::before {
  content: counter(step); position: absolute; left: 0; top: .55rem;
  display: grid; place-items: center; width: 1.6rem; height: 1.6rem;
  border-radius: 999px; background: var(--panel-2); color: var(--dim);
  font-size: .8rem; font-weight: 700;
}
details.routine summary { cursor: pointer; }
details.routine[open] summary { margin-bottom: .5rem; }
