:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #18202f;
  --muted: #64748b;
  --border: #d9e1ec;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.1);
}

[data-theme="dark"] {
  --bg: #10151f;
  --surface: #172033;
  --surface-2: #202b3e;
  --text: #ecf3ff;
  --muted: #a8b4c7;
  --border: #2d3a50;
  --accent: #2dd4bf;
  --accent-2: #60a5fa;
  --danger: #f87171;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

[data-theme="dark"] body {
  color-scheme: dark;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

::placeholder {
  color: var(--muted);
  opacity: 1;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #111827;
  color: #f8fafc;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #14b8a6;
  color: #042f2e;
  font-weight: 800;
}

.brand h1 {
  font-size: 21px;
  line-height: 1.2;
  margin: 0;
}

.brand p {
  margin: 3px 0 0;
  color: #a7b4c7;
  font-size: 14px;
}

.nav-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  margin-bottom: 8px;
  color: #dbe7f6;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 16px;
  font-weight: 700;
}

.nav-button.active,
.nav-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.user-panel {
  margin-top: 28px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: grid;
  gap: 8px;
}

.user-panel span {
  color: #a7b4c7;
  font-size: 14px;
}

.user-panel .button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-panel {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 18px;
}

.auth-panel h1 {
  margin: 0;
  font-size: 30px;
}

.auth-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.login-tabs button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.login-tabs button.active {
  background: var(--accent);
  color: #052e2b;
  border-color: transparent;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-help {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 15px;
}

.login-help strong {
  color: var(--text);
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.topbar h2 {
  font-size: 34px;
  margin: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}

.button.primary {
  border-color: transparent;
  background: var(--accent);
  color: #052e2b;
  font-weight: 800;
}

.button.danger {
  border-color: transparent;
  background: var(--danger);
  color: white;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.content-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.75fr);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.stat {
  min-height: 118px;
}

.stat p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.stat strong {
  display: block;
  margin-top: 10px;
  font-size: 40px;
}

.stat span {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title h3 {
  margin: 0;
  font-size: 20px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 10px;
  font-size: 16px;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.input-action .button {
  min-width: 82px;
}

.field-note {
  color: var(--muted);
  font-size: 14px;
}

.calendar-card {
  min-height: 680px;
}

.fc {
  --fc-border-color: var(--border);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: var(--surface-2);
  --fc-today-bg-color: rgba(20, 184, 166, 0.1);
  --fc-button-bg-color: var(--surface-2);
  --fc-button-border-color: var(--border);
  --fc-button-text-color: var(--text);
  --fc-button-hover-bg-color: var(--accent);
  --fc-button-hover-border-color: var(--accent);
  --fc-button-active-bg-color: var(--accent);
  --fc-button-active-border-color: var(--accent);
  color: var(--text);
}

.fc .fc-toolbar-title {
  font-size: 22px;
}

.fc a,
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
  color: var(--text);
}

.fc .fc-button {
  color: var(--text);
  box-shadow: none;
}

.fc .fc-button:hover,
.fc .fc-button-primary:not(:disabled).fc-button-active {
  color: #052e2b;
}

.fc .fc-daygrid-event,
.fc .fc-timegrid-event {
  color: #ffffff;
}

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

.meeting-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.meeting-row strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.meeting-meta {
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-remove-button {
  width: fit-content;
  min-height: 38px;
  padding: 0 12px;
}

.admin-meeting-register {
  display: grid;
  gap: 16px;
}

.admin-meeting-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 18px;
  display: grid;
  gap: 16px;
}

.admin-meeting-card:hover {
  border-color: var(--accent);
}

.admin-meeting-card .badge {
  font-size: 15px;
  padding: 6px 10px;
}

.admin-meeting-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.admin-meeting-head div {
  display: grid;
  gap: 8px;
}

.admin-meeting-head strong {
  font-size: 22px;
  line-height: 1.25;
}

.admin-meeting-head > span {
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.admin-detail-grid span {
  min-width: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.admin-detail-grid b {
  display: block;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 5px;
}

.admin-detail-grid .wide {
  grid-column: 1 / -1;
}

.admin-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  width: fit-content;
}

.badge[style*="background"] {
  color: #0f172a;
}

.fc-event .fc-event-title,
.fc-event .fc-event-time {
  color: #ffffff;
}

.MuiFormControlLabel-label,
.MuiInputBase-input,
.MuiSelect-select,
.MuiTypography-root {
  color: var(--text) !important;
}

[data-theme="dark"] .MuiPaper-root,
[data-theme="dark"] .MuiOutlinedInput-root,
[data-theme="dark"] .MuiInputBase-root {
  background: var(--surface) !important;
  color: var(--text) !important;
}

.resource {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.resource:last-child {
  border-bottom: 0;
}

.user-summary {
  padding: 10px 0 6px;
}

.user-summary + .user-summary {
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.compact-user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.compact-user strong {
  font-size: 18px;
}

.section-title.compact {
  margin-bottom: 4px;
}

.section-title.compact h4 {
  margin: 0;
  font-size: 18px;
}

.multi-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.people-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.list-picker {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  margin-top: 8px;
}

.picker-toggle {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
}

.picker-toggle strong {
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #052e2b;
  font-size: 14px;
}

.multi-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.multi-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.slot {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.slot.busy {
  cursor: not-allowed;
  opacity: 0.5;
  text-decoration: line-through;
}

.activity {
  border-left: 3px solid var(--accent-2);
  padding: 8px 0 8px 10px;
  color: var(--muted);
  font-size: 15px;
}

.drawer {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  display: flex;
  justify-content: flex-end;
  z-index: 50;
}

.drawer-panel {
  width: min(760px, 100vw);
  height: 100vh;
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  padding: 22px;
}

.event-view-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.68);
  padding: 18px;
}

.event-view-panel {
  width: min(560px, 100%);
  min-height: 500px;
  background: #11131a;
  color: #f4f5fb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  padding: 28px;
  display: grid;
  align-content: start;
  gap: 24px;
}

.event-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.event-actions div {
  display: flex;
  gap: 10px;
}

.icon-button {
  min-width: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #e8eaf2;
  cursor: pointer;
  font-weight: 800;
}

.close-button {
  font-size: 20px;
}

.edit-event-button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #f5f7ff;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.delete-event-button {
  min-height: 42px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.edit-event-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.delete-event-button:hover {
  background: rgba(248, 113, 113, 0.2);
}

.event-title-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.event-color {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  margin-top: 8px;
}

.event-title-row h3 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
}

.event-title-row p {
  margin: 10px 0 0;
  color: #d7dae5;
  font-size: 20px;
}

.event-action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.invite-link-button {
  width: fit-content;
  min-height: 50px;
  border-radius: 999px;
  border: 1px solid #8f94a3;
  background: transparent;
  color: #dfe4ff;
  padding: 0 22px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.invite-link-button:hover,
.meeting-open-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.meeting-open-link {
  width: fit-content;
  color: #dfe4ff;
  border: 1px solid #5b6172;
  border-radius: 999px;
  padding: 11px 18px;
  text-decoration: none;
  font-weight: 700;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
}

.event-status {
  margin: -14px 0 0;
  color: #bfc5d6;
  font-size: 15px;
}

.invite-draft {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #3c4353;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.invite-draft strong {
  font-size: 16px;
  color: #ffffff;
}

.invite-draft textarea {
  width: 100%;
  min-height: 150px;
  border: 1px solid #5b6172;
  border-radius: 8px;
  background: #161820;
  color: #f4f5fb;
  padding: 12px;
  resize: vertical;
  font-size: 16px;
  line-height: 1.5;
}

.event-info-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: #eef0f7;
  font-size: 21px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.event-info-row small {
  display: block;
  margin-top: 4px;
  color: #b9bdca;
  font-size: 16px;
}

.event-icon {
  color: #aeb5c6;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.warning {
  border: 1px solid #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.warning strong {
  color: #b45309;
}

.report-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-actions {
  justify-content: flex-start;
  margin: 12px 0;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent-2);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .stats-grid,
  .content-grid,
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .stats-grid,
  .content-grid,
  .report-grid,
  .filters,
  .form-grid,
  .input-action,
  .people-selector,
  .slot-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 16px;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .admin-meeting-head,
  .admin-detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-meeting-head > span {
    white-space: normal;
  }
}
