:root {
  --page: #050918;
  --page-2: #070d24;
  --header: #080d22;
  --panel: #09122e;
  --panel-2: #0d1738;
  --panel-3: #111d46;
  --line: #1c2a55;
  --line-2: #263966;
  --text: #f7f9ff;
  --muted: #b8c3e4;
  --muted-2: #8390b8;
  --cyan: #7bd9ff;
  --cyan-2: #52c5ee;
  --purple: #8d6cff;
  --pink: #f05fd3;
  --green: #71e8a6;
  --yellow: #ffd76f;
  --red: #ff7588;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
  --max: 1160px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -8%, rgba(39, 72, 151, 0.35), transparent 42%),
    linear-gradient(180deg, var(--page-2) 0%, var(--page) 72%);
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 74px;
  background: rgba(7, 12, 32, 0.98);
  border-bottom: 1px solid #111b40;
}

.header-inner {
  width: min(var(--max), calc(100% - 32px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: auto;
  height: 42px;
  object-fit: contain;
}

.brand-name {
  font-weight: 900;
  letter-spacing: -0.035em;
  font-size: 20px;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 10px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 13px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  border: 1px solid transparent;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: #101a3c;
  border-color: #1c2c5c;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #101a3c;
  border: 1px solid #203260;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.avatar, .avatar-lg {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #5865f2;
  color: white;
  font-weight: 950;
  border: 1px solid rgba(255,255,255,.16);
  overflow: hidden;
}

.avatar { width: 28px; height: 28px; font-size: 12px; }
.avatar-lg { width: 96px; height: 96px; font-size: 34px; }
.avatar img, .avatar-lg img { width: 100%; height: 100%; object-fit: cover; }

.page {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.page.compact {
  min-height: calc(100vh - 74px);
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.login-card {
  width: min(620px, 100%);
  border: 1px solid #182752;
  background: #081129;
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.login-logo {
  display: block;
  width: min(390px, 92%);
  height: auto;
  margin: 0 auto 20px;
}

.login-title {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 0.98;
  letter-spacing: -0.06em;
  text-align: center;
}

.login-copy {
  margin: 18px auto 0;
  max-width: 500px;
  text-align: center;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.55;
  font-size: 16px;
}

.login-panel {
  margin-top: 24px;
  background: #101a3c;
  border: 1px solid #213363;
  border-radius: 20px;
  padding: 20px;
}

.login-panel h2 {
  margin: 0 0 7px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 650;
}

.btn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #15224a;
  color: var(--text);
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.btn:hover { transform: translateY(-1px); background: #1a2a5a; }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { background: var(--cyan); color: #061023; border-color: var(--cyan); }
.btn-primary:hover { background: #91e4ff; }
.btn-danger { background: #351827; border-color: #74304b; color: #ffc5d1; }
.btn-danger:hover { background: #472033; }
.btn-muted { background: transparent; border-color: #2a3d70; color: var(--muted); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-wide { width: 100%; margin-top: 18px; }
.btn-icon { width: 18px; height: 18px; }

.content-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.kicker {
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 12px;
  font-weight: 950;
  margin-bottom: 7px;
}

.page-title {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  letter-spacing: -0.055em;
}

.page-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 650;
  max-width: 740px;
}

.section {
  margin-top: 22px;
}

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

.section-title h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.035em;
}

.count {
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 800;
}

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

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

.card {
  background: #09122e;
  border: 1px solid #1a2954;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.card-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.card-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #101a3c;
  border: 1px solid #223362;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.confirmed { color: #b8ffd4; border-color: rgba(113,232,166,.35); background: rgba(113,232,166,.08); }
.pill.pending { color: #ffe5a3; border-color: rgba(255,215,111,.35); background: rgba(255,215,111,.08); }
.pill.maybe { color: #d8ceff; border-color: rgba(141,108,255,.35); background: rgba(141,108,255,.08); }
.pill.declined { color: #ffc4cf; border-color: rgba(255,117,136,.36); background: rgba(255,117,136,.08); }
.pill.admin { color: #a9efff; border-color: rgba(123,217,255,.36); background: rgba(123,217,255,.08); }

.empty {
  border: 1px dashed #243764;
  background: #081029;
  color: var(--muted-2);
  border-radius: var(--radius);
  padding: 22px;
  font-weight: 750;
  text-align: center;
}

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

.form-grid .full { grid-column: 1 / -1; }

.field { display: grid; gap: 7px; }
.label { color: var(--muted); font-size: 13px; font-weight: 850; }

.input, .select, .textarea {
  width: 100%;
  color: var(--text);
  background: #070e25;
  border: 1px solid #243662;
  border-radius: 12px;
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
}

.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--cyan-2); }

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 999px;
  background: #101a3c;
  border: 1px solid #253968;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  user-select: none;
}

.check-pill input { accent-color: var(--cyan); }
.check-pill:has(input:checked) { color: var(--text); border-color: var(--cyan-2); background: #112243; }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.day-card {
  background: #09122e;
  border: 1px solid #1a2954;
  border-radius: 16px;
  padding: 12px;
  min-width: 0;
}

.day-name {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.day-card .input, .day-card .select { min-height: 36px; padding: 7px 9px; font-size: 13px; }
.day-card .field { margin-top: 8px; }
.day-card .label { font-size: 12px; }
.mini-check { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 750; margin-top: 8px; }
.mini-check input { accent-color: var(--cyan); }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 320px;
  gap: 16px;
}

.response-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.mode-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.mode-button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #263a69;
  background: #101a3c;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.mode-button.active { color: #071022; background: var(--cyan); border-color: var(--cyan); }

.availability-wrap {
  overflow: auto;
  border: 1px solid #1a2954;
  border-radius: 16px;
  background: #070e25;
}

.availability-grid {
  display: grid;
  min-width: 720px;
  grid-template-columns: 72px repeat(7, minmax(78px, 1fr));
  user-select: none;
}

.grid-head, .time-cell, .slot-cell {
  min-height: 34px;
  border-right: 1px solid #152345;
  border-bottom: 1px solid #152345;
}

.grid-head {
  display: grid;
  place-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0d1738;
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
}

.time-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  background: #09122e;
  font-size: 12px;
  font-weight: 800;
}

.slot-cell {
  cursor: crosshair;
  background: #09122e;
  touch-action: none;
}
.slot-cell:hover { outline: 1px solid #2a8fb7; outline-offset: -1px; }
.slot-cell.available { background: #1c7d59; }
.slot-cell.maybe { background: #4a3d8f; }

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

.stat {
  background: #101a3c;
  border: 1px solid #223362;
  border-radius: 14px;
  padding: 13px;
}
.stat-label { color: var(--muted-2); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.stat-value { margin-top: 4px; font-size: 18px; font-weight: 950; letter-spacing: -0.03em; }

.profile-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.admin-login {
  width: min(460px, 100%);
}

.user-row, .meeting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid #172750;
}
.user-row:first-child, .meeting-row:first-child { border-top: 0; padding-top: 0; }
.user-info-title { font-weight: 950; letter-spacing: -0.02em; }
.user-info-sub { color: var(--muted-2); font-size: 13px; font-weight: 750; margin-top: 4px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0,0,0,.66);
}
.modal {
  width: min(760px, 100%);
  max-height: min(860px, calc(100vh - 44px));
  overflow: auto;
  background: #09122e;
  border: 1px solid #263968;
  border-radius: 24px;
  box-shadow: 0 28px 90px rgba(0,0,0,.55);
  padding: 22px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.modal-title { margin: 0; font-size: 24px; letter-spacing: -0.04em; }
.modal-copy { margin: 6px 0 0; color: var(--muted); font-weight: 650; line-height: 1.45; }
.close-btn {
  border: 1px solid #2a3d70;
  background: #101a3c;
  border-radius: 12px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-weight: 950;
}

.notice {
  background: #101a3c;
  border: 1px solid #223362;
  color: var(--muted);
  border-radius: 14px;
  padding: 13px;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 650;
}
.notice.warn { border-color: rgba(255,215,111,.35); color: #ffe4a0; background: rgba(255,215,111,.08); }
.notice.danger { border-color: rgba(255,117,136,.35); color: #ffc4cf; background: rgba(255,117,136,.08); }

.hidden { display: none !important; }
.mt-0 { margin-top: 0 !important; }
.mt-10 { margin-top: 10px !important; }
.mt-14 { margin-top: 14px !important; }
.mt-18 { margin-top: 18px !important; }
.mt-22 { margin-top: 22px !important; }
.text-muted { color: var(--muted); }
.text-soft { color: var(--muted-2); }

@media (max-width: 960px) {
  .header-inner { width: min(100% - 22px, var(--max)); }
  .brand-name { display: none; }
  .nav { overflow-x: auto; }
  .grid, .grid.three { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: 1fr; }
  .content-head { flex-direction: column; align-items: stretch; }
}

@media (max-width: 640px) {
  .app-header { height: auto; }
  .header-inner { flex-direction: column; align-items: stretch; padding: 13px 0; }
  .brand { justify-content: space-between; }
  .brand-logo { height: 38px; }
  .nav { margin: 0; gap: 8px; padding-bottom: 2px; }
  .nav-link { height: 34px; padding: 0 11px; font-size: 13px; }
  .header-actions { justify-content: space-between; }
  .page { width: min(100% - 22px, var(--max)); padding: 20px 0 34px; }
  .login-card { padding: 24px 18px; }
  .login-logo { width: 92%; }
  .form-grid { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: 1fr; }
  .response-controls { grid-template-columns: 1fr; }
  .profile-card { grid-template-columns: 1fr; text-align: center; }
  .avatar-lg { margin: 0 auto; }
  .user-row, .meeting-row { grid-template-columns: 1fr; }
}
