/* PMC Site Manager - the whole stylesheet.
   Mobile first: the default rules are the phone. Desktop is added at 900px.
   No framework, no build step. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--c-ink);
  background: var(--c-bg);
  /* Stops a wide table from making the whole page scroll sideways. Every
     wide thing gets its own scroller instead. */
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0 0 var(--s-2); line-height: 1.25; font-weight: 650; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p  { margin: 0 0 var(--s-3); }
a  { color: var(--c-brand-light); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Every icon is an inline SVG with a viewBox and no width/height attribute.
   Without a default size the browser falls back to 300x150 scaled to the
   viewBox, and an icon in a heading renders 61px tall. Rules further down
   override this for buttons, the sidebar and the mobile bar. */
svg.ico { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -0.18em; }
h1 svg.ico, h2 svg.ico { width: 20px; height: 20px; }
h3 svg.ico { width: 17px; height: 17px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s-3); top: -3rem; z-index: 100;
  background: var(--c-surface); color: var(--c-ink);
  padding: var(--s-2) var(--s-3); border-radius: var(--r);
  box-shadow: var(--shadow-2); transition: top .15s;
}
.skip-link:focus { top: var(--s-3); }

/* ==========================================================================
   Shell
   ========================================================================== */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-4);
  background: var(--c-brand); color: var(--c-on-brand);
  box-shadow: var(--shadow-2);
}
.topbar__brand {
  display: flex; align-items: center; gap: var(--s-2);
  font-weight: 700; font-size: var(--fs-md); color: var(--c-on-brand);
  letter-spacing: .01em; white-space: nowrap;
}
.topbar__brand:hover { text-decoration: none; }
.topbar__brand-mark {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  background: var(--c-accent); color: #fff;
  display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 800;
}
.topbar__spacer { flex: 1; }
.topbar__meta {
  font-size: var(--fs-xs); color: rgba(255, 255, 255, .78);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 42vw;
}
.topbar__action {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; border-radius: var(--r);
  color: var(--c-on-brand); background: rgba(255, 255, 255, .12);
  border: 0; cursor: pointer; padding: 0 var(--s-2);
}
.topbar__action:hover { background: rgba(255, 255, 255, .22); text-decoration: none; }

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

.sidebar { display: none; }

.main {
  flex: 1; min-width: 0;
  padding: var(--s-4) var(--s-4) calc(var(--mobile-nav-h) + var(--s-6));
  max-width: 100%;
}
.main__inner { max-width: var(--page-max); margin: 0 auto; }

/* Mobile bottom navigation -------------------------------------------------- */
.mobnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; background: var(--c-surface);
  border-top: 1px solid var(--c-line);
  box-shadow: 0 -2px 10px rgba(17, 24, 39, .06);
}
.mobnav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px;
  font-size: 0.6875rem; color: var(--c-ink-3); min-width: 0;
  padding-top: var(--s-1);
}
.mobnav__item:hover { text-decoration: none; }
.mobnav__item svg { width: 21px; height: 21px; }
.mobnav__item.is-current { color: var(--c-brand); font-weight: 650; }
.mobnav__item.is-primary { color: var(--c-accent-dark); }
.mobnav__item.is-primary svg {
  width: 34px; height: 34px; margin-top: -14px;
  background: var(--c-accent); color: #fff; border-radius: 50%;
  padding: 7px; box-shadow: var(--shadow-2);
}

/* ==========================================================================
   Flash messages
   ========================================================================== */
