/* TGT HQ theme on top of Pico.css.
   Brand: ink #19151d · blue #3b9cc4 · cyan #62deef
   Everything is driven by Pico CSS variables; light and dark follow the
   OS via prefers-color-scheme. */

:root {
  --tgt-ink: #19151d;
  --tgt-blue: #3b9cc4;
  --tgt-cyan: #62deef;
  --tgt-green: #3ba97c;
  --tgt-red: #d93526;
  --tgt-amber: #c98a1b;
}

/* ---------- Pico overrides: light ---------- */
:root {
  --pico-primary: #21768f;                    /* readable brand-blue links */
  --pico-primary-hover: #185a6e;
  --pico-primary-underline: rgba(59, 156, 196, 0.4);
  --pico-primary-background: var(--tgt-blue); /* buttons */
  --pico-primary-hover-background: #2f86ac;
  --pico-primary-inverse: #0c2530;            /* ink text on blue buttons */
  --pico-primary-focus: rgba(59, 156, 196, 0.35);
}

/* ---------- Pico overrides: dark ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pico-background-color: var(--tgt-ink);
    --pico-card-background-color: #211c29;
    --pico-card-sectioning-background-color: #1e1926;
    --pico-dropdown-background-color: #211c29;
    --pico-form-element-background-color: #14111a;
    --pico-form-element-border-color: #3a3346;
    --pico-muted-border-color: #322b3d;
    --pico-primary: var(--tgt-cyan);
    --pico-primary-hover: #8fe9f5;
    --pico-primary-underline: rgba(98, 222, 239, 0.4);
    --pico-primary-background: var(--tgt-cyan);
    --pico-primary-hover-background: #43cfe4;
    --pico-primary-inverse: var(--tgt-ink);
    --pico-primary-focus: rgba(98, 222, 239, 0.35);
  }
}

/* ---------- Layout: grouped left sidebar, dark in both modes ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem;
  max-width: 72rem;
}

.content-anon {
  margin: 0 auto;
}

.sidebar {
  flex: 0 0 14.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--tgt-ink);
  border-right: 1px solid rgba(98, 222, 239, 0.2);
  padding: 1.25rem 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.brand:hover {
  color: var(--tgt-cyan);
}

.brand-logo {
  height: 1.75rem;
  width: 1.75rem;
}

.sidebar-brand {
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
}

.sidebar-brand .brand-logo {
  height: 2.1rem;
  width: 2.1rem;
}

/* Collapsible nav sections (native <details>, state kept in localStorage) */
.nav-section {
  margin: 0;
  padding: 0;
  border: none;
}

.nav-section summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #7e8b94;
  margin: 1rem 0 0.25rem;
  padding: 0.15rem 0.75rem 0.15rem 0.6rem;
}

.nav-section summary::-webkit-details-marker {
  display: none;
}

.nav-section summary::after {
  content: "▸";
  font-size: 0.8rem;
  color: #7e8b94;
  transition: transform 0.15s ease;
  transform: none;
  background: none;
  width: auto;
  height: auto;
  float: none;
  margin: 0;
}

.nav-section[open] summary::after {
  transform: rotate(90deg);
}

.nav-section summary:hover {
  color: var(--tgt-cyan);
}

.nav-section summary:hover::after {
  color: var(--tgt-cyan);
}

.nav-soon {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7e8b94;
  border: 1px solid #3a3346;
  border-radius: 999px;
  padding: 0 0.4rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar nav a {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: var(--pico-border-radius);
  color: #c8d3da;
  text-decoration: none;
}

.sidebar nav a:hover {
  background: rgba(98, 222, 239, 0.1);
  color: var(--tgt-cyan);
}

.sidebar nav a.active {
  background: rgba(59, 156, 196, 0.22);
  color: var(--tgt-cyan);
  font-weight: 600;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(98, 222, 239, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-foot a {
  color: #c8d3da;
  text-decoration: none;
  padding: 0.3rem 0.6rem;
}

.sidebar-foot a:hover {
  color: var(--tgt-cyan);
}

.logout-form {
  margin: 0;
}

.logout-form button {
  margin: 0;
  padding: 0.25rem 0.75rem;
  width: auto;
  background: transparent;
  border-color: rgba(98, 222, 239, 0.5);
  color: var(--tgt-cyan);
  font-size: 0.85rem;
}

.logout-form button:hover {
  background: rgba(98, 222, 239, 0.12);
}

/* Mobile: sidebar becomes an off-canvas drawer behind a hamburger. */
.topbar {
  display: none;
}

.nav-overlay {
  display: none;
}

@media (max-width: 991px) {
  .topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--tgt-ink);
    padding: 0.6rem 1rem;
    position: sticky;
    top: 0;
    z-index: 60;
    border-bottom: 1px solid rgba(98, 222, 239, 0.2);
  }

  .nav-toggle {
    background: none;
    border: none;
    color: var(--tgt-cyan);
    font-size: 1.4rem;
    padding: 0.1rem 0.4rem;
    margin: 0;
    width: auto;
    line-height: 1;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -16rem;
    width: 15rem;
    height: 100%;
    z-index: 80;
    transition: left 0.2s ease;
    box-shadow: none;
  }

  body.nav-open .sidebar {
    left: 0;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.45);
  }

  body.nav-open .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(25, 21, 29, 0.55);
    z-index: 70;
  }

  .content {
    padding: 1rem;
  }
}

