/* =========================================================================
   Meet me — analytical / neutral visual system
   - Monochrome surface with single accent for interactive states
   - Tabular-nums for times and data density
   - Low-key shadows, crisp 1px separators
   ========================================================================= */

:root {
  /* Spacing (4pt grid) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px;

  /* Corners — smaller, less playful */
  --r-s: 4px;
  --r-m: 6px;
  --r-l: 10px;

  /* Light theme — neutral zinc palette */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --fill: #f4f4f5;
  --fill-2: #e4e4e7;
  --fill-3: #d4d4d8;
  --label: #09090b;
  --label-2: #52525b;
  --label-3: #a1a1aa;
  --sep: #e4e4e7;
  --sep-strong: #d4d4d8;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-fg: #ffffff;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;

  --hold: #4f46e5;
  --hold-fg: #312e81;
  --hold-soft: #eef2ff;
  --hold-border: #c7d2fe;

  --event-fg: #3f3f46;
  --event-soft: #f4f4f5;
  --event-border: #d4d4d8;

  --sel: #b45309;
  --sel-soft: #fffbeb;
  --sel-border: #fcd34d;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;

  --success: #047857;

  --shadow-1: 0 1px 1px rgba(9, 9, 11, 0.04);
  --shadow-2: 0 2px 6px rgba(9, 9, 11, 0.06),
              0 1px 2px rgba(9, 9, 11, 0.04);
  --shadow-3: 0 12px 32px rgba(9, 9, 11, 0.14),
              0 2px 6px rgba(9, 9, 11, 0.06);

  --hour-h: 52px;
  --time-col-w: 56px;
  --topbar-h: 56px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #111113;
    --surface-2: #18181b;
    --fill: #1c1c1f;
    --fill-2: #27272a;
    --fill-3: #3f3f46;
    --label: #fafafa;
    --label-2: #a1a1aa;
    --label-3: #52525b;
    --sep: #27272a;
    --sep-strong: #3f3f46;

    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-fg: #0a0a0a;
    --accent-soft: rgba(37, 99, 235, 0.12);
    --accent-border: rgba(96, 165, 250, 0.35);

    --hold: #a5b4fc;
    --hold-fg: #c7d2fe;
    --hold-soft: rgba(79, 70, 229, 0.12);
    --hold-border: rgba(165, 180, 252, 0.35);

    --event-fg: #d4d4d8;
    --event-soft: rgba(244, 244, 245, 0.04);
    --event-border: rgba(212, 212, 216, 0.18);

    --sel: #fbbf24;
    --sel-soft: rgba(234, 179, 8, 0.1);
    --sel-border: rgba(251, 191, 36, 0.35);

    --danger: #f87171;
    --danger-hover: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.1);

    --success: #34d399;

    --shadow-1: 0 1px 1px rgba(0, 0, 0, 0.5);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-3: 0 16px 48px rgba(0, 0, 0, 0.7);
  }
}

/* Reset + base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  overflow-x: hidden;        /* hard stop on horizontal page scroll */
  overscroll-behavior: none;
}
html { height: 100%; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter",
    "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Tabular numerics on any element that shows data */
.tnum, time, .cal-event .t, .cal-hold .t, .cal-selection .t,
.cal-timecol .hour, .range-label, .sel-list li, .group ul li,
.group .meta {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-s);
}

/* Buttons ------------------------------------------------------------------ */
button {
  font: inherit;
  color: var(--label);
  background: var(--surface);
  border: 1px solid var(--sep-strong);
  padding: 7px 12px;
  border-radius: var(--r-m);
  cursor: pointer;
  min-height: 32px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition:
    background 140ms var(--ease),
    border-color 140ms var(--ease),
    color 140ms var(--ease),
    box-shadow 140ms var(--ease);
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover { background: var(--fill); }
button:active { background: var(--fill-2); }
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  box-shadow: var(--shadow-1);
}
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.primary:disabled {
  background: var(--fill-2);
  border-color: var(--sep-strong);
  color: var(--label-3);
  box-shadow: none;
}

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--label-2);
}
button.ghost:hover { background: var(--fill); color: var(--label); }

button.danger {
  background: var(--surface);
  border-color: var(--sep-strong);
  color: var(--danger);
}
button.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}
button.danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}
button.danger-solid:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

button.icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--r-m);
  display: inline-grid;
  place-items: center;
}
button.icon svg { width: 16px; height: 16px; }

button.big {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  border-radius: var(--r-m);
}

