/* ============ SANDERSON DASHBOARD — Ivory v3 ============ */
:root {
  --bg: #F0EEE6;
  --ink: #191919;
  --card: #FFFFFF;
  --edge: #E3DFD3;
  --hair: #F2F0E9;
  --muted: #8A8678;
  --faint: #A09B8C;
  --clay: #CC785C;
  --clay-soft: #F5E9E2;
  --up: #3E7C4F;
  --down: #B3502D;
  --card-h: 420px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
.hidden { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ============ GATE ============ */
.gate { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 200; }
.gate-box { text-align: center; min-width: 300px; }
.gate-logo { font: 600 28px 'Source Serif 4', serif; margin-bottom: 26px; }
.gate-logo em { font-style: normal; color: var(--clay); }
.gate-box input {
  width: 100%; background: var(--card); border: 1px solid var(--edge); border-radius: 12px;
  font: 400 14px 'Inter', sans-serif; padding: 11px 14px; text-align: center; color: var(--ink);
}
.gate-box input:focus { outline: none; border-color: var(--clay); }
.gate-box button {
  width: 100%; margin-top: 10px; background: var(--ink); color: var(--bg); border: none; border-radius: 12px;
  font: 500 13px 'Inter', sans-serif; padding: 11px; cursor: pointer; transition: all .18s ease;
}
.gate-box button:hover { background: var(--clay); transform: scale(1.02); }
.gate-err { color: var(--down); font-size: 12px; margin-top: 12px; min-height: 15px; }

/* ============ RADIAL HERO ============ */
#hero-spacer { height: 100vh; }
#hero {
  position: fixed; inset: 0; height: 100vh; z-index: 50;
  transition: opacity .1s linear;
}
#hero.gone { pointer-events: none; }
#hero-svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.hero-node { cursor: pointer; }
.hero-node circle, .hero-node text { transition: all .2s ease; }

/* core */
.core {
  position: absolute; left: 50%; top: 50%;
  width: 240px; height: 240px; margin: -120px 0 0 -120px;
  perspective: 900px; cursor: pointer;
  will-change: transform, opacity;
}
.core-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .9s cubic-bezier(.4,.1,.2,1);
}
.core.flipped .core-inner { transform: rotateY(180deg); }
.core-face {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--card); border: 1px solid var(--edge);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 8px 40px rgba(204,120,92,.12);
}
.core-back { transform: rotateY(180deg); }
.cf-label { font: 600 10px 'Inter'; letter-spacing: 1.5px; color: var(--muted); }
.cf-value { font: 600 38px 'Source Serif 4', serif; color: var(--ink); }
.cf-chg { font: 600 13px 'IBM Plex Mono', monospace; }
.cf-chg.up { color: var(--up); } .cf-chg.down { color: var(--down); }

/* hero corner widgets */
.hw { position: absolute; transition: opacity .2s ease; }
.hw-label { font: 600 11px 'Inter'; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 8px; }
.hw-tl { top: 44px; left: 56px; }
.hw-clock { font: 600 38px 'Source Serif 4', serif; }
.hw-clock span { font-size: 16px; color: var(--muted); }
.hw-day { color: var(--clay); font-weight: 600; font-size: 13px; margin-top: 2px; }
.hw-mkt { color: var(--muted); font-size: 13px; }
.hw-mkt.open { color: var(--up); }
.hw-tr { top: 50px; right: 56px; text-align: right; }
.hw-brand { font: 600 22px 'Source Serif 4', serif; }
.hw-brand em { font-style: normal; color: var(--clay); }
.hw-sub { font-size: 11px; letter-spacing: 1px; color: var(--faint); margin-top: 3px; }

/* hover-prominent to-do */
.hw-bl {
  bottom: 48px; left: 56px; max-width: 290px;
  padding: 14px 16px; border-radius: 14px; border: 1px solid transparent;
  transition: all .25s ease; transform-origin: bottom left;
}
.hw-bl:hover {
  background: var(--card); border-color: var(--edge);
  box-shadow: 0 8px 28px rgba(25,25,25,.10);
  transform: scale(1.12);
}
.hero-todo-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; padding: 4px 0; }
.hero-todo-dot { width: 9px; height: 9px; border-radius: 99px; border: 1.5px solid var(--clay); flex-shrink: 0; }
.hero-todo-item.done .hero-todo-dot { background: var(--clay); }
.hero-todo-item.done span { color: var(--faint); text-decoration: line-through; }

