* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --fg: #f5f5f5;
  --muted: rgba(255, 255, 255, 0.5);
  --accent: #4d6bfe;
  --border: rgba(255, 255, 255, 0.08);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

html,
body {
  height: 100%;
}

body {
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter',
    'Helvetica Neue', sans-serif;
  font-feature-settings: 'tnum';
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  background: #000;
}

body.dashboard {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.strip {
  display: flex;
  width: 200%;
  height: 100%;
  transition: transform 380ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}

.panel {
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: calc(20px + var(--safe-t)) calc(28px + var(--safe-r))
    calc(20px + var(--safe-b)) calc(28px + var(--safe-l));
}

.panel.meetings {
  background: #0f2a1a;
  transition: background-color 700ms ease;
}
.panel.meetings[data-state='free'] { background: #0f2a1a; }
.panel.meetings[data-state='soon'] { background: #2a220a; }
.panel.meetings[data-state='busy'] { background: #2a0f0f; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 17px;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: capitalize;
  flex-shrink: 0;
}

.topbar .clock {
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.75);
  text-transform: none;
  letter-spacing: 0.02em;
}

.status {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 8px 0;
  min-height: 0;
}

.status .label {
  font-size: clamp(30px, 6.8vmin, 62px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
  max-width: 100%;
  word-break: break-word;
}

.status .sublabel {
  font-size: clamp(18px, 3vmin, 26px);
  color: rgba(255, 255, 255, 0.65);
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 1em;
}

.panel.meetings[data-state='free'] .label { color: #4ade80; }
.panel.meetings[data-state='soon'] .label { color: #facc15; }
.panel.meetings[data-state='busy'] .label { color: #f87171; }

.upcoming {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  flex-shrink: 0;
}

.upcoming h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 10px;
}

.upcoming ul { list-style: none; }

.upcoming li {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 18px;
  padding: 8px 0;
  font-size: 21px;
}

.upcoming .time {
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

.upcoming .title {
  color: rgba(255, 255, 255, 0.95);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming .empty {
  display: block;
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
  font-size: 18px;
  padding: 4px 0;
}

.panel.agenda { background: #0a0a0a; }

.panel.agenda .topbar {
  padding-bottom: 16px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.panel.agenda .topbar .clock {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.allday {
  flex-shrink: 0;
  margin-bottom: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 5px solid #a78bfa;
}

.allday[hidden] { display: none; }

.allday h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 6px;
}

.allday ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.allday li {
  font-size: 19px;
  color: rgba(255, 255, 255, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.allday-inline {
  flex-shrink: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.55);
  padding: 8px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.allday-inline[hidden] { display: none; }

.agenda-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.agenda-list li {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 10px;
  background: #131313;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 5px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  font-size: 22px;
  line-height: 1.3;
}

.agenda-list .time {
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.agenda-list .title {
  color: rgba(255, 255, 255, 0.95);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-list li.past {
  opacity: 0.35;
  border-left-color: rgba(255, 255, 255, 0.12);
}

.agenda-list li.current {
  border-left-color: #f87171;
  background: rgba(248, 113, 113, 0.08);
}

.agenda-list li.current .title {
  color: #ffffff;
  font-weight: 600;
}

.agenda-list li.upcoming {
  border-left-color: #4ade80;
}

.agenda-list .empty {
  display: block;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  padding: 40px 0;
  font-size: 19px;
  border-left: none;
  background: transparent;
  grid-template-columns: 1fr;
}

.dots {
  position: fixed;
  bottom: calc(10px + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
  padding: 5px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transition: all 0.2s;
}

.dot.active {
  background: white;
  width: 18px;
  border-radius: 3px;
}

.audio-unlock {
  position: fixed;
  bottom: calc(50px + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(77, 107, 254, 0.92);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  animation: audioPulse 2.4s ease-in-out infinite;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.audio-unlock[hidden] { display: none; }

.audio-unlock .audio-icon {
  font-size: 18px;
  line-height: 1;
}

@keyframes audioPulse {
  0%, 100% { opacity: 0.88; }
  50% { opacity: 1; }
}

/* ---------- onboarding ---------- */

.onboard {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.onboard[hidden] { display: none; }

.onboard-card {
  width: min(520px, 100%);
  background: #131313;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
}

.onboard-card h1 {
  font-size: 24px;
  margin-bottom: 12px;
}

.onboard-card p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 16px;
}

.onboard-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.onboard-form input {
  flex: 1 1 200px;
  min-width: 0;
}

.onboard-error {
  color: #f87171;
  font-size: 15px;
  margin-top: 12px;
}

.onboard-note {
  margin-top: 16px;
  font-size: 14px;
}

/* ---------- setup console ---------- */

.setup-page {
  display: block;
  overflow: auto;
  background: #0a0a0a;
  color: var(--fg);
  user-select: text;
  padding: 24px;
}

.setup-header {
  max-width: 860px;
  margin: 0 auto 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.setup-header h1 {
  font-size: 24px;
  letter-spacing: -0.02em;
}

.setup-main {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #131313;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.card h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.card p {
  margin-bottom: 10px;
  line-height: 1.45;
}

.warn-card { border-color: rgba(234, 179, 8, 0.5); background: #1d1a0c; }

.muted { color: var(--muted); font-size: 14px; }
.error { color: #f87171; font-size: 14px; }
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-col { display: flex; flex-direction: column; gap: 10px; }
.form-col label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); flex: 1; }

input, select, button {
  font: inherit;
  color: var(--fg);
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
}

input:focus, select:focus { outline: 2px solid rgba(77, 107, 254, 0.6); outline-offset: 1px; }
input[hidden] { display: none; }

.btn {
  cursor: pointer;
  background: #242424;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 500;
}

.btn:hover { background: #2e2e2e; }
.btn.primary { background: #4d6bfe; border-color: #4d6bfe; color: #fff; }
.btn.primary:hover { background: #3f5bf0; }
.btn.danger { background: transparent; border-color: rgba(248, 113, 113, 0.5); color: #f87171; }
.btn.small { padding: 6px 10px; font-size: 13px; }

.list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.recover { margin-top: 16px; }
.recover summary { cursor: pointer; color: var(--muted); margin-bottom: 10px; }

.pairing-result { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.qr { background: #fff; padding: 8px; border-radius: 10px; line-height: 0; }
.qr svg { display: block; width: 200px; height: 200px; }

.invite-created { margin: 12px 0; color: rgba(255, 255, 255, 0.85); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  word-break: break-all;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  max-width: 90vw;
  padding: 12px 18px;
  border-radius: 12px;
  background: #1f3d2b;
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #d8ffe6;
  font-size: 14px;
}

.toast.error {
  background: #3a1a1a;
  border-color: rgba(248, 113, 113, 0.5);
  color: #ffd9d9;
}

.toast[hidden] { display: none; }
