/* Personal Dashboard — Hostinger port.
   Conventions shared with Owner Intelligence on the same server:
   LQX corporate palette — Navy #18243A lead, Executive Purple #7656A7,
   Corporate Teal #167F7B, Restricted Gold #B78A3C (exceptional only),
   cream #F7F5F0. The dashboard's own accent is the artifact's restrained
   deep purple (#5B3FA6 light / #A78BFA dark); the sidebar is navy
   (#101E42 light / #0C1834 dark) with a gold hairline. Dark mode follows
   the stored choice, defaulting to the device preference. */

:root {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --surface-muted: #EFECE5;
  --text: #1C2432;
  --muted: #5C6572;
  --border: #DCD6C9;
  --accent: #5B3FA6;
  --accent-soft: #EDE8F7;
  --nav-bg: #101E42;
  --nav-bg-2: #18243A;
  --nav-text: #EDEAE2;
  --nav-muted: #9AA5BD;
  --gold: #B78A3C;
  --red: #B3261E;
  --red-soft: #F9E3E1;
  --amber: #9A6A00;
  --amber-soft: #F7ECD2;
  --green: #1E7A46;
  --green-soft: #E0F0E6;
  --shadow: 0 1px 3px rgba(24, 36, 58, .10);
}
html[data-theme="dark"] {
  --bg: #141B2C;
  --surface: #1D2740;
  --surface-muted: #232F4F;
  --text: #EDEAE2;
  --muted: #A7B0C2;
  --border: #33405F;
  --accent: #A78BFA;
  --accent-soft: #2A2140;
  --nav-bg: #0C1834;
  --nav-bg-2: #101E42;
  --red: #F2A49E;
  --red-soft: #40201D;
  --amber: #E3B95C;
  --amber-soft: #3A2F14;
  --green: #7FCB9B;
  --green-soft: #173526;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
h2, h3, .greeting, .brand { font-family: Newsreader, Georgia, "Times New Roman", serif; }
a { color: var(--accent); }
img, table, pre { max-width: 100%; }
.mini { font-size: .82rem; color: var(--muted); }

/* masthead */
.masthead {
  background: var(--nav-bg);
  color: var(--nav-text);
  border-bottom: 2px solid var(--gold);
  padding: .7rem 1.1rem .6rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
}
.masthead-in {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; flex-wrap: wrap; max-width: 1400px; margin: 0 auto;
}
.greeting { margin: 0; font-size: 1.35rem; }
.dateline { margin: .1rem 0 0; color: var(--nav-muted); font-size: .9rem; }
.masthead-state { text-align: right; }
.state-line { margin: 0; font-size: .95rem; }
.sync-line { margin: .1rem 0 0; color: var(--nav-muted); font-size: .8rem; }
.focus-line {
  max-width: 1400px; margin: .45rem auto 0; font-size: .92rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.focus-line span { color: var(--gold); font-weight: 600; }

/* shell + sidebar */
.shell { display: flex; max-width: 1400px; margin: 0 auto; align-items: stretch; }
.sidebar {
  background: var(--nav-bg-2); color: var(--nav-text);
  width: 288px; flex: 0 0 auto; padding: 1rem .8rem;
  display: flex; flex-direction: column; gap: 1rem; min-height: 70vh;
}
body[data-sidebar="narrow"] .sidebar { width: 192px; }
body[data-sidebar="icons"] .sidebar { width: 72px; padding: 1rem .45rem; }
body[data-sidebar="icons"] .nav-label,
body[data-sidebar="icons"] .width-label,
body[data-sidebar="icons"] .brand span,
body[data-sidebar="icons"] .side-foot .mini,
body[data-sidebar="icons"] .switcher { display: none; }
body[data-sidebar="icons"] .sidebar nav a { justify-content: center; }
.brand { margin: 0; font-size: 1.15rem; line-height: 1.15; }
.brand span { display: block; color: var(--nav-muted); font-size: .95rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar nav a {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  color: var(--nav-text); text-decoration: none;
  padding: .55rem .6rem; border-radius: 8px; min-height: 44px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.badge {
  background: rgba(255,255,255,.16); color: inherit; border-radius: 999px;
  font-size: .75rem; padding: .05rem .5rem; min-width: 1.6rem; text-align: center;
}
.badge-red { background: var(--red); color: #fff; }
.badge-amber { background: var(--amber); color: #fff; }
.width-form { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.width-label { font-size: .8rem; color: var(--nav-muted); }
.width-btns { display: inline-flex; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; overflow: hidden; }
.width-btns button {
  background: transparent; color: var(--nav-text); border: 0; cursor: pointer;
  padding: .45rem .6rem; font-size: .8rem; min-height: 36px;
}
.width-btns button.on { background: var(--accent); color: #fff; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; }
.switcher {
  display: inline-block; border: 1px solid rgba(255,255,255,.35); border-radius: 8px;
  color: var(--nav-text); text-decoration: none; padding: .55rem .7rem; min-height: 44px;
}
.logout button {
  background: transparent; color: var(--nav-muted); border: 0; cursor: pointer;
  padding: .4rem 0; font-size: .85rem; min-height: 36px;
}

/* main */
.main { flex: 1 1 auto; padding: 1rem 1.1rem 5.5rem; min-width: 0; }
.searchbar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.searchbar input {
  flex: 1 1 auto; min-width: 0; padding: .6rem .7rem; font-size: 16px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
}
.searchbar button, .disp-form button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: .6rem 1rem; cursor: pointer; min-height: 44px; font-size: .95rem;
}
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.panel h2 { margin: .1rem 0 .6rem; font-size: 1.3rem; }
.subhead { margin: 1rem 0 .4rem; font-size: 1.05rem; }
.subhead.amber { color: var(--amber); }

/* cards */
.card {
  border: 1px solid var(--border); border-radius: 10px; padding: .8rem .9rem;
  margin: .6rem 0; background: var(--surface);
}
.card h3, .work-row h3 { margin: .3rem 0; font-size: 1.08rem; }
.card h3 a { color: var(--text); text-decoration: none; }
.card-top { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.num {
  font-size: .75rem; font-weight: 700; letter-spacing: .02em;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 6px; padding: .12rem .45rem;
}
.due { font-size: .8rem; color: var(--muted); }
.due-overdue, .due-today { color: var(--red); font-weight: 700; }
.disp { font-size: .78rem; border-radius: 999px; padding: .1rem .55rem; }
.disp-completed { background: var(--green-soft); color: var(--green); }
.disp-cancelled { background: var(--red-soft); color: var(--red); }
.disp-snoozed, .disp-suspended, .disp-waiting { background: var(--amber-soft); color: var(--amber); }
.detail { margin: .35rem 0; white-space: pre-wrap; }
.action { margin: .45rem 0; }
.action-label {
  display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent); margin-right: .45rem;
}
.disp-note { margin: .4rem 0; font-style: italic; color: var(--muted); }
.card-foot { display: flex; justify-content: space-between; margin-top: .5rem; }
.src-link, .open-link { font-size: .88rem; min-height: 32px; }

/* bucket summary cards */
.bucket-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.bucket-card {
  display: flex; flex-direction: column; gap: .2rem; text-decoration: none;
  border: 1px solid var(--border); border-radius: 10px; padding: .8rem;
  color: var(--text); background: var(--surface); min-height: 44px;
}
.bucket-count { font-size: 1.7rem; font-weight: 700; color: var(--accent); }
.bucket-name { font-size: .9rem; color: var(--muted); }
.upcoming { margin: .4rem 0; }

/* work rows */
.work-row { border: 1px solid var(--border); border-radius: 10px; padding: .8rem .9rem; margin: .6rem 0; }
.wstatus { font-size: .75rem; border-radius: 999px; padding: .1rem .55rem; background: var(--surface-muted); color: var(--muted); }
.wstatus-running { background: var(--green-soft); color: var(--green); }
.wstatus-waiting_on_rohan { background: var(--amber-soft); color: var(--amber); }
.wstall { font-size: .78rem; color: var(--amber); font-weight: 700; }
.wsurface { font-size: .78rem; color: var(--muted); }
.stages { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: .5rem 0; }
.stages li { font-size: .78rem; border: 1px solid var(--border); border-radius: 999px; padding: .15rem .55rem; color: var(--muted); }
.stages li.done { background: var(--green-soft); color: var(--green); border-color: transparent; }
.stages li.current { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 700; }
.bar { height: 8px; background: var(--surface-muted); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }

/* archive chips + forms */
.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .8rem; }
.chip {
  border: 1px solid var(--border); border-radius: 999px; padding: .45rem .8rem;
  text-decoration: none; color: var(--text); min-height: 40px; display: inline-flex; align-items: center;
}
.chip.on { background: var(--accent); color: #fff; border-color: transparent; }
.disp-form { display: flex; flex-direction: column; gap: .7rem; max-width: 560px; }
.disp-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.disp-form select, .disp-form input, .disp-form textarea {
  font-size: 16px; padding: .55rem .6rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text);
}
.event { border-left: 3px solid var(--accent-soft); padding-left: .8rem; margin: .7rem 0; }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.4rem; width: 340px; max-width: calc(100vw - 2rem); box-shadow: var(--shadow);
}
.login-card .brand { color: var(--text); }
.login-card .brand span { color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
.login-card label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.login-card input { font-size: 16px; padding: .6rem; border: 1px solid var(--border); border-radius: 8px; }
.login-card button { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: .7rem; min-height: 44px; cursor: pointer; }
.login-err { color: var(--red); font-size: .9rem; }

/* mobile: drawer sidebar + bottom bar */
.hamburger {
  display: none; position: fixed; top: .6rem; right: .6rem; z-index: 40;
  width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1.2rem; cursor: pointer;
}
.scrim { display: none; }
.bottombar { display: none; }
@media (max-width: 1023px) {
  .hamburger { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: 288px !important;
    transform: translateX(-105%); transition: transform .2s ease; overflow-y: auto;
    padding-top: calc(1rem + env(safe-area-inset-top));
  }
  .sidebar.open { transform: translateX(0); }
  body[data-sidebar="icons"] .nav-label, body[data-sidebar="icons"] .brand span,
  body[data-sidebar="icons"] .switcher, body[data-sidebar="icons"] .width-label { display: revert; }
  .scrim.open {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: rgba(10, 14, 24, .5);
  }
  .bucket-cards { grid-template-columns: repeat(2, 1fr); }
  .masthead-state { text-align: left; }
  .bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--nav-bg); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottombar a {
    flex: 1; text-align: center; color: var(--nav-text); text-decoration: none;
    padding: .7rem .2rem; min-height: 44px; font-size: .9rem;
    display: flex; align-items: center; justify-content: center; gap: .35rem;
  }
  .main { padding-bottom: 6.5rem; }
}
