/* Virtuad Media — original design system (Phase 1). No third-party CSS. */
:root {
  --brand: #0d9488;          /* teal-600 */
  --brand-ink: #0f766e;
  --brand-accent: #f59e0b;   /* amber */
  --sidebar-bg: #0e1f2a;
  --sidebar-fg: #cbd5e1;
  --sidebar-fg-dim: #7c93a4;
  --bg: #f5f7f9;
  --card: #ffffff;
  --ink: #1b2733;
  --muted: #64748b;
  --line: #e4e9ee;
  --ok-bg: #e7f6ef; --ok-fg: #0a7d4f;
  --warn-bg: #fdf3e2; --warn-fg: #a2650b;
  --bad-bg: #fdecec; --bad-fg: #b3261e;
  --muted-bg: #eef1f4; --muted-fg: #556070;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,32,42,.06), 0 1px 3px rgba(16,32,42,.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3.mini { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 .5rem; }
code { background: var(--muted-bg); padding: .05rem .35rem; border-radius: 5px; font-size: .85em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }

/* Layout */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar-bg); color: var(--sidebar-fg); padding: 1.1rem .85rem; display: flex; flex-direction: column; }
.brand { font-weight: 700; color: #fff; display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; }
.brand-lg { font-size: 1.3rem; justify-content: center; margin-bottom: .5rem; color: var(--ink); }
.brand-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand), var(--brand-accent)); color: #fff; font-weight: 800; }
/* Virtuad wordmark logo (same assets as the Virtuad Media Social app). White card
   so the dark-text wordmark reads on the dark sidebar and the login screen. */
.brand-logo { display: inline-block; width: 100%; background: #fff; border-radius: 9px; padding: 8px 11px; box-sizing: border-box; box-shadow: 0 1px 2px rgba(16,32,42,.08); }
.brand-logo img { display: block; width: 100%; height: auto; }
.login-logo { background: #fff; border-radius: 12px; padding: 16px 20px; margin: 0 auto 1rem; box-shadow: var(--shadow); max-width: 300px; }
.login-logo img { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto; }
.login-product { text-align: center; text-transform: uppercase; letter-spacing: .2em; font-size: .82rem; font-weight: 500; color: var(--brand-ink); margin: -.4rem 0 1rem; }
.nav { margin-top: 1.25rem; flex: 1; }
.nav-section { color: var(--sidebar-fg-dim); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; margin: 1rem .35rem .35rem; }
.nav-item { display: flex; align-items: center; gap: .4rem; color: var(--sidebar-fg); padding: .45rem .55rem; border-radius: 8px; font-size: .92rem; }
.nav-item:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.soon { font-size: .62rem; background: rgba(255,255,255,.12); color: var(--sidebar-fg-dim); padding: .05rem .35rem; border-radius: 20px; text-transform: uppercase; letter-spacing: .03em; }
.nav-item.active .soon { background: rgba(255,255,255,.25); color: #fff; }
.phase-note { color: var(--sidebar-fg-dim); font-size: .72rem; padding: .5rem .35rem 0; border-top: 1px solid rgba(255,255,255,.08); margin-top: .5rem; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-left { display: flex; align-items: center; gap: .5rem; }
.topbar-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.company-name { font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: .75rem; }
.switcher select, .form select, .form input, .form-row input, .form-row select { font: inherit; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
.content { padding: 1.5rem; max-width: 1100px; width: 100%; }
.foot { padding: 1rem 1.5rem; border-top: 1px solid var(--line); font-size: .8rem; }
.inline { display: inline; }

/* Cards & KPIs */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card-foot { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); font-size: .88rem; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--brand-ink); }
.kpi-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: .15rem; }
.kpi-sub { font-size: .78rem; margin-top: .25rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); padding: .5rem .6rem; }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }

/* Lists */
.check { list-style: none; padding: 0; margin: 0; }
.check li { padding: .25rem 0 .25rem 1.5rem; position: relative; }
.check li.ok::before { content: "✓"; position: absolute; left: 0; color: var(--ok-fg); font-weight: 700; }
.check li.soon-li::before { content: "○"; position: absolute; left: 0; color: var(--muted); }
.legend { list-style: none; padding: 0; margin: 0; }
.legend li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.legend li:last-child { border-bottom: none; }