/* Segmented control */
.segmented {
  display: inline-flex;
  border: 1px solid var(--sep-strong);
  border-radius: var(--r-m);
  overflow: hidden;
  background: var(--surface);
}
.segmented > button {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 6px 12px;
  min-height: 30px;
  font-size: 13px;
  font-weight: 500;
  color: var(--label-2);
}
.segmented > button + button { border-left: 1px solid var(--sep); }
.segmented > button.active {
  background: var(--label);
  color: var(--surface);
}
.segmented > button:hover:not(.active) { background: var(--fill); color: var(--label); }

/* Inputs ------------------------------------------------------------------- */
input[type="text"], input[type="email"], select, textarea {
  font: inherit;
  color: var(--label);
  background: var(--surface);
  border: 1px solid var(--sep-strong);
  border-radius: var(--r-m);
  padding: 9px 12px;
  width: 100%;
  min-height: 36px;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%2371717a' d='M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* Topbar ------------------------------------------------------------------- */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--s4);
  padding: 10px 18px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--sep);
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-h);
}
.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.brand .mark {
  width: 22px; height: 22px;
  border-radius: var(--r-s);
  background: var(--label);
  color: var(--surface);
  display: grid;
  place-items: center;
}
.brand .mark svg { width: 13px; height: 13px; }

.range-nav { display: flex; gap: 4px; align-items: center; }
.range-label {
  color: var(--label-2);
  margin-left: 10px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.account { display: flex; gap: 8px; align-items: center; }
.user-label {
  color: var(--label-2);
  font-size: 13px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hidden { display: none !important; }

/* Layout ------------------------------------------------------------------- */
#app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: calc(100dvh - var(--topbar-h));
}
.calendar-wrap {
  overflow: auto;
  background: var(--bg);
}
.calendar-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.calendar-wrap::-webkit-scrollbar-thumb {
  background: var(--fill-2);
  border-radius: 10px;
  border: 2px solid var(--bg);
}
.calendar-wrap::-webkit-scrollbar-thumb:hover { background: var(--fill-3); }

.sidebar {
  background: var(--surface);
  border-left: 1px solid var(--sep);
  overflow: auto;
  padding: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.panel {
  background: transparent;
}
.panel + .panel {
  border-top: 1px solid var(--sep);
  padding-top: var(--s5);
}
.panel > .eyebrow {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label-3);
}
.panel > .title {
  margin: 0 0 var(--s3);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hint {
  color: var(--label-2);
  font-size: 12.5px;
  margin: var(--s1) 0 var(--s3);
  line-height: 1.5;
}

.field { display: flex; flex-direction: column; gap: 6px; margin: var(--s3) 0; }
.field > span {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--label-2);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.row { display: flex; gap: var(--s2); margin-top: var(--s4); }
.row > * { flex: 1; }
.row.end { justify-content: flex-end; }
.row.end > * { flex: 0 0 auto; }

/* Duration picker — flat segmented */
.duration {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--sep-strong);
  border-radius: var(--r-m);
  overflow: hidden;
}
.duration button {
  padding: 8px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-weight: 500;
  font-size: 13px;
  color: var(--label-2);
  min-height: 36px;
}
.duration button + button { border-left: 1px solid var(--sep); }
.duration button.active {
  background: var(--label);
  color: var(--surface);
  font-weight: 600;
}
.duration button:hover:not(.active) { background: var(--fill); color: var(--label); }

/* Pending selection list */
.sel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
}
.sel-list:empty { display: none; }
.sel-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--sel-soft);
  border: 1px solid var(--sel-border);
  border-radius: var(--r-s);
  font-size: 13px;
}
.sel-list li .time { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-list li .time strong { font-weight: 600; color: var(--label); }
.sel-list li button {
  background: transparent;
  border-color: transparent;
  color: var(--label-2);
  padding: 3px 6px;
  min-height: 0;
  font-size: 12px;
}
.sel-list li button:hover { color: var(--danger); background: transparent; }

/* Active holds */
.groups { display: flex; flex-direction: column; gap: var(--s3); }
.group {
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: var(--r-m);
  padding: var(--s3) var(--s4);
  transition: border-color 140ms var(--ease);
}
.group:hover { border-color: var(--sep-strong); }
.group.expiring {
  border-color: var(--sel-border);
  background: var(--sel-soft);
}
.group > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s2);
  margin-bottom: var(--s2);
}
.group > header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.group .meta {
  color: var(--label-2);
  font-size: 11.5px;
  font-weight: 500;
}
.group.expiring .meta { color: var(--sel); }
.group ul {
  list-style: none;
  margin: 0 0 var(--s2);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.group ul li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s2);
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--r-s);
  font-size: 12.5px;
}
.group ul li .actions { display: flex; gap: 4px; }
.group ul li button {
  padding: 3px 8px;
  min-height: 24px;
  font-size: 11.5px;
  font-weight: 500;
}
.group ul li button.book {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.group ul li button.book:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.group ul li button.rm {
  width: 24px;
  padding: 0;
  background: transparent;
  border-color: transparent;
  color: var(--label-3);
}
.group ul li button.rm:hover { color: var(--danger); background: var(--danger-soft); }
.group .footer { display: flex; flex-direction: column; gap: var(--s2); }
.group .footer-actions { display: flex; gap: var(--s2); }
.group .footer-actions > * { flex: 1; }

.tz-mini {
  padding: 6px 30px 6px 10px;
  min-height: 30px;
  font-size: 12.5px;
  background-color: var(--surface-2);
}

.tz-field { margin-top: var(--s3); }

.tz-pick-error {
  color: var(--danger);
  font-size: 12.5px;
  min-height: 1.25em;
  margin: var(--s2) 0 0;
}

/* Empty state */
.empty-state {
  padding: var(--s5) var(--s3);
  text-align: center;
  color: var(--label-2);
  border: 1px dashed var(--sep-strong);
  border-radius: var(--r-m);
}
.empty-state p { margin: 2px 0; font-size: 13px; }
.empty-state p:first-child { color: var(--label); font-weight: 500; }

/* Calendar ----------------------------------------------------------------- */
.calendar {
  position: relative;
  display: grid;
  grid-template-columns: var(--time-col-w) repeat(var(--cols, 7), minmax(0, 1fr));
  min-height: 100%;
  user-select: none;
}

.cal-corner, .cal-header {
  grid-row: 1;
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--sep);
  z-index: 4;
}
.cal-corner { grid-column: 1; border-right: 1px solid var(--sep); }
.cal-header {
  padding: 8px 4px 6px;
  text-align: center;
}
.cal-header .dow {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--label-3);
}
.cal-header .dom {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: -0.01em;
  color: var(--label);
}
.cal-header.today .dow { color: var(--accent); }
.cal-header.today .dom {
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--r-s);
  padding: 1px 7px;
}

