/* PMD colors: Princeton orange, black, white. Built on top of Pico.css. */
:root[data-theme=light] {
  --pmd-orange: #F58025;
  --pmd-orange-dark: #A84E00;   /* darker orange for text links (readable on white) */
  --pmd-black: #111111;
  --pico-primary: var(--pmd-orange-dark);
  --pico-primary-background: var(--pmd-orange);
  --pico-primary-border: var(--pmd-orange);
  --pico-primary-underline: rgba(168, 78, 0, 0.5);
  --pico-primary-hover: #7A3900;
  --pico-primary-hover-background: #DD6A12;
  --pico-primary-hover-border: #DD6A12;
  --pico-primary-hover-underline: #7A3900;
  --pico-primary-focus: rgba(245, 128, 37, 0.45);
  --pico-primary-inverse: #000000;
}

body { background: #ffffff; }

/* Header */
.site-header { background: var(--pmd-black); border-bottom: 4px solid var(--pmd-orange); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1rem; padding-block: 0.75rem; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.brand:hover { color: #fff; }
.brand-mark { color: var(--pmd-orange); letter-spacing: 0.05em; }
.main-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.main-nav a { color: #fff; text-decoration: none; padding: 0.35rem 0.65rem; border-radius: 6px; font-size: 0.95rem; }
.main-nav a:hover { color: #000; background: #DD6A12; }
.main-nav a.active { color: #000; background: var(--pmd-orange); font-weight: 600; }

main.container { padding-top: 1.25rem; padding-bottom: 3rem; }

/* Flash messages */
.flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 5px solid; }
.flash-success { background: #ECFDF3; border-color: #16A34A; }
.flash-error   { background: #FEF2F2; border-color: #DC2626; }
.flash-warning { background: #FFFBEB; border-color: #D97706; }

/* Utilities */
.muted { color: #6B7280; }
.small-text { font-size: 0.85rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.row-actions > * { margin-bottom: 0; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.page-head h2, .page-head h3 { margin-bottom: 0.25rem; }
form.inline { display: inline; margin: 0; }
button.small, [role=button].small { padding: 0.3rem 0.7rem; font-size: 0.85rem; width: auto; margin: 0; }
button.danger { background: #B91C1C; border-color: #B91C1C; color: #fff; }
button.outline.danger { background: transparent; color: #B91C1C; border-color: #B91C1C; }
.table-wrap { overflow-x: auto; }

/* Badges */
.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.55rem;
  border-radius: 999px; background: #E5E7EB; color: #111; white-space: nowrap; }
.badge-dd   { background: var(--pmd-orange); color: #000; }
.badge-ok   { background: #DCFCE7; color: #14532D; }
.badge-open { background: #FFEDD5; color: #7C2D12; }
.badge-warn { background: #FEF3C7; color: #78350F; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 1rem; }
.tabs a { padding: 0.3rem 0.7rem; border-radius: 999px; text-decoration: none; border: 1px solid #D1D5DB; color: #111; font-size: 0.9rem; }
.tabs a.active { background: var(--pmd-black); color: #fff; border-color: var(--pmd-black); }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.cal-head h2 { margin: 0; text-align: center; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-bottom: 0.5rem; }
.cal-dow { text-align: center; font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0; background: var(--pmd-black); color: #fff; }
.cal-day { min-height: 4.75rem; padding: 0.2rem; border: 1px solid #E5E7EB; background: #fff; min-width: 0; overflow: hidden; }
.cal-day.other { background: #F9FAFB; }
.cal-day.other .cal-num { color: #9CA3AF; }
.cal-day.today { border: 2px solid var(--pmd-orange); }
.cal-num { display: block; font-size: 0.8rem; font-weight: 600; color: #111; text-decoration: none; padding: 0.1rem 0.25rem; }
.cal-num:hover { background: #FFEDD5; border-radius: 4px; }
.cal-event { display: block; margin-top: 2px; font-size: 0.72rem; line-height: 1.3; padding: 0.1rem 0.3rem;
  border-radius: 4px; background: var(--pmd-orange); color: #000; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--pmd-orange); }
.cal-event.unfilled { background: #FFF7ED; border: 1px dashed var(--pmd-orange-dark); }
@media (max-width: 480px) {
  .cal-day { min-height: 3.5rem; }
  .cal-event { font-size: 0.62rem; padding: 0 0.15rem; }
}

/* Lists & cards */
.event-list, .assigned { list-style: none; padding: 0; }
.event-list li, .assigned li { list-style: none; padding: 0.6rem 0; border-bottom: 1px solid #E5E7EB; }
.assigned li { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.slot { padding: 1rem; margin-bottom: 1rem; border-top: 4px solid var(--pmd-orange); }
.slot-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.slot-head h3 { margin: 0; font-size: 1.1rem; }
.assign-form { margin-top: 0.75rem; margin-bottom: 0; }
.assign-form fieldset { margin-bottom: 0.25rem; }
.warn-box { border-top: 4px solid #D97706; }

/* Photos & avatars */
.with-avatar { display: flex; align-items: center; gap: 0.6rem; }
.with-avatar > div, .with-avatar > span { min-width: 0; }
.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; object-fit: cover; background: var(--pmd-black); color: var(--pmd-orange);
  font-weight: 700; }
.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-md { width: 2.75rem; height: 2.75rem; font-size: 0.95rem; }
.avatar-lg { width: 7rem; height: 7rem; font-size: 2.2rem; border: 3px solid var(--pmd-orange); }
.car-thumb { flex: none; border-radius: 6px; object-fit: cover; background: #F3F4F6;
  display: inline-flex; align-items: center; justify-content: center; }
.car-thumb-sm { width: 2.5rem; height: 1.9rem; font-size: 0.9rem; }
.car-thumb-md { width: 4.5rem; height: 3.4rem; font-size: 1.4rem; }
.car-thumb-lg { width: 12rem; max-width: 60vw; height: auto; aspect-ratio: 4 / 3; }
.car-thumb-empty { opacity: 0.6; }
.car-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.profile-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; }
.profile-photo { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.photo-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; margin: 0; }
.photo-buttons label[role=button] { margin: 0; cursor: pointer; }
.link-button { background: none; border: none; padding: 0; margin: 0; width: auto;
  color: #B91C1C; text-decoration: underline; cursor: pointer; }
.photo-field { border: 1px solid #E5E7EB; border-radius: 8px; padding: 0.75rem 1rem; }
.photo-field .with-avatar { margin-bottom: 0.75rem; flex-wrap: wrap; }

/* Settings tabs & activity log */
.settings-tabs { margin-bottom: 1.25rem; }
.log-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1rem; align-items: end; }
.log-check { align-self: center; }
.log-list { list-style: none; padding: 0; }
.log-list li { list-style: none; padding: 0.6rem 0; border-bottom: 1px solid #E5E7EB; }
.log-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; }
.log-msg { margin-top: 0.2rem; overflow-wrap: anywhere; }

/* Phase 3: logins */
.narrow { max-width: 30rem; margin-inline: auto; }
.license-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 0.25rem; }
.license-form label { margin: 0; }
.account-row { flex-wrap: wrap; }
.account-row .row-actions { margin-bottom: 0; }

/* Phase 2: suggestions */
.suggest { margin-top: 0.75rem; padding: 0.5rem 0.75rem; background: #FFF7ED; border-radius: 8px; }
.suggest-item { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  margin: 0; padding: 0.45rem 0; border-bottom: 1px solid #FED7AA; }
.suggest-item:last-child { border-bottom: none; }

/* Phase 2: history table */
.history-table td.num, .history-table th.num { text-align: center; }
.history-table td.zero { color: #C4C4C4; }
.history-table th:first-child, .history-table td:first-child {
  position: sticky; left: 0; background: #fff; z-index: 1; }
.history-table tbody tr:nth-child(odd) td:first-child { background: #FAFAFA; }

.counts-box, .avail-box { border: 1px solid #E5E7EB; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.counts-box summary, .avail-box summary { font-weight: 600; }
.counts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0 1rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.25rem 1rem; margin-bottom: 0.75rem; }