.flashes { display: grid; gap: var(--s-2); margin-bottom: var(--s-4); }
.flash {
  display: flex; gap: var(--s-2); align-items: flex-start;
  padding: var(--s-3); border-radius: var(--r);
  font-size: var(--fs-sm); border: 1px solid transparent;
}
.flash svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.flash--success { background: var(--c-success-bg); color: var(--c-success);
                  border-color: #bbf7d0; }
.flash--warning { background: var(--c-warning-bg); color: var(--c-warning);
                  border-color: #fde68a; }
.flash--info    { background: var(--c-info-bg);    color: var(--c-info);
                  border-color: #bfdbfe; }

/* ==========================================================================
   Cards, panels, section headers
   ========================================================================== */
.card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  margin-bottom: var(--s-4);
  /* A card never decides the page width; the page decides the card's. */
  min-width: 0; max-width: 100%;
}
.card__head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-line-2);
  /* A head holding a long project name plus two chips must wrap, not push the
     card wider than the screen. A flex item's default min-width is auto, so
     without these two rules the row cannot shrink and 320px scrolls sideways.
     See BUGS-AND-FIXES #4. */
  flex-wrap: wrap;
  min-width: 0;
}
.card__head > * { min-width: 0; }
.card__head h2, .card__head h3 {
  margin: 0; min-width: 0; overflow-wrap: anywhere;
}
.card__head .spacer { flex: 1; }
.card__body { padding: var(--s-4); }
.card__body--tight { padding: var(--s-3); }
.card__body--flush { padding: 0; }
.card__foot {
  padding: var(--s-3) var(--s-4); border-top: 1px solid var(--c-line-2);
  background: var(--c-surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-size: var(--fs-sm);
}

.page-head {
  display: flex; align-items: flex-start; gap: var(--s-3);
  flex-wrap: wrap; margin-bottom: var(--s-4);
}
.page-head__text { min-width: 0; flex: 1; }
.page-head h1 { margin-bottom: 2px; }
.page-head__sub { color: var(--c-ink-3); font-size: var(--fs-sm); margin: 0; }

.muted { color: var(--c-ink-3); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.stack { display: grid; gap: var(--s-3); }
.stack-2 { display: grid; gap: var(--s-2); }
.row { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.row--tight { gap: var(--s-1); }
.grow { flex: 1; min-width: 0; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { margin-bottom: var(--s-4); min-width: 0; }
.field__label {
  display: block; font-size: var(--fs-sm); font-weight: 650;
  color: var(--c-ink-2); margin-bottom: var(--s-1);
}
.field__hint { font-size: var(--fs-xs); color: var(--c-ink-3); margin-top: var(--s-1); }
.field__req { color: var(--c-danger); }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], input[type="number"],
input[type="search"], select, textarea {
  width: 100%; min-height: var(--tap);
  padding: var(--s-2) var(--s-3);
  font: inherit; font-size: var(--fs-base); color: var(--c-ink);
  background: var(--c-surface);
  border: 1px solid var(--c-line); border-radius: var(--r);
  appearance: none;
}
input[type="color"] {
  width: 46px; height: 38px; padding: 2px; border: 1px solid var(--c-line);
  border-radius: var(--r); background: var(--c-surface);
}
textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
textarea.tall { min-height: 200px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-3) center;
  padding-right: var(--s-6);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--c-focus); outline: 2px solid rgba(37, 99, 235, .25);
  outline-offset: 0;
}
input::placeholder, textarea::placeholder { color: var(--c-ink-4); }

.check { display: flex; gap: var(--s-2); align-items: flex-start;
         font-size: var(--fs-base); cursor: pointer; }
.check input[type="checkbox"] {
  width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--c-brand);
  flex: 0 0 20px;
}

/* A dropdown with "+ Add Custom" underneath it. */
.picker { display: grid; gap: var(--s-2); }
.picker__custom { display: none; }
.picker__custom.is-open { display: block; }
.picker__toggle {
  align-self: start; background: none; border: 0;
  color: var(--c-brand-light); font: inherit; font-size: var(--fs-sm);
  font-weight: 650; cursor: pointer; text-align: left;
  /* "+ Add Custom Type" is a real control, not a footnote: it needs a target a
     thumb can hit on a site. Padding is negatively offset so it still lines up
     with the field above it. */
  padding: var(--s-2) var(--s-2) var(--s-2) 0;
  min-height: 38px;
  display: inline-flex; align-items: center;
}
.picker__toggle:hover { text-decoration: underline; }

.form-grid { display: grid; gap: 0 var(--s-4); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  min-height: var(--tap); padding: var(--s-2) var(--s-4);
  font: inherit; font-size: var(--fs-base); font-weight: 650;
  color: var(--c-ink); background: var(--c-surface);
  border: 1px solid var(--c-line); border-radius: var(--r);
  cursor: pointer; text-align: center; white-space: nowrap;
}
.btn:hover { background: var(--c-surface-3); text-decoration: none; }
.btn svg { width: 17px; height: 17px; }

.btn--primary {
  background: var(--c-brand); border-color: var(--c-brand);
  color: var(--c-on-brand);
}
.btn--primary:hover { background: var(--c-brand-dark); }

.btn--accent {
  background: var(--c-accent); border-color: var(--c-accent);
  color: #fff;
}
.btn--accent:hover { background: var(--c-accent-dark); }

.btn--danger { color: var(--c-danger); border-color: #fca5a5; background: #fff; }
.btn--danger:hover { background: var(--c-danger-bg); }

.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--c-surface-3); }

.btn--sm { min-height: 34px; padding: var(--s-1) var(--s-3);
           font-size: var(--fs-sm); }