.cal-timecol {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  background: var(--bg);
  border-right: 1px solid var(--sep);
}
.cal-timecol .hour {
  height: var(--hour-h);
  color: var(--label-3);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px 0 0;
  text-align: right;
  position: relative;
  top: -6px;
}
.cal-timecol .hour:first-child { visibility: hidden; }

.cal-day {
  grid-row: 2;
  position: relative;
  border-right: 1px solid var(--sep);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--hour-h) / 2 - 0.5px),
      var(--sep) calc(var(--hour-h) / 2 - 0.5px),
      var(--sep) calc(var(--hour-h) / 2 - 0px),
      transparent calc(var(--hour-h) / 2),
      transparent calc(var(--hour-h) - 1px),
      var(--sep-strong) calc(var(--hour-h) - 1px),
      var(--sep-strong) var(--hour-h)
    );
  touch-action: pan-y;
  cursor: cell;
}
.cal-day:last-child { border-right: 0; }
.cal-day.today {
  background-color: var(--accent-soft);
}

/* Event / hold / selection blocks */
.cal-event, .cal-hold, .cal-selection {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: var(--r-s);
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: -0.005em;
  overflow: hidden;
  transition: border-color 140ms var(--ease), transform 140ms var(--ease);
  cursor: pointer;
}
.cal-event {
  background: var(--event-soft);
  border: 1px solid var(--event-border);
  border-left: 2px solid var(--label-3);
  color: var(--event-fg);
}
.cal-event:hover { border-color: var(--label-3); }
.cal-event.tentative {
  background:
    repeating-linear-gradient(
      45deg,
      var(--event-soft) 0 4px,
      transparent 4px 8px
    );
}
.cal-event .s, .cal-hold .s, .cal-selection .s {
  font-weight: 600;
  color: var(--label);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event .t, .cal-hold .t, .cal-selection .t {
  font-size: 10.5px;
  color: var(--label-2);
  margin-top: 1px;
}

.cal-hold {
  background: var(--hold-soft);
  border: 1px solid var(--hold-border);
  border-left: 2px solid var(--hold);
  color: var(--hold-fg);
}
.cal-hold:hover { border-color: var(--hold); }
.cal-hold .s { color: var(--hold); }

.cal-selection {
  background: var(--sel-soft);
  border: 1px solid var(--sel-border);
  border-left: 2px solid var(--sel);
  color: var(--sel);
  animation: place-in 180ms var(--ease);
}
.cal-selection .s { color: var(--sel); }
.cal-selection .rm {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: var(--r-s);
  background: var(--surface);
  border: 1px solid var(--sep-strong);
  display: grid; place-items: center;
  color: var(--label-2);
  font-size: 12px;
  padding: 0; min-height: 0;
  line-height: 1;
}
.cal-selection .rm:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

@keyframes place-in {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Now line */
.now-line {
  position: absolute;
  left: -3px;
  right: 0;
  height: 0;
  border-top: 1.5px solid var(--danger);
  pointer-events: none;
  z-index: 3;
}
.now-line::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -4px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
}

/* Drag ghost */
.cal-ghost {
  position: absolute;
  left: 3px; right: 3px;
  background: var(--sel-soft);
  border: 1.5px dashed var(--sel);
  border-radius: var(--r-s);
  pointer-events: none;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sel);
  font-variant-numeric: tabular-nums;
  z-index: 2;
}

