/* Gesswen — Organiser dashboard (Overview / Schedule / Polls / Bookings)
   Shared sidebar shell + card/list/bar-chart layouts for the 4 views added in
   js/dashboard.js. Colors/fonts come from css/tokens.css (the --color- and
   --font- custom properties); layout-only rules live here, consistent with
   how css/app.css bridges --g-*. */

/* ─── Shell ──────────────────────────────────────────────────────────────── */

.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
  background: var(--color-surface);
}

.app-sidebar {
  width: var(--sidebar-width, 260px);
  flex-shrink: 0;
  min-height: 100vh;
  background: var(--sidebar-bg, var(--color-surface-raised));
  border-right: 1.5px solid var(--color-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3rem 4rem;
  max-width: 1180px;
}

/* The create wizard's existing .page block brings its own max-width/centering/
   padding (css/app.css) — drop the duplicate padding when it's nested in
   .app-main so the wizard doesn't get double-inset. */
.app-main > .page { max-width: none; margin: 0; padding: 0; }

/* Mobile menu bar + backdrop — hidden above the 860px breakpoint, where the
   sidebar is always visible inline (desktop layout is untouched below). */
.app-mobile-bar,
.app-sidebar-backdrop {
  display: none;
}

@media (max-width: 860px) {
  .app-mobile-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: .85rem 1.1rem;
    background: var(--color-surface-raised);
    border-bottom: 1.5px solid var(--color-border);
  }

  .app-menu-btn {
    background: none;
    border: 1.5px solid var(--color-border);
    border-radius: var(--g-radius);
    color: var(--color-text);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
  }
  .app-menu-btn:hover { background: var(--color-surface-overlay); }

  .app-mobile-logo {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--color-text);
  }
  .app-mobile-logo .sidebar-logo-dot { color: var(--color-primary); }

  /* align-items:flex-start (base rule) is for the desktop row layout's
     vertical alignment — in column direction it instead controls the
     cross-axis (width), leaving .app-main shrink-wrapped to its content's
     natural width instead of stretched to fill the viewport. Reset it here
     so wide content (e.g. the Time-step calendar grid) is properly
     constrained to the viewport and scrolls internally instead of pushing
     the whole page wider. */
  .app-shell { flex-direction: column; align-items: stretch; min-height: 0; }

  /* Off-canvas drawer: fixed + translated out of view, slid in via .open. */
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(80vw, 300px);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--g-shadow-lg);
  }
  .app-sidebar.open { transform: translateX(0); }

  .app-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .app-sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

  .app-main { padding: 1.5rem 1.25rem 3rem; }
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar-top { padding: 1.5rem 1.25rem 0; display: flex; flex-direction: column; gap: 1.25rem; }

.sidebar-brand { padding-bottom: 1.25rem; border-bottom: 1.5px solid var(--color-border); }

.sidebar-logo {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--color-text);
}
.sidebar-logo-dot { color: var(--color-primary); }

.sidebar-tagline { font-family: var(--font-code); font-size: .72rem; margin-top: .15rem; }

.sidebar-new-btn { width: 100%; text-align: center; justify-content: center; display: flex; }

.sidebar-nav { display: flex; flex-direction: column; gap: .15rem; }

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .7rem;
  border-radius: var(--g-radius);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.sidebar-nav-item svg { flex-shrink: 0; }
.sidebar-nav-item:hover { background: var(--color-surface-overlay); color: var(--color-text); }
.sidebar-nav-item.active { background: var(--color-neutral-subtle, var(--color-surface-overlay)); color: var(--color-text); }
.sidebar-nav-item:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 2px; }

.sidebar-badge {
  margin-left: auto;
  background: var(--color-secondary);
  color: var(--g-on-accent);
  font-size: .68rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 .3rem;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 1.25rem;
  border-top: 1.5px solid var(--color-border);
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--g-on-accent);
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-profile-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-profile-name { font-weight: 700; font-size: .85rem; color: var(--color-text); }
.sidebar-profile-email { font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Create-wizard contextual sidebar ───────────────────────────────────────
   Unlike the other 4 shell views' sidebars (dynamic nav, rebuilt per route by
   _renderSidebar()), this one is static HTML: just a home link back to the
   dashboard, then the scheduling-settings panel that used to live in the
   Time step's main content — now persistent across all 5 wizard steps. Content
   can run taller than the viewport, so the whole aside scrolls internally
   (sticky positioning is inherited from .app-sidebar) rather than pushing the
   page down. */
.app-sidebar.sidebar-create {
  justify-content: flex-start;
  max-height: 100vh;
  overflow-y: auto;
}

.sidebar-home-link {
  display: block;
  padding: 1.5rem 1.25rem 1.25rem;
  text-decoration: none;
  cursor: pointer;
}
.sidebar-home-link:hover .sidebar-logo { color: var(--color-primary); }
.sidebar-home-link:focus-visible { outline: 3px solid var(--color-primary); outline-offset: -2px; }

.sidebar-create-settings { padding-bottom: 1.5rem; }

/* Side-by-side date/time field pairs don't fit the narrow sidebar — stack
   them, same treatment .form-row already gets at the ≤640px breakpoint in
   the main content, just applied unconditionally here since the sidebar is
   always narrow regardless of viewport width. */
.sidebar-create-settings .form-row { flex-direction: column; gap: 0; }

.sidebar-create-settings .duration-grid { gap: .4rem; }
.sidebar-create-settings .duration-btn,
.sidebar-create-settings .buffer-dur-btn,
.sidebar-create-settings .recurring-day-btn {
  padding: .4rem .55rem;
  font-size: .78rem;
}