.hw-bc { bottom: 48px; left: 44%; max-width: 420px; }
#hero-brief { font-size: 12.5px; line-height: 1.6; color: #5A574C; }
.hw-scroll { bottom: 18px; left: 50%; transform: translateX(-50%); font-size: 11px; letter-spacing: 1px; color: var(--faint); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-4px); } }

/* node breakout */
.breakout {
  position: absolute; width: 320px; background: var(--card);
  border: 1px solid var(--edge); border-radius: 16px; padding: 16px 0 6px;
  box-shadow: 0 10px 36px rgba(25,25,25,.12); z-index: 60;
  animation: pop .22s ease;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.breakout .bo-head { padding: 0 18px 8px; }
.breakout .bo-head h4 { font: 600 16px 'Source Serif 4', serif; }
.breakout .nitem { padding: 10px 18px; }
.bo-open {
  display: block; margin: 6px 18px 10px; text-align: center;
  background: var(--ink); color: var(--bg); border: none; border-radius: 10px;
  font: 500 12px 'Inter'; padding: 9px; cursor: pointer; width: calc(100% - 36px);
  transition: all .18s ease;
}
.bo-open:hover { background: var(--clay); }

/* ============ GRID (below hero) ============ */
.wrap { max-width: 1480px; margin: 0 auto; padding: 26px 36px 48px; position: relative; z-index: 10; background: var(--bg); }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; flex-wrap: wrap; gap: 10px; }
.logo { font: 600 26px 'Source Serif 4', serif; }
.logo em { font-style: normal; color: var(--clay); }
.topright { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
#mkt-status.open { color: var(--up); font-weight: 500; }
#clock { font-variant-numeric: tabular-nums; }
#refresh-btn {
  background: var(--card); border: 1px solid var(--edge); border-radius: 99px;
  width: 30px; height: 30px; font-size: 15px; color: var(--ink); cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
#refresh-btn:hover { transform: rotate(45deg) scale(1.08); box-shadow: 0 2px 8px rgba(25,25,25,.10); }

/* mini core chip — landing spot of the morph */
.mini-core {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--edge); border-radius: 99px;
  padding: 7px 16px; font: 600 12.5px 'IBM Plex Mono', monospace;
  opacity: 0; transform: scale(.8); transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 2px 10px rgba(204,120,92,.10);
}
.mini-core.show { opacity: 1; transform: scale(1); }
.mini-core::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--clay); }