/* Pills & banners */
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 20px; }
.pill-ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill-bad { background: var(--bad-bg); color: var(--bad-fg); }
.pill-muted { background: var(--muted-bg); color: var(--muted-fg); }
.banner { border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.banner-why { font-size: .85rem; margin-top: .2rem; }
.banner-next { font-size: .88rem; margin-top: .35rem; font-weight: 600; }
.banner-warn { background: var(--warn-bg); border-color: #f0d9ad; color: #7a4d06; }
.banner-alert { background: var(--bad-bg); border-color: #f3c0bc; color: #8f1d16; }
.banner-info { background: #e8f1fb; border-color: #bcd6f2; color: #14487a; }

/* Forms & buttons */
.form label { display: block; margin-bottom: .8rem; font-size: .85rem; color: var(--muted); }
.form input, .form select { display: block; width: 100%; margin-top: .25rem; color: var(--ink); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .45rem .9rem; border-radius: 8px; cursor: pointer; }
.btn:hover { background: #f2f5f7; }
.btn-small { padding: .25rem .6rem; font-size: .82rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; width: 360px; box-shadow: var(--shadow); }
.login-card .form input { margin-bottom: .8rem; }
.login-card h1 { text-align: center; }

/* Sub-navigation (within a section) */
.subnav { display: flex; gap: .25rem; margin: 0 0 1.25rem; border-bottom: 1px solid var(--line); }
.subnav a { padding: .4rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; font-size: .9rem; }
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 600; }
.num.neg { color: var(--bad-fg); }
.num.pos { color: var(--ok-fg); }
.export { text-align: right; margin: 0 0 .5rem; font-size: .85rem; }
.chips { margin: 0 0 1rem; }
.chip { display: inline-block; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 20px; font-size: .85rem; color: var(--muted); text-transform: capitalize; }
.chip:hover { text-decoration: none; background: #f2f5f7; }
.chip-on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Journal & payout tables */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table.journal tr.clearing td { border-top: 1px solid var(--line); font-weight: 600; }
.table.journal tr.totals td { border-top: 2px solid var(--ink); font-weight: 700; }
.actions { display: flex; align-items: center; gap: .75rem; margin: 0 0 1.25rem; flex-wrap: wrap; }
.reverse-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.reverse-form input[name="reason"] { padding: .4rem .55rem; border: 1px solid var(--line); border-radius: 7px; min-width: 280px; font: inherit; }

@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { display: none; }
  .cols, .form-row { grid-template-columns: 1fr; }
}

/* Idle-session warning modal (DOM injected by session-timeout.js) */
.session-warn-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 1rem; background: rgba(14,31,42,.55); }
.session-warn-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem 1.6rem; width: 400px; max-width: 100%; box-shadow: 0 12px 44px rgba(16,32,42,.30); }
.session-warn-card h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.session-warn-card p { margin: 0 0 1.1rem; color: var(--ink); }
.session-warn-card strong { font-variant-numeric: tabular-nums; color: var(--brand-ink); }
.session-warn-actions { display: flex; gap: .6rem; }

/* AI Advisor top-banner button */
.btn-advisor { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.btn-advisor:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }

/* AI Accounting Advisor */
.advisor-card { padding-bottom: 1rem; }
.advisor { display: grid; grid-template-columns: 210px 1fr; gap: 1rem; margin-top: .9rem; min-height: 460px; }
.adv-side { display: flex; flex-direction: column; gap: .5rem; border-right: 1px solid var(--line); padding-right: .9rem; }
.adv-convs { display: flex; flex-direction: column; gap: .25rem; overflow-y: auto; max-height: 440px; }
.adv-conv { text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: .4rem .55rem; font-size: .82rem; color: var(--ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adv-conv:hover { background: var(--muted-bg); }
.adv-conv.active { background: var(--ok-bg); color: var(--brand-ink); font-weight: 600; }
.adv-main { display: flex; flex-direction: column; min-width: 0; }
.adv-messages { flex: 1; overflow-y: auto; max-height: 52vh; display: flex; flex-direction: column; gap: .7rem; padding: .3rem .2rem .6rem; }
.adv-msg { max-width: 88%; padding: .6rem .8rem; border-radius: 12px; font-size: .92rem; line-height: 1.5; }
.adv-msg p { margin: 0 0 .5rem; } .adv-msg p:last-child { margin-bottom: 0; }
.adv-msg ul, .adv-msg ol { margin: .3rem 0 .5rem; padding-left: 1.2rem; } .adv-msg li { margin: .15rem 0; }
.adv-msg h4 { margin: .5rem 0 .3rem; font-size: .95rem; color: var(--brand-ink); }
.adv-msg code { background: var(--muted-bg); padding: .05rem .3rem; border-radius: 5px; font-size: .86em; }
.adv-user { align-self: flex-end; background: var(--brand); color: #fff; }
.adv-user code { background: rgba(255,255,255,.22); color: #fff; }
.adv-assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.adv-thinking { color: var(--muted); font-style: italic; }
.adv-starters { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .6rem; }
.adv-starter { background: var(--muted-bg); border: 1px solid var(--line); border-radius: 20px; padding: .35rem .7rem; font-size: .8rem; color: var(--ink); cursor: pointer; }
.adv-starter:hover { background: var(--ok-bg); color: var(--brand-ink); }
.adv-composer { display: flex; gap: .5rem; align-items: flex-end; border-top: 1px solid var(--line); padding-top: .7rem; }
.adv-input { flex: 1; resize: vertical; min-height: 2.4rem; font: inherit; font-size: .92rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.adv-input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
@media (max-width: 720px) { .advisor { grid-template-columns: 1fr; } .adv-side { border-right: none; border-bottom: 1px solid var(--line); padding-right: 0; padding-bottom: .6rem; } .adv-convs { flex-direction: row; overflow-x: auto; } }