/* ---------- Page furniture ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

h1, h2, h3 {
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

hgroup p {
  color: var(--pico-muted-color);
}

main > section > h2,
main h2 {
  font-size: 1.15rem;
  margin: 2.25rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

h2 small {
  color: var(--pico-muted-color);
  font-weight: 500;
  font-size: 0.85rem;
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input,
.filter-bar button {
  width: auto;
  margin-bottom: 0.5rem;
}

.notice {
  border-left: 4px solid var(--tgt-cyan);
  padding: 0.5rem 1rem;
  background: var(--pico-card-background-color);
  border-radius: 0 var(--pico-border-radius) var(--pico-border-radius) 0;
}

.notice.error {
  border-left-color: var(--tgt-red);
}

/* ---------- Cards ---------- */
article {
  border: 1px solid var(--pico-muted-border-color);
  box-shadow: 0 1px 3px rgba(25, 21, 29, 0.08);
  border-radius: 0.6rem;
}

article > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  border-bottom: 2px solid rgba(59, 156, 196, 0.35);
  font-size: 0.95rem;
}

article > header a {
  text-decoration: none;
}

article > footer {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

/* KPI stat tiles */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.9rem;
  margin: 1.25rem 0 1.5rem;
}

.stat {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.6rem;
  padding: 0.85rem 1.1rem;
  box-shadow: 0 1px 3px rgba(25, 21, 29, 0.08);
}

.stat small {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--pico-muted-color);
  margin-bottom: 0.25rem;
}

.stat strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat.good strong { color: var(--tgt-green); }
.stat.bad strong { color: var(--tgt-red); }

/* Card grid + in-card lists */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1rem;
  align-items: start;
}

.card-grid article {
  margin: 0;
}

.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.card-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--pico-muted-border-color);
}

.card-list li:last-child {
  border-bottom: none;
}

.card-list .meta {
  color: var(--pico-muted-color);
  font-size: 0.85rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.card-list.stacked li {
  display: block;
}

.card-list.stacked .meta {
  display: block;
  white-space: normal;
}

.card-sub {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--pico-muted-color);
  margin: 0.75rem 0 0.15rem;
}

.card-sub:first-child {
  margin-top: 0;
}

.chip {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(59, 156, 196, 0.16);
  color: var(--pico-primary);
  font-variant-numeric: tabular-nums;
}

a.chip {
  text-decoration: none;
}

/* Tab row (Income | Invoices) */
.tabs {
  display: flex;
  justify-content: flex-start;  /* Pico's nav default is space-between */
  gap: 1.5rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  margin: 0.25rem 0 1.25rem;
}

.tabs a {
  padding: 0.35rem 0.1rem;
  margin-bottom: -1px;
  color: var(--pico-muted-color);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}

.tabs a:hover {
  color: var(--pico-primary);
}

.tabs a.active {
  color: var(--pico-primary);
  border-bottom-color: var(--tgt-cyan);
}

/* ---------- Tables (rendered as cards) ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.6rem;
  padding: 0.25rem 1rem;
  box-shadow: 0 1px 3px rgba(25, 21, 29, 0.08);
  margin-bottom: 1.25rem;
}

.table-wrap table {
  margin-bottom: 0;
}

.table-wrap table tbody td,
.table-wrap table thead th {
  background: transparent;
}

table {
  font-variant-numeric: tabular-nums;
}

table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pico-muted-color);
  border-bottom: 2px solid rgba(59, 156, 196, 0.4);
}

table tbody tr:last-child td {
  border-bottom: none;
}

table tbody tr:hover td {
  background: rgba(59, 156, 196, 0.06);
}

tr.overdue td {
  color: var(--tgt-red);
}

/* ---------- Status badges ---------- */
.badge {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(59, 156, 196, 0.15);
  color: var(--pico-primary);
  white-space: nowrap;
}