/* Toast -------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  padding: 8px 14px;
  background: var(--label);
  color: var(--surface);
  border-radius: var(--r-m);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms var(--ease), transform 200ms var(--ease);
  z-index: 80;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); color: white; }

/* Dialog ------------------------------------------------------------------- */
.dialog {
  border: 1px solid var(--sep-strong);
  background: var(--surface);
  color: var(--label);
  border-radius: var(--r-l);
  padding: 0;
  max-width: 440px;
  width: calc(100% - 24px);
  box-shadow: var(--shadow-3);
}
.dialog[open] { animation: dialog-in 160ms var(--ease); }
.dialog::backdrop { background: rgba(9, 9, 11, 0.45); }
.dialog form, .dialog .body { padding: 20px; }
.dialog h3 { margin: 0 0 2px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.dialog .hint { margin-bottom: var(--s3); }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Event detail popover (uses <dialog>) */
.event-details {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 6px 12px;
  font-size: 13px;
  margin-top: var(--s2);
}
.event-details dt {
  color: var(--label-2);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  align-self: baseline;
  margin-top: 2px;
}
.event-details dd { margin: 0; color: var(--label); }

.event-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--r-s);
  font-size: 11px;
  font-weight: 500;
  background: var(--fill);
  color: var(--label-2);
  border: 1px solid var(--sep);
  margin-right: 4px;
}
.event-badge.hold { background: var(--hold-soft); color: var(--hold); border-color: var(--hold-border); }
.event-badge.tentative { background: var(--sel-soft); color: var(--sel); border-color: var(--sel-border); }

/* Auth gate ---------------------------------------------------------------- */
.gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}
.gate-card {
  background: var(--surface);
  border: 1px solid var(--sep-strong);
  padding: 36px 32px 28px;
  border-radius: var(--r-l);
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-2);
}
.gate-card .mark-lg {
  width: 52px; height: 52px;
  border-radius: var(--r-m);
  margin: 0 auto 18px;
  background: var(--label);
  color: var(--surface);
  display: grid; place-items: center;
}
.gate-card .mark-lg svg { width: 28px; height: 28px; }
.gate-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.gate-card p { color: var(--label-2); margin: 0 0 24px; font-size: 14px; line-height: 1.5; }
.gate-card button { width: 100%; }
.gate-card .hint { margin-top: 16px; font-size: 12px; text-align: left; }
.gate-card .hint.setup {
  background: var(--fill);
  border: 1px solid var(--sep);
  color: var(--label);
  padding: 10px 12px;
  border-radius: var(--r-s);
  font-size: 12px;
  margin-top: 16px;
}

/* Mobile ------------------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --hour-h: 46px; --time-col-w: 48px; }
  .topbar {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "brand account"
      "nav view";
    row-gap: 8px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .brand { grid-area: brand; }
  .account { grid-area: account; justify-self: end; }
  .range-nav { grid-area: nav; }
  .view-toggle { grid-area: view; justify-self: end; }
  .view-toggle button[data-view="7"] { display: none; }
  .range-label { display: none; }

  #app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100dvh - var(--topbar-h));
  }
  .calendar-wrap {
    height: 58dvh;
    border-bottom: 1px solid var(--sep);
  }
  .calendar {
    grid-template-columns: var(--time-col-w) repeat(var(--cols, 7), minmax(96px, 1fr));
  }
  .sidebar {
    border-left: 0;
    padding: var(--s4);
    padding-bottom: calc(var(--s5) + env(safe-area-inset-bottom));
  }
}

@media (max-width: 520px) {
  :root { --hour-h: 44px; --time-col-w: 44px; }
  .topbar { padding: 10px 12px; }
  .brand { font-size: 14px; }
  .brand .mark { width: 20px; height: 20px; }
  .user-label { display: none; }
  .calendar {
    grid-template-columns: var(--time-col-w) repeat(var(--cols, 7), minmax(76px, 1fr));
  }
  .event-details { grid-template-columns: 80px 1fr; font-size: 12.5px; }
  .dialog form, .dialog .body { padding: 16px; }
}

/* Small screens: default to 3-day view hint is applied by JS */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
