/* The page frame for shared/layout.js: a menu panel floating on the left
   (light in light mode, near-black in dark mode), a quiet top bar with the
   breadcrumb and profile, and the page content on a warm neutral workspace.
   The complex's colour (--brand) marks what matters: the logo tile, the
   page you're on, counts and the main buttons. */

:root { --sidebar-w: 248px; --sidebar-gap: 12px; --navbar-h: 64px; }

body.app-layout {
  min-height: 100vh;
  --side-bg: #fffdf9;
  --side-line: #efe9e0;
  --side-text: #6f6a63;
  --side-head: #2a2825;
  --side-hover: rgba(28, 27, 25, .05);
  --side-active: rgba(28, 27, 25, .07);
}
:where([data-theme="dark"]) body.app-layout {
  --side-bg: #1c1d20;
  --side-line: #2a2b2f;
  --side-text: #a2a2a8;
  --side-head: #f4f4f5;
  --side-hover: rgba(255, 255, 255, .05);
  --side-active: rgba(255, 255, 255, .08);
}

/* ---------- sidebar ---------- */
.app-sidebar {
  position: fixed; top: var(--sidebar-gap); bottom: var(--sidebar-gap); left: var(--sidebar-gap); width: var(--sidebar-w); z-index: 40;
  background: var(--side-bg); color: var(--side-text);
  border: 1px solid var(--side-line); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .12);
  display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
  transition: transform .25s ease;
  scrollbar-width: thin; scrollbar-color: var(--side-line) transparent;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px;
  color: var(--side-head); text-decoration: none;
}
a.sidebar-brand:hover { text-decoration: none; color: var(--side-head); }
.brand-logo img, .brand-mark {
  width: 40px; height: 40px; border-radius: 12px; object-fit: cover; display: block; flex: none; background: #fff;
}
.brand-logo img { border: 1px solid var(--side-line); }
/* A transparent logo with light and dark versions (Our Complex's own), shown without a tile. */
.brand-logo .brand-wordmark img { width: 52px; height: auto; border: 0; border-radius: 0; background: none; object-fit: contain; }
.brand-mark { display: flex; align-items: center; justify-content: center; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 18px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 650; line-height: 1.25; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.brand-sub { font-size: 12px; color: var(--side-text); }

.sidebar-nav { padding: 4px 10px 14px; display: flex; flex-direction: column; gap: 2px; }
/* Each section after the first starts below a thin rule, as in the menu's design. */
.nav-header {
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--side-head);
  padding: 18px 10px 8px; margin-top: 10px; border-top: 1px solid var(--side-line);
}
.sidebar-nav > .nav-header:first-child { margin-top: 0; border-top: 0; padding-top: 6px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
  color: var(--side-text); text-decoration: none; font-size: 14.5px; font-weight: 450;
  transition: background .12s, color .12s;
}
.nav-link svg { width: 18px; height: 18px; }
.nav-link:hover { background: var(--side-hover); color: var(--side-head); text-decoration: none; }
/* Beats the dark-mode link colour in base.css. */
.app-sidebar .nav-link { color: var(--side-text); }
.app-sidebar .nav-link:hover, .app-sidebar .nav-link.active, .app-sidebar a.sidebar-brand { color: var(--side-head); }
.app-navbar .breadcrumb a.crumb { color: var(--muted); }
.app-navbar .breadcrumb a.crumb:hover { color: var(--text); }
.nav-link.active { background: var(--side-active); color: var(--side-head); font-weight: 600; }
.nav-link.active svg { color: var(--brand); }
:where([data-theme="dark"]) .nav-link.active svg { color: color-mix(in srgb, var(--brand) 70%, #ffffff); }
.nav-link:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 55%, transparent); }

/* The light/dark switch at the foot of the menu: two halves, the chosen one raised. */
.sidebar-foot { margin-top: auto; padding: 12px 14px 14px; border-top: 1px solid var(--side-line); }
.theme-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; border-radius: 12px; background: var(--side-hover); border: 1px solid var(--side-line); }
.theme-option {
  min-height: 34px; padding: 4px 8px; gap: 6px; border: 0; border-radius: 9px; background: none;
  color: var(--side-text); font-size: 13px; font-weight: 600;
}
.theme-option:hover { background: none; color: var(--side-head); }
.theme-option.on, .theme-option.on:hover { background: var(--side-bg); color: var(--side-head); box-shadow: 0 1px 2px rgba(16, 24, 40, .12), 0 0 0 1px var(--side-line); }
.theme-option.on svg { color: var(--brand); }