.badge-paid, .badge-active {
  background: rgba(59, 169, 124, 0.16);
  color: var(--tgt-green);
}

.badge-open, .badge-prospect {
  background: rgba(59, 156, 196, 0.16);
  color: var(--pico-primary);
}

.badge-draft, .badge-past, .badge-void {
  background: rgba(128, 128, 128, 0.15);
  color: var(--pico-muted-color);
}

.badge-uncollectible, .badge-overdue {
  background: rgba(217, 53, 38, 0.14);
  color: var(--tgt-red);
}

.badge-warning {
  background: rgba(201, 138, 27, 0.16);
  color: var(--tgt-amber);
}

.badge-cancelled {
  background: rgba(128, 128, 128, 0.15);
  color: var(--pico-muted-color);
}

.badge-expired {
  background: rgba(217, 53, 38, 0.14);
  color: var(--tgt-red);
}

.prio-high { color: var(--tgt-red); font-weight: 600; }
.prio-low { color: var(--pico-muted-color); }

/* ---------- Forms ---------- */
input, select, textarea, button {
  font-size: 1rem;
}

label {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

/* Entry forms sit in a contained card, not full page width */
.fast-entry {
  max-width: 34rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.6rem;
  padding: 1.5rem 1.5rem 0.5rem;
  box-shadow: 0 1px 3px rgba(25, 21, 29, 0.08);
}

.fast-entry button[type="submit"] {
  width: 100%;
}

.inline-form {
  display: inline-block;
  margin: 0;
}

.inline-form button {
  margin: 0;
  padding: 0.3rem 0.8rem;
  width: auto;
}

.danger-actions {
  display: flex;
  gap: 0.75rem;
}

/* ---------- Login ---------- */
.login-card {
  max-width: 26rem;
  margin: 2.5rem auto;
  padding: 2rem;
  border-top: 3px solid var(--tgt-cyan);
}

.login-head {
  text-align: center;
}

.login-logo {
  height: 5.5rem;
  width: 5.5rem;
  margin-bottom: 0.5rem;
}

/* ---------- Boards (pipeline + todos) ---------- */
.board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 1rem;
}

.board-col {
  flex: 0 0 15rem;
  background: var(--pico-card-sectioning-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-top: 3px solid var(--tgt-blue);
  border-radius: var(--pico-border-radius);
  padding: 0.75rem;
}

.board-col > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.board-card {
  margin: 0 0 0.75rem;
  padding: 0.75rem;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.board-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(25, 21, 29, 0.18);
}

.board-empty {
  text-align: center;
  margin: 0;
}

/* ---------- Todo cards ---------- */
.todo-card {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0 0 0.5rem;
  padding: 0.6rem 0.75rem;
  cursor: grab;
  border-left: 3px solid var(--tgt-blue);
}

.todo-card.done {
  opacity: 0.45;
  padding: 0.25rem 0.75rem;
  cursor: default;
  border-left-color: var(--pico-muted-border-color);
}

.toggle-form {
  margin: 0;
}

.toggle-form input[type="checkbox"] {
  margin: 0;
}

.todo-body {
  flex: 1;
  min-width: 0;
}

.todo-meta {
  display: block;
  color: var(--pico-muted-color);
}

.quick-add input[type="text"] {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.todo-done-stack {
  border-top: 1px dashed var(--pico-muted-border-color);
  padding-top: 0.5rem;
}

.sortable-ghost {
  opacity: 0.4;
  border-left-color: var(--tgt-cyan);
}

/* ---------- Time tracking ---------- */
.week-nav {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.week-nav a {
  text-decoration: none;
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.day-empty {
  margin: 0 0 0.5rem;
  color: var(--pico-muted-color);
}

.rollup-client {
  font-size: 1rem;
  margin: 1rem 0 0.25rem;
  border-bottom: none;
}

/* ---------- Interactions timeline ---------- */
.timeline {
  margin-top: 1rem;
}

.timeline-item {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--tgt-blue);
}

.timeline-item p {
  margin: 0.25rem 0;
}

/* ---------- Dashboard ---------- */
.dash-export {
  margin: -0.75rem 0 1.25rem;
  font-size: 0.85rem;
}

/* ---------- Schedule ---------- */
.event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0 0 0.6rem;
  padding: 0.6rem 0.9rem;
  border-left: 3px solid var(--tgt-cyan);
}

.event-row a[role="button"] {
  white-space: nowrap;
  padding: 0.25rem 0.75rem;
  margin: 0;
}

.transcript-box {
  max-height: 18rem;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
}

/* ---------- Coming-soon stubs ---------- */
.soon-card {
  max-width: 34rem;
}

.soon-card ul {
  margin: 0.5rem 0 0;
}