/* "Work schedule" / "Freetime" side-by-side clips at sidebar width — stack
   instead of shrinking text to fit (shrinking risked the same clipping at
   slightly larger font sizes, still fragile). */
.sidebar-create-settings .schedule-mode-toggle { flex-direction: column; }

.sidebar-create-settings .add-slots-body { padding: 1rem 1.25rem; }

/* ─── Overview: greeting + stats ─────────────────────────────────────────── */

#dash-date { font-family: var(--font-code); font-size: .85rem; margin-top: .1rem; }

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.75rem 0 2.25rem;
}
@media (max-width: 640px) {
  .dash-stats { grid-template-columns: 1fr; }

  .attention-top,
  .attention-bottom { flex-wrap: wrap; gap: .6rem; }

  .upcoming-row { flex-wrap: wrap; }
  .upcoming-time { width: auto; text-align: left; }
  .upcoming-divider { display: none; }
}

.dash-stat { padding: 1.5rem; }
.dash-stat-value {
  font-family: var(--stat-value-font, var(--font-heading));
  font-size: var(--stat-value-size, 2.2rem);
  color: var(--stat-value-color, var(--color-text));
  line-height: 1;
  margin-bottom: .5rem;
}
.dash-stat-label { font-weight: 700; font-size: .92rem; }
.dash-stat-desc { font-size: .82rem; margin-top: .15rem; }

.dash-section { margin-bottom: 2rem; }

.dash-eyebrow {
  font-family: var(--font-code);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: .85rem;
}

.dash-view-link { font-size: .85rem; font-weight: 600; color: var(--color-primary); text-decoration: none; margin-bottom: .85rem; display: inline-block; }
.dash-view-link:hover { text-decoration: underline; }

.dash-empty { padding: 1.25rem; font-size: .88rem; }

.dash-tabs { display: flex; gap: .5rem; }
.dash-tab {
  background: var(--color-surface-raised);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
  padding: .4rem .9rem;
  border-radius: var(--g-radius);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}
.dash-tab.active { background: var(--color-text); color: var(--color-surface-raised); border-color: var(--color-text); }

/* ─── Pills (event category / mode badges) ───────────────────────────────── */

.pill {
  display: inline-block;
  padding: .18rem .6rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
}
.badge-booking { background: var(--badge-booking-bg); color: var(--badge-booking-text); }
.badge-poll    { background: var(--badge-poll-bg);    color: var(--badge-poll-text); }

/* ─── Avatar stacks ───────────────────────────────────────────────────────── */

.avatar-stack { display: flex; }
.avatar-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--g-on-accent);
  font-size: .62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-surface-raised);
  margin-left: -8px;
}
.avatar-chip:first-child { margin-left: 0; }
.avatar-chip-more { background: var(--color-surface-overlay); color: var(--color-text-muted); }

/* ─── Needs your attention / poll cards ───────────────────────────────────── */

.attention-card, .poll-card { padding: 1.35rem 1.5rem; margin-bottom: 1rem; }

.attention-top { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.attention-progress-text { font-size: .82rem; }

.attention-title { font-weight: 700; font-size: 1.02rem; margin-bottom: .75rem; }

.attention-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--color-surface-overlay);
  overflow: hidden;
  margin-bottom: .9rem;
}
.attention-progress-fill { height: 100%; background: var(--color-secondary); border-radius: 999px; }

.attention-bottom { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ─── Coming up / Bookings rows ───────────────────────────────────────────── */

.upcoming-row {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  cursor: pointer;
  transition: box-shadow .12s;
}
.upcoming-row:hover { box-shadow: var(--g-shadow-lg); }
.upcoming-row:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 2px; }

.upcoming-time { font-family: var(--font-code); text-align: right; flex-shrink: 0; width: 74px; }
.upcoming-date { font-size: .78rem; color: var(--color-text-muted); }
.upcoming-clock { font-weight: 700; font-size: .92rem; }

.upcoming-divider { width: 1px; align-self: stretch; background: var(--color-border); flex-shrink: 0; }

.upcoming-info { flex: 1; min-width: 0; }
.upcoming-pill { margin-bottom: .35rem; }
.upcoming-title { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-meta { font-size: .78rem; margin-top: .15rem; }

/* ─── Polls bar chart ─────────────────────────────────────────────────────── */

.poll-progress-row { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.poll-progress-text { font-size: .8rem; white-space: nowrap; }

.poll-bars {
  display: flex;
  align-items: flex-end;
  gap: .6rem;
  height: 92px;
  overflow-x: auto;
  padding-bottom: .25rem;
}

/* min-width keeps bars legible with many proposed times — the row scrolls
   horizontally instead of squeezing every column down to unreadable slivers. */
.poll-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 44px; }

.poll-bar-track {
  flex: 1;
  width: 100%;
  max-width: 64px;
  display: flex;
  align-items: flex-end;
}
.poll-bar-fill { width: 100%; background: var(--color-primary); border-radius: 5px 5px 0 0; min-height: 4px; }
.poll-bar-fill.poll-bar-empty { background: var(--color-surface-overlay); }

.poll-bar-date { font-family: var(--font-code); font-size: .66rem; text-align: center; margin-top: .4rem; line-height: 1.3; }
.poll-bar-votes { font-family: var(--font-code); font-size: .72rem; font-weight: 700; color: var(--color-primary); margin-top: .15rem; }

/* ─── Schedule month chips ────────────────────────────────────────────────── */
/* Base cal-month-* layout is defined in css/app.css (Week/Month CalendarGrid
   work) — this file only adds the per-day event chip, a concept that view
   didn't need since it renders exactly one slot per cell. */

.schedule-chip {
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.schedule-chip:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.schedule-chip-more { font-size: .64rem; margin-top: 2px; }