/* ---------- main column ---------- */
.app-main { margin-left: calc(var(--sidebar-w) + var(--sidebar-gap) * 2); min-height: 100vh; display: flex; flex-direction: column; }
.app-navbar {
  position: sticky; top: 0; z-index: 30; height: var(--navbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 28px 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); color: var(--text);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.nav-toggle { display: none; border: 1px solid var(--card-line); background: var(--card); color: var(--text); padding: 7px; min-height: 0; border-radius: 10px; }
.navbar-title { font-size: 14.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
.breadcrumb svg { flex: none; color: var(--muted); }
.breadcrumb .crumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.breadcrumb a.crumb:hover { color: var(--text); text-decoration: none; }
.breadcrumb .crumb.current { color: var(--text); font-weight: 600; }
.breadcrumb svg:first-child { color: var(--brand); }
/* Phones: only the current page. */
@media (max-width: 600px) { .breadcrumb > :not(.current) { display: none; } }
.navbar-right { margin-left: auto; position: relative; display: flex; align-items: center; gap: 10px; }

.user-toggle {
  border: 1px solid var(--card-line); background: var(--card); padding: 4px 10px 4px 4px; min-height: 0; gap: 8px;
  color: var(--text); border-radius: 999px; font-size: 14px; font-weight: 500;
}
.user-toggle:hover { filter: none; border-color: var(--input-line); }
.user-toggle svg { color: var(--muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 13px; flex: none; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 264px; z-index: 50; padding: 6px;
  background: var(--card); color: var(--text); border: 1px solid var(--card-line); border-radius: 16px;
  box-shadow: 0 16px 40px -12px rgba(16, 24, 40, .25), 0 2px 6px rgba(16, 24, 40, .06);
}
.user-head { padding: 10px 12px 12px; }
.user-name { font-size: 15px; font-weight: 650; }
.user-email { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.role-badge {
  display: inline-block; margin-top: 8px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  color: color-mix(in srgb, var(--brand) 80%, var(--text)); background: color-mix(in srgb, var(--brand) 12%, transparent);
}
.user-links { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; border-top: 1px solid var(--line); }
.user-links a, .user-signout {
  display: flex; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 10px; font-size: 14.5px;
  color: var(--text); text-decoration: none;
}
.user-links a, .user-links a:hover { color: var(--text); }
.user-links a svg { color: var(--muted); }
.user-links a:hover, .user-links a:focus-visible { background: color-mix(in srgb, var(--text) 6%, transparent); text-decoration: none; }
.user-links a:focus-visible, .user-signout:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 55%, transparent); }
.user-sep { height: 1px; background: var(--line); margin: 6px 0; }
.user-menu .app-version { padding: 6px 12px 4px; font-size: 12px; color: var(--muted); }
button.user-signout { width: 100%; justify-content: flex-start; border: 0; background: none; min-height: 0; color: var(--danger); }
button.user-signout:hover { background: color-mix(in srgb, var(--danger) 9%, transparent); filter: none; }

/* Which side you're on, e.g. "Director console". */
.console-badge {
  font-size: 12px; font-weight: 650; white-space: nowrap; padding: 4px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 12%, transparent); color: color-mix(in srgb, var(--brand) 78%, var(--text));
}
@media (max-width: 480px) { .console-badge { display: none; } }
.navbar-wordmark { margin-right: 4px; }
.navbar-wordmark img { height: 20px; }
@media (max-width: 480px) { .navbar-wordmark img { height: 16px; } }

.app-banner { padding: 0 28px; }
.app-banner:empty { display: none; }
.app-content { padding: 8px 28px 40px; flex: 1; width: 100%; max-width: 1360px; }

/* ---------- phones and small tablets: the menu slides in ---------- */
.sidebar-overlay { display: none; }
@media (max-width: 991px) {
  .app-sidebar { transform: translateX(calc(-100% - var(--sidebar-gap) * 2)); }
  .app-main { margin-left: 0; }
  .nav-toggle { display: inline-flex; }
  .app-navbar { padding: 0 14px; }
  body.sidebar-open .app-sidebar { transform: none; }
  body.sidebar-open .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 15, 18, .35); backdrop-filter: blur(2px); }
  .app-content { padding: 6px 14px 32px; }
  .app-banner { padding: 0 14px; }
}
@media (max-width: 520px) {
  .user-toggle-name { display: none; }
  .user-toggle { padding: 3px 8px 3px 3px; }
  .user-menu { width: min(280px, calc(100vw - 24px)); }
}

/* ---------- page grids used by several consoles ---------- */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.dash-grid > .card, .dash-grid > div > .card:last-child { margin-bottom: 16px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: 1fr; } }
.day-panel h2 { font-size: 17px; }
/* a whole list row that's a button */
button.link-row { display: block; text-align: left; border: 0; background: none; padding: 0; min-height: 0; color: inherit; width: 100%; }
button.link-row:hover .title { color: var(--brand); text-decoration: underline; }
.user-links a, .user-links a:hover { color: var(--text); }
/* The side panel next to the calendar is narrow: one field per row. */
.day-panel .grid-2 { grid-template-columns: minmax(0, 1fr); }
/* Date + time pair (event form, admin maintenance) */
.field.date-time { margin-bottom: 14px; }
.field-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.date-time-inputs { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 8px; }
.date-time-inputs input[hidden] { display: none; }
.date-time-inputs:has(input[type=time][hidden]) { grid-template-columns: minmax(0, 1fr); }
.date-time .hint { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.date-time .error { display: block; color: var(--danger); font-size: 13px; margin-top: 4px; }