.btn--block { width: 100%; }
.btn--big { min-height: 52px; font-size: var(--fs-md); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.btn-row { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.btn-row--end { justify-content: flex-end; }

/* ==========================================================================
   Chips, badges, markers
   ========================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: 2px var(--s-2); border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 650; line-height: 1.45;
  background: var(--c-surface-3); color: var(--c-ink-2);
  white-space: nowrap; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis;
}
.chip--type { color: #fff; }
.chip--outline { background: transparent; border: 1px solid var(--c-line); }
.chip--pending { background: var(--c-warning-bg); color: var(--c-warning); }
.chip--done    { background: var(--c-success-bg); color: var(--c-success); }
.chip--cancel  { background: var(--c-surface-3);  color: var(--c-ink-3); }
.chip--overdue { background: var(--c-danger-bg);  color: var(--c-danger); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block;
       flex: 0 0 9px; }

.stat-row {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2); margin-bottom: var(--s-4);
}
.stat {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r); padding: var(--s-3);
}
.stat__n { font-size: var(--fs-xl); font-weight: 700; line-height: 1.1; }
.stat__label { font-size: var(--fs-xs); color: var(--c-ink-3);
               text-transform: uppercase; letter-spacing: .04em; }
.stat--warn .stat__n { color: var(--c-warning); }
.stat--danger .stat__n { color: var(--c-danger); }

/* ==========================================================================
   The dashboard's Project / Date header - slide 1 of the owner's concept
   ========================================================================== */
.selector {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  padding: var(--s-4); margin-bottom: var(--s-4);
}
.selector__grid { display: grid; gap: var(--s-3); }
.selector .field { margin-bottom: 0; }
.selector__date {
  display: flex; gap: var(--s-2); align-items: stretch;
}
.selector__date input { flex: 1; min-width: 0; }

.searchbar { display: grid; gap: var(--s-3); }
.searchbar__cols { display: grid; gap: var(--s-3); }

/* ==========================================================================
   Record list - cards on a phone, a table on a desktop
   ========================================================================== */
.reclist { display: grid; gap: var(--s-2); }

.rec {
  display: block; background: var(--c-surface);
  border: 1px solid var(--c-line); border-left: 4px solid var(--c-ink-4);
  border-radius: var(--r); padding: var(--s-3); color: inherit;
}
.rec:hover { text-decoration: none; box-shadow: var(--shadow-2);
             border-color: var(--c-line); }
.rec__top { display: flex; gap: var(--s-2); align-items: center;
            flex-wrap: wrap; margin-bottom: var(--s-1); }
.rec__time { font-size: var(--fs-sm); font-weight: 650; color: var(--c-ink-2); }
.rec__title { font-weight: 650; margin: var(--s-1) 0 2px; }
.rec__desc { font-size: var(--fs-sm); color: var(--c-ink-2); margin: 0; }
.rec__meta { display: flex; gap: var(--s-3); flex-wrap: wrap;
             margin-top: var(--s-2); font-size: var(--fs-xs);
             color: var(--c-ink-3); }
.rec__meta span { display: inline-flex; align-items: center; gap: 4px; }
.rec__meta svg { width: 13px; height: 13px; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%; border-collapse: collapse; font-size: var(--fs-sm);
  /* In a narrow column the browser would rather wrap every cell to one word
     per line than scroll. Give the table a floor and let .table-scroll do its
     job instead. */
  min-width: 660px;
}
/* Tables that are genuinely narrow (two or three columns) do not need it. */
table.data.narrow { min-width: 0; }
table.data th, table.data td {
  padding: var(--s-2) var(--s-3); text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--c-line-2);
}
table.data th {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em;
  color: var(--c-ink-3); font-weight: 700; background: var(--c-surface-2);
  white-space: nowrap; position: sticky; top: 0;
}
table.data tbody tr:hover { background: var(--c-surface-2); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
  text-align: center; padding: var(--s-6) var(--s-4); color: var(--c-ink-3);
}
.empty svg { width: 40px; height: 40px; color: var(--c-ink-4);
             margin-bottom: var(--s-2); }
.empty h3 { color: var(--c-ink-2); }

/* ==========================================================================
   Calendar
   ========================================================================== */
.cal { }
.cal__bar {
  display: flex; align-items: center; gap: var(--s-2);
  margin-bottom: var(--s-3); flex-wrap: wrap;
}
.cal__heading { font-size: var(--fs-lg); font-weight: 700; flex: 1;
                min-width: 9rem; }
.cal__views { display: flex; border: 1px solid var(--c-line);
              border-radius: var(--r); overflow: hidden; }
.cal__views a {
  padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); font-weight: 650;
  color: var(--c-ink-2); background: var(--c-surface); min-height: 38px;
  display: inline-flex; align-items: center;
}
.cal__views a:hover { background: var(--c-surface-3); text-decoration: none; }
.cal__views a.is-current { background: var(--c-brand); color: #fff; }
.cal__views a + a { border-left: 1px solid var(--c-line); }

.cal__weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px; margin-bottom: 2px;
}
.cal__weekday {
  text-align: center; font-size: var(--fs-xs); font-weight: 700;
  color: var(--c-ink-3); padding: var(--s-1) 0; text-transform: uppercase;
}
.cal__grid { display: grid; gap: 2px; }
.cal__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
             gap: 2px; }
