:root {
  color-scheme: dark;
  --bg: #0a0f0e;
  --panel: #111816;
  --panel-2: #17211e;
  --line: #26342f;
  --text: #edf7f1;
  --muted: #93a49d;
  --accent: #5ee0a0;
  --warn: #f3c969;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(94, 224, 160, 0.08), transparent 32rem),
    radial-gradient(circle at top right, rgba(243, 201, 105, 0.08), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.login-shell { width: min(420px, calc(100% - 24px)); margin: 0 auto; padding: 12vh 0; }
.login-panel h1 { margin-bottom: 10px; }
.login-panel form { display: grid; gap: 4px; }

.topbar,
.panel-head,
.cols {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
}

h2 {
  font-size: 18px;
}

.status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(17, 24, 22, 0.7);
}
.status.connected { border-color: rgba(79, 220, 154, .45); color: #72efb2; }
.status.pending { border-color: rgba(246, 190, 75, .55); color: #ffd27a; }
.status.disconnected { border-color: rgba(245, 112, 112, .5); color: #ff9d9d; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 18px;
  margin-top: 28px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 22, 0.86);
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}
.popup-panel { position: relative; min-height: 74px; cursor: pointer; }
.popup-panel:not(.is-popup-open) > :not(h2):not(.popup-close) { display: none; }
.popup-panel:not(.is-popup-open) > .panel-head { display: flex; }
.popup-panel:not(.is-popup-open) > .panel-head > :not(h2) { display: none; }
.popup-panel:not(.is-popup-open) > .panel-head h2 { margin: 0; }
.popup-panel:not(.is-popup-open) h2 { margin: 0; padding-right: 90px; }
.popup-panel:not(.is-popup-open) h2::after { content: "Abrir"; float: right; color: var(--accent); font-size: 12px; font-weight: 700; }
.popup-panel.is-popup-open { position: fixed; z-index: 21; inset: 5vh 50% auto auto; width: min(680px, calc(100% - 32px)); max-height: 90vh; overflow-y: auto; transform: translateX(50%); margin: 0; box-shadow: 0 24px 80px rgba(0, 0, 0, .55); cursor: default; }
.popup-panel.is-popup-open .popup-close { display: block; position: absolute; top: 14px; right: 14px; }
.popup-close { display: none; }
.popup-open { overflow: hidden; }
.popup-open::before { content: ""; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .72); }
.top-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.authorized-status { color: var(--muted); }

.muted { color: var(--muted); line-height: 1.5; }
.connection-result { margin-top: 16px; min-height: 28px; color: var(--muted); }
.qr-code { display: block; width: 240px; height: 240px; object-fit: contain; margin-top: 10px; background: #fff; padding: 10px; border-radius: 8px; }
.calendar-nav { display: flex; align-items: center; gap: 14px; text-transform: capitalize; }
.calendar-nav button { min-width: 32px; padding: 0; font-size: 22px; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.calendar-scroll { width: 100%; overflow-x: auto; }
.mobile-agenda { display: none; }
.calendar-label, .calendar-day { min-height: 82px; padding: 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-label { min-height: auto; color: var(--muted); font-size: 12px; font-weight: 700; }
.calendar-day.empty { background: rgba(255,255,255,.02); }
.calendar-day b { display: block; margin-bottom: 8px; }
.calendar-event { display: block; width: 100%; overflow: hidden; margin-top: 4px; padding: 4px 5px; border: 0; border-radius: 4px; background: var(--accent); color: #062016; font-size: 11px; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event:hover { filter: brightness(1.08); }
@media (max-width: 680px) { .calendar-scroll .calendar { min-width: 620px; } .calendar-day { min-height: 70px; padding: 6px; } .calendar-event { font-size: 0; text-align: center; } .calendar-event::first-letter { font-size: 11px; } .mobile-agenda { display: grid; gap: 8px; margin-top: 14px; } .mobile-agenda-item { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px; width: 100%; padding: 11px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); text-align: left; } .mobile-agenda-item span { overflow-wrap: anywhere; } }

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
button {
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #08100e;
  color: var(--text);
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 11px 12px;
}

button {
  cursor: pointer;
  padding: 10px 14px;
  background: var(--accent);
  border-color: transparent;
  color: #062017;
  font-weight: 800;
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 5px;
  background: #07110e;
  color: var(--warn);
  overflow-wrap: anywhere;
}

.steps p {
  color: var(--muted);
  line-height: 1.5;
}

.agenda-panel {
  margin-top: 18px;
}

.booking-shell {
  width: min(560px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.booking-hero { margin-bottom: 24px; }
.booking-form { display: grid; gap: 16px; }
.booking-form button { margin-top: 4px; }
.date-picker { display: grid; gap: 10px; }
.date-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.booking-calendar { border-radius: 7px; overflow: hidden; }
.booking-day { width: 100%; min-height: 54px; padding: 8px; border-radius: 0; background: var(--panel-2); color: var(--text); text-align: left; }
.booking-day:not(:disabled):hover, .booking-day.selected { background: var(--accent); color: #062016; }
.booking-day:disabled { cursor: not-allowed; opacity: .35; }

fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
legend { color: var(--muted); padding: 0 5px; }
.weekday-list { display: flex; gap: 12px; flex-wrap: wrap; }
.weekday-list label { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; color: var(--muted); }
a { color: var(--accent); overflow-wrap: anywhere; }

.events {
  display: grid;
  gap: 10px;
}

.event {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 190px;
  gap: 14px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.event-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.event-actions button { padding: 7px 9px; font-size: 12px; }
.secondary { border-color: var(--line); background: transparent; color: var(--text); }
.danger { border-color: #7f3030; background: transparent; color: #f08c8c; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-open { overflow: hidden; }
.modal-open::before { content: ""; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .72); }
#event-form.is-modal { position: fixed; z-index: 21; inset: 5vh 50% auto auto; width: min(640px, calc(100% - 32px)); max-height: 90vh; overflow-y: auto; transform: translateX(50%); margin: 0; box-shadow: 0 24px 80px rgba(0, 0, 0, .55); }

.event strong {
  display: block;
}

.event small {
  color: var(--muted);
}

.badge {
  justify-self: end;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.badge.canceled {
  color: #f08c8c;
}

@media (max-width: 820px) {
  .topbar,
  .cols,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .grid,
  .event {
    grid-template-columns: 1fr;
  }

  .badge {
    justify-self: start;
  }
}

@media (max-width: 600px) {
  .shell,
  .booking-shell {
    width: min(100% - 20px, 560px);
    padding-top: 20px;
    padding-bottom: 24px;
  }

  h1 { font-size: 28px; line-height: 1.15; }
  h2 { font-size: 17px; }
  .topbar { gap: 14px; }
  .top-status { justify-content: flex-start; }
  .status { padding: 8px 10px; font-size: 13px; }
  .grid { gap: 12px; margin-top: 18px; }
  .panel { padding: 14px; }
  .muted { font-size: 14px; }
  input, textarea, select, button { min-height: 44px; }
  .cols { gap: 0; }
  .form-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .form-actions button { width: 100%; }
  .qr-code { width: min(240px, 100%); height: auto; }
  .calendar-label, .calendar-day { padding: 5px 3px; font-size: 11px; }
  .calendar-day { min-height: 58px; }
  .calendar-day b { margin-bottom: 5px; }
  .calendar-day span { padding: 3px 2px; font-size: 0; text-align: center; }
  .calendar-day span::first-letter { font-size: 10px; }
  .event { gap: 9px; padding: 11px; }
  .event-actions { justify-content: flex-start; }
  .event-actions button { min-height: 38px; }
  .event-actions .badge { width: 100%; }
  .booking-shell { padding-top: 32px; }
  .booking-hero { margin-bottom: 16px; }
  .weekday-list { gap: 8px; }
  #event-form.is-modal { inset: 2vh 50% auto auto; max-height: 96vh; }
}