/* ============ BRIEF HERO ============ */
.brief { background: var(--ink); color: var(--bg); border-radius: 16px; padding: 22px 28px 24px; margin-bottom: 18px; }
.brief-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.brief h2 { font: 600 20px 'Source Serif 4', serif; color: #E8C4B0; }
#brief-btn {
  background: transparent; border: 1px solid #4A463C; color: #D9D6CC; border-radius: 99px;
  font: 500 12px 'Inter'; padding: 6px 16px; cursor: pointer; transition: all .18s ease;
}
#brief-btn:hover { border-color: #E8C4B0; color: #E8C4B0; transform: scale(1.04); }
.brief-body { font-size: 14px; line-height: 1.7; color: #D9D6CC; }
.brief-body b, .brief-body strong { color: var(--bg); }
.brief-body h3 { font: 600 13px 'Inter'; letter-spacing: 1px; color: #E8C4B0; margin: 12px 0 4px; }
.brief-body h3:first-child { margin-top: 0; }
.brief-body ul { margin: 0 0 6px 18px; }
.brief-empty { color: #8F8B7E; }

/* ============ GRID CARDS ============ */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1200px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) {
  .grid { grid-template-columns: 1fr; }
  .wrap { padding: 18px 14px 40px; }
  :root { --card-h: 360px; }
  .hw-bc, .hw-scroll { display: none; }
  .hw-tl { top: 24px; left: 22px; } .hw-tr { top: 28px; right: 22px; }
  .hw-bl { left: 22px; bottom: 24px; }
  .core { width: 190px; height: 190px; margin: -95px 0 0 -95px; }
  .cf-value { font-size: 30px; }
}

.card {
  background: var(--card); border: 1px solid var(--edge); border-radius: 16px;
  display: flex; flex-direction: column; height: var(--card-h); overflow: hidden;
  transition: box-shadow .2s ease;
  scroll-margin-top: 90px;
}
.card:hover { box-shadow: 0 4px 18px rgba(25,25,25,.06); }
.card.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--clay); } 100% { box-shadow: none; } }
.card-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--hair); }
.card-head h3 { font: 600 16px 'Source Serif 4', serif; margin-top: 6px; }
.tag { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: .8px; padding: 3px 9px; border-radius: 99px; }
.tag-clay  { background: #F5E9E2; color: #CC785C; }
.tag-sage  { background: #EAEFE6; color: #5F7A52; }
.tag-blue  { background: #E6EDF3; color: #41658A; }
.tag-gold  { background: #F4EDDE; color: #8F7335; }
.tag-plum  { background: #EFE8F2; color: #6E5687; }
.tag-stone { background: #ECEAE3; color: #6E6A5C; }
.tag-ink   { background: #E9E8E3; color: #191919; }
.tag-wild  { background: #191919; color: #E8C4B0; }

.card-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.card-foot { border-top: 1px solid var(--hair); color: var(--faint); font-size: 10.5px; padding: 6px 18px; }
.card-scroll::-webkit-scrollbar { width: 6px; }
.card-scroll::-webkit-scrollbar-track { background: transparent; }
.card-scroll::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 99px; }
.card-scroll::-webkit-scrollbar-thumb:hover { background: var(--clay); }

/* quotes */
.qrow {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 8px; align-items: baseline;
  padding: 8px 18px; border-bottom: 1px solid var(--hair);
  transition: transform .16s ease, background .16s ease;
}
.qrow:hover { background: #FAF8F2; transform: scale(1.015); }
.q-sym { font-weight: 600; font-size: 13px; }
.q-name { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-right { text-align: right; }
.q-px { font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.q-chg { font-size: 11px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.q-divider { padding: 6px 18px 4px; color: var(--faint); font-size: 9.5px; letter-spacing: 1.2px; border-bottom: 1px solid var(--hair); background: #FCFBF7; }
.q-placeholder { opacity: .4; }

/* news */
.nitem {
  display: block; padding: 12px 18px; border-bottom: 1px solid var(--hair);
  text-decoration: none; color: inherit;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
  transform-origin: center left;
}
.nitem:hover { background: #FAF8F2; transform: scale(1.02); box-shadow: 0 2px 10px rgba(25,25,25,.05); border-radius: 10px; }
.nt { font-size: 13.5px; line-height: 1.45; font-weight: 500; }
.nm { color: var(--faint); font-size: 11px; margin-top: 5px; }
.nm .src { color: var(--clay); font-weight: 500; }

/* todo */
.todo-input-row { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--hair); }
#todo-input { flex: 1; border: 1px solid var(--edge); border-radius: 10px; background: #FCFBF7; font: 400 13px 'Inter'; padding: 8px 12px; color: var(--ink); }
#todo-input:focus { outline: none; border-color: var(--clay); }
#todo-add {
  background: var(--ink); color: var(--bg); border: none; border-radius: 10px;
  font: 500 12.5px 'Inter'; padding: 8px 16px; cursor: pointer; transition: transform .16s ease, background .16s ease;
}
#todo-add:hover { background: var(--clay); transform: scale(1.05); }
.todo-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--hair); transition: transform .16s ease, background .16s ease; }
.todo-item:hover { background: #FAF8F2; transform: scale(1.015); }
.todo-check {
  width: 18px; height: 18px; border: 1.5px solid var(--edge); border-radius: 6px; background: #fff;
  cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; transition: all .16s ease;
}
.todo-item.done .todo-check { background: var(--clay); border-color: var(--clay); }
.todo-text { flex: 1; font-size: 13px; }
.todo-item.done .todo-text { color: var(--faint); text-decoration: line-through; }
.todo-del { background: none; border: none; color: var(--faint); font-size: 15px; cursor: pointer; opacity: 0; transition: opacity .16s ease, color .16s ease; }
.todo-item:hover .todo-del { opacity: 1; }
.todo-del:hover { color: var(--down); }

/* states */
.loading { color: var(--faint); padding: 16px 18px; font-size: 12px; }
.empty-state { color: var(--muted); padding: 14px 18px; font-size: 12.5px; line-height: 1.55; }
.demo-note { color: var(--faint); padding: 10px 18px; font-size: 11px; }
.foot { margin-top: 22px; color: var(--faint); font-size: 11px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, .core-inner { transition: none !important; animation: none !important; }
}
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--clay); outline-offset: 1px; }