.cal__week--one { grid-template-columns: minmax(0, 1fr); }

.cal__day {
  position: relative; display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  min-height: 54px; padding: var(--s-1) 2px var(--s-2);
  background: var(--c-surface); border: 1px solid var(--c-line-2);
  border-radius: var(--r-sm); color: var(--c-ink);
  font-size: var(--fs-sm);
}
.cal__day:hover { text-decoration: none; border-color: var(--c-brand-light);
                  background: var(--c-surface-2); }
.cal__day--out { background: var(--c-surface-3); color: var(--c-ink-4); }
.cal__day--today { border-color: var(--c-accent); border-width: 2px; }
.cal__day--selected {
  background: var(--c-brand); color: #fff; border-color: var(--c-brand);
}
.cal__day--selected:hover { background: var(--c-brand-dark); }
.cal__day--weekend:not(.cal__day--selected) { background: var(--c-surface-2); }
.cal__num { font-weight: 650; font-size: var(--fs-sm); line-height: 1.3; }
.cal__marks {
  display: flex; flex-wrap: wrap; gap: 2px; justify-content: center;
  align-content: flex-start; min-height: 9px; max-width: 100%;
}
.cal__mark {
  width: 7px; height: 7px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .5);
}
.cal__more { font-size: 0.625rem; color: inherit; opacity: .8; }

.cal__legend { display: flex; gap: var(--s-3); flex-wrap: wrap;
               font-size: var(--fs-xs); color: var(--c-ink-2); }
.cal__legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ==========================================================================
   Photos
   ========================================================================== */
.gallery {
  display: grid; gap: var(--s-2);
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}
.gallery__item {
  position: relative; aspect-ratio: 1; border-radius: var(--r);
  overflow: hidden; background: var(--c-surface-3);
  border: 1px solid var(--c-line);
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px var(--s-1); font-size: 0.625rem; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gallery__del {
  position: absolute; top: 3px; right: 3px;
  width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(17, 24, 39, .66); color: #fff; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.gallery__del:hover { background: var(--c-danger); }
.gallery__del svg { width: 13px; height: 13px; }

.photo-drop {
  border: 2px dashed var(--c-line); border-radius: var(--r);
  padding: var(--s-4); text-align: center; background: var(--c-surface-2);
}
.photo-drop.is-over { border-color: var(--c-brand-light);
                      background: var(--c-info-bg); }
.photo-drop input[type="file"] { display: none; }
.photo-picked { display: grid; gap: var(--s-1); margin-top: var(--s-3);
                text-align: left; font-size: var(--fs-sm); }
.photo-picked li { display: flex; gap: var(--s-2); }

/* ==========================================================================
   Misc
   ========================================================================== */
.kv { display: grid; gap: 0; font-size: var(--fs-sm); }
.kv__row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr);
           gap: var(--s-2); padding: var(--s-2) 0;
           border-bottom: 1px solid var(--c-line-2); }
.kv__row:last-child { border-bottom: 0; }
.kv__k { color: var(--c-ink-3); font-weight: 650; }
.kv__v { min-width: 0; overflow-wrap: anywhere; }

.desc-block {
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--c-surface-2); border: 1px solid var(--c-line-2);
  border-radius: var(--r); padding: var(--s-3); line-height: 1.6;
}

.pager { display: flex; gap: var(--s-2); align-items: center;
         justify-content: center; margin-top: var(--s-4);
         font-size: var(--fs-sm); flex-wrap: wrap; }

.banner {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3); border-radius: var(--r); font-size: var(--fs-sm);
  border: 1px solid var(--c-line); background: var(--c-surface-2);
  margin-bottom: var(--s-4);
}
.banner svg { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; }
.banner--ok   { background: var(--c-success-bg); border-color: #bbf7d0;
                color: var(--c-success); }
