/* Home: a bright desk-calendar workspace (like Zoom's app home). Action tiles
   on the left, today's clock and agenda on the right; one column on phones. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #e3e6eb;
  --text: #1d2129;
  --muted: #6b7280;
  --blue: #0e71eb;
  --blue-hover: #0b5cc4;
  --orange: #ff742e;
  --orange-hover: #ee6420;
  --danger: #dc3545;
  --ok: #16a34a;
  --radius: 14px;
  --font: var(--font-body, "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
  padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.brand .brand-logo { width: 32px; height: 32px; }
.profile {
  width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: var(--orange); color: #fff; font-weight: 700; cursor: pointer;
}
.profile:focus-visible, .tile:focus-visible, .btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 2px; }

.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 48px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px max(20px, env(safe-area-inset-right, 0px)) 48px max(20px, env(safe-area-inset-left, 0px));
  align-items: start;
}
@media (max-width: 820px) { .home { grid-template-columns: 1fr; gap: 32px; padding-top: 28px; } }

.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; justify-items: center; align-self: center; }
.action { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.action > span { display: flex; align-items: center; gap: 2px; }
.tile {
  width: 88px; height: 88px;
  display: grid; place-items: center;
  border: 0; border-radius: 26px;
  background: var(--blue); color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--blue) 30%, transparent);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.tile:hover { background: var(--blue-hover); transform: translateY(-2px); }
.tile.orange { background: var(--orange); box-shadow: 0 6px 18px color-mix(in srgb, var(--orange) 32%, transparent); }
.tile.orange:hover { background: var(--orange-hover); }
.tile svg { width: 40px; height: 40px; fill: currentColor; }
.caret { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 13px; }

.menu {
  position: absolute; top: 132px; left: 50%; transform: translateX(-50%); z-index: 5;
  min-width: 210px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, .14);
  color: var(--text);
}
.menu .check { padding: 8px; border-radius: 8px; margin: 0; }
.menu .check:hover { background: var(--bg); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item { display: block; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: none; text-align: left; font-weight: 600; color: var(--blue); cursor: pointer; }
.menu-item:hover { background: var(--bg); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.seg label { margin: 0 !important; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 12px; border: 2px solid var(--line); border-radius: 12px; font-weight: 700; color: var(--text); }
.seg small { display: block; margin-top: 2px; font-weight: 500; color: var(--muted); font-size: 12px; }
.seg input:checked + span { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 6%, transparent); }
.seg input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); }
.meeting-row .kind { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--orange) 18%, transparent); color: #8a5a00; font-size: 11px; font-weight: 700; vertical-align: 2px; }

.agenda { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.clock {
  padding: 34px 28px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(10, 20, 60, .82), rgba(10, 20, 60, .35)),
    url(/hero-broadcast.jpg) center / cover no-repeat;
}
.clock .time { font-size: 52px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.clock .date { margin-top: 8px; font-size: 16px; opacity: .85; }

.upcoming { padding: 8px 0 12px; }
.upcoming-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px 4px; }
.upcoming-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#upcoming-list { list-style: none; margin: 0; padding: 0; }
.day { padding: 14px 24px 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.meeting-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
}
.meeting-row:first-of-type { border-top: 0; }
.meeting-row .when { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meeting-row .when.live { color: #16a34a; font-weight: 700; }
.meeting-row .topic { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meeting-row .mid { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meeting-row .row-actions { grid-row: 1 / span 3; grid-column: 2; display: flex; gap: 8px; align-items: center; position: relative; }
.more-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; color: var(--muted); }
.more-btn:hover { background: var(--bg); }
.row-menu { top: 40px; right: 0; left: auto; transform: none; }
.row-menu button { display: block; width: 100%; padding: 8px 10px; border: 0; background: none; text-align: left; border-radius: 8px; cursor: pointer; }
.row-menu button:hover { background: var(--bg); }
.row-menu .danger { color: var(--danger); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 24px 28px; color: var(--muted); text-align: center; }
.empty svg { width: 48px; height: 48px; opacity: .6; }
.empty p { margin: 0; }
.link { border: 0; background: none; color: var(--blue); font-weight: 600; cursor: pointer; padding: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-hover); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: 6px 14px; font-size: 14px; }

.overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 24px; box-shadow: 0 24px 64px rgba(17, 24, 39, .3); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.wide { width: min(560px, 100%); }
.modal h3 { margin: 0 0 8px; font-size: 19px; }
.modal label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.modal input[type=text], .modal input[type=date], .modal input[type=time], .modal select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.modal input:focus, .modal select:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
.modal .row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .modal .row { grid-template-columns: 1fr 1fr; } }
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 500 !important; color: var(--text) !important; cursor: pointer; flex-wrap: wrap; }
.check input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--blue); }
.check small { color: var(--muted); width: 100%; padding-left: 27px; margin-top: -4px; }
.check .inline { width: 140px !important; padding: 6px 10px !important; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 18px 0 0; padding: 4px 16px 14px; }
legend { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.error { color: var(--danger); font-size: 14px; min-height: 1.2em; margin-top: 10px; }
.invite { white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 12px 0 0; }

.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast { padding: 10px 18px; background: var(--text); color: #fff; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

@media (prefers-reduced-motion: reduce) { .tile { transition: none; } .tile:hover { transform: none; } }

/* Guests (not signed in) see only Join; staff see everything. */
body.guest .staff-only, body:not(.guest) .guest-only { display: none !important; }
body.guest .actions { display: none; }
body.guest .home { grid-template-columns: 1fr; max-width: 620px; padding-top: 12vh; text-align: center; }
.guest-intro { align-self: center; display: flex; flex-direction: column; align-items: center; }
.guest-intro::before { content: ""; width: 72px; height: 72px; margin-bottom: 20px; background: url("/logo.svg") center / contain no-repeat; }
.guest-intro h1 { margin: 0 0 8px; font-size: 34px; letter-spacing: -0.02em; text-wrap: balance; }
.guest-intro p { margin: 0 0 22px; color: var(--muted); font-size: 16px; max-width: 42ch; }
.big-join { padding: 14px 28px; font-size: 16px; }
.btn.small { padding: 6px 14px; font-size: 14px; text-decoration: none; }
.nav-right { position: relative; display: flex; align-items: center; gap: 10px; }
.acct-menu { top: 48px; right: 0; left: auto; transform: none; min-width: 230px; }
.acct-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; }
.acct-who b { color: var(--text); font-size: 14px; }
.menu a.menu-item, .menu button.menu-item { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; font-weight: 600; cursor: pointer; color: var(--text); text-decoration: none; }
.menu .menu-item:hover { background: var(--bg); }
.menu .menu-item.danger { color: var(--danger); }
.cal-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.cal-row a.link { text-decoration: none; }

/* Email invitations */
.email-invite { margin-top: 14px; }
.email-invite label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.email-invite textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; resize: vertical; }
.email-invite-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.inv-status { color: var(--muted); font-size: 13px; }