.banner--warn { background: var(--c-warning-bg); border-color: #fde68a;
                color: var(--c-warning); }
.banner--info { background: var(--c-info-bg); border-color: #bfdbfe;
                color: var(--c-info); }
.banner strong { display: block; }

.token-box {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: var(--fs-sm); word-break: break-all;
  background: var(--c-ink); color: #f8fafc;
  padding: var(--s-3); border-radius: var(--r);
}

.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--c-line);
        margin-bottom: var(--s-4); overflow-x: auto; }
.tabs a {
  padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); font-weight: 650;
  color: var(--c-ink-3); border-bottom: 2px solid transparent;
  white-space: nowrap; min-height: 40px; display: inline-flex;
  align-items: center;
}
.tabs a:hover { text-decoration: none; color: var(--c-ink); }
.tabs a.is-current { color: var(--c-brand); border-bottom-color: var(--c-brand); }

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  padding: var(--s-4); background: var(--c-brand);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--c-surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: var(--s-5);
}
.auth-card__brand { text-align: center; margin-bottom: var(--s-4); }
.auth-card__brand .mark {
  width: 46px; height: 46px; border-radius: var(--r); margin: 0 auto var(--s-2);
  background: var(--c-brand); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: var(--fs-lg);
}

.errors {
  background: var(--c-danger-bg); border: 1px solid #fca5a5;
  color: var(--c-danger); border-radius: var(--r); padding: var(--s-3);
  margin-bottom: var(--s-4); font-size: var(--fs-sm);
}
.errors ul { margin: 0; padding-left: var(--s-4); }

.inline-form { display: inline; }

/* A report preview, so the screen matches the PDF's sections. */
.report h3 { margin-top: var(--s-5); padding-bottom: var(--s-1);
             border-bottom: 1px solid var(--c-line); }
.report h3:first-child { margin-top: 0; }
.report .note { font-size: var(--fs-xs); color: var(--c-ink-3); }

/* ==========================================================================
   Desktop
   ========================================================================== */
@media (min-width: 900px) {
  .sidebar {
    display: block; flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
    background: var(--c-surface); border-right: 1px solid var(--c-line);
    padding: var(--s-4) var(--s-3);
    position: sticky; top: var(--header-h);
    height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .sidebar__item {
    display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-2) var(--s-3); border-radius: var(--r);
    color: var(--c-ink-2); font-size: var(--fs-base); font-weight: 600;
    min-height: 40px; margin-bottom: 2px;
  }
  .sidebar__item:hover { background: var(--c-surface-3); text-decoration: none; }
  .sidebar__item.is-current {
    background: var(--c-brand); color: #fff;
  }
  .sidebar__item svg { width: 18px; height: 18px; flex: 0 0 18px; }
  .sidebar__add { margin-bottom: var(--s-4); }
  .sidebar__group {
    font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em;
    color: var(--c-ink-4); font-weight: 700;
    margin: var(--s-4) 0 var(--s-2) var(--s-3);
  }

  .mobnav { display: none; }
  .main { padding: var(--s-5); }

  .selector__grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: end;
  }
  .searchbar__cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .cal__day { min-height: 82px; align-items: flex-start; padding: var(--s-2); }
  .cal__num { font-size: var(--fs-base); }
  .cal__marks { justify-content: flex-start; }
  .cal__mark { width: 8px; height: 8px; }

  /* Two columns: the calendar / list on the left, the day panel on the right */
  .split { display: grid; grid-template-columns: minmax(0, 1fr) 340px;
           gap: var(--s-4); align-items: start; }
  .split--wide { grid-template-columns: minmax(0, 1fr) 400px; }
  .hide-desktop { display: none !important; }
}

@media (max-width: 899px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 1200px) {
  .form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media print {
  .topbar, .sidebar, .mobnav, .no-print { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
  .card { border: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Touch
   A mouse can hit a 34px button; a gloved thumb on a site cannot. Where the
   pointer is coarse, every control grows to the tap size - and only there, so
   a desktop table stays dense.
   ========================================================================== */
@media (pointer: coarse) {
  .btn--sm { min-height: 40px; padding: var(--s-2) var(--s-3); }
  .topbar__action { min-width: var(--tap); height: 40px; }
  .cal__views a { min-height: 42px; }
  .tabs a { min-height: 44px; }
  .picker__toggle { min-height: var(--tap); }
  .gallery__del { width: 32px; height: 32px; }
  table.data td .btn { min-height: 40px; }
}
