:root {
  --bg: #071314;
  --surface: rgba(9, 27, 28, 0.92);
  --surface-strong: #0d2324;
  --surface-soft: rgba(255, 255, 255, 0.04);
  --border: rgba(242, 106, 33, 0.18);
  --border-strong: rgba(242, 106, 33, 0.34);
  --text: #effbf9;
  --muted: rgba(239, 251, 249, 0.68);
  --gold: #f26a21;
  --gold-deep: #c94f10;
  --blue: #16b7ad;
  --danger: #d95c4f;
  --success: #2ecf91;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(242, 106, 33, 0.15), transparent 28%),
    radial-gradient(circle at bottom right, rgba(22, 183, 173, 0.14), transparent 30%),
    linear-gradient(180deg, #051010 0%, #071314 100%);
  color: var(--text);
}

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

.hidden { display: none !important; }

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.65;
}

.backdrop-a {
  background: radial-gradient(circle at 20% 20%, rgba(242, 106, 33, 0.1), transparent 35%);
}

.backdrop-b {
  background: radial-gradient(circle at 80% 10%, rgba(22, 183, 173, 0.1), transparent 32%);
}

.shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
  position: relative;
}

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11px;
  color: var(--gold);
  margin: 0 0 10px;
}

h1, h2, h3, h4, p { margin: 0; }
h1 {
  font-size: clamp(28px, 4vw, 52px);
  line-height: 0.95;
  max-width: 12ch;
}

h2 { font-size: clamp(20px, 3vw, 28px); line-height: 1.05; }
h3 { font-size: 20px; }
h4 { font-size: 16px; }
p { color: var(--muted); line-height: 1.6; }

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill, .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  font-size: 13px;
}

.pill.gold { background: rgba(242, 106, 33, 0.14); border-color: rgba(242, 106, 33, 0.35); color: #ffd3b6; }
.pill.success { background: rgba(138, 210, 174, 0.12); border-color: rgba(138, 210, 174, 0.35); color: #c9f0dc; }
.pill.muted { color: var(--muted); }

.auth-screen, .app-screen {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 32px;
  padding: 34px;
  align-items: center;
}

.auth-card, .panel, .stat-card, .modal-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.auth-card {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.auth-card label,
.form-block label {
  display: grid;
  gap: 8px;
}

.auth-card span,
.form-block span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

input, textarea, select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(242, 106, 33, 0.42);
  box-shadow: 0 0 0 4px rgba(242, 106, 33, 0.12);
}

.primary, .ghost {
  border-radius: 14px;
  padding: 12px 16px;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary {
  background: linear-gradient(180deg, #ff8a3d, #c94f10);
  color: #1b130e;
  font-weight: 700;
}

.ghost {
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-color: var(--border);
}

.ghost.mini {
  padding: 8px 10px;
  font-size: 12px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 28px 28px 16px;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  gap: 10px;
  padding: 0 28px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(15, 17, 23, 0.94), rgba(15, 17, 23, 0.82));
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  z-index: 4;
}

.tab {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
}

.tab.active {
  background: rgba(242, 106, 33, 0.16);
  border-color: rgba(242, 106, 33, 0.35);
  color: #ffd3b6;
}

.tab-panel {
  padding: 24px 28px 30px;
}

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

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

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

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

.panel, .stat-card {
  padding: 20px;
}

.calendar-panel {
  margin-bottom: 18px;
}

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

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

.stack {
  display: grid;
  gap: 12px;
}

.stat-value {
  margin-top: 16px;
  font-size: clamp(24px, 3vw, 40px);
  font-weight: 700;
}

.form-block {
  padding: 18px;
  margin-bottom: 14px;
  border-radius: 20px;
  background: rgba(0,0,0,0.12);
  border: 1px solid rgba(255,255,255,0.06);
}

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

.list-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.1);
}

.list-card.clickable {
  cursor: pointer;
}

.list-card.clickable:hover {
  border-color: rgba(242, 106, 33, 0.24);
  background: rgba(255,255,255,0.05);
}

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

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

.empty, .inline-hint {
  color: var(--muted);
  padding: 12px 0;
}

.calendar-legend {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.calendar-title {
  font-size: 18px;
  color: var(--text);
}

.calendar-key {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.calendar-key span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot.blue { background: var(--blue); }
.dot.gold { background: var(--gold); }
.dot.danger { background: var(--danger); }

.calendar-grid {
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.08);
  border-radius: 20px;
  padding: 12px;
}

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

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

.calendar-cell {
  text-align: left;
  min-height: 120px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  padding: 10px;
  color: var(--text);
}

.calendar-cell.out {
  opacity: 0.45;
}

.calendar-cell-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
}

.calendar-cell-body {
  display: grid;
  gap: 6px;
}

.calendar-chip {
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(22, 183, 173, 0.10);
  border: 1px solid rgba(22, 183, 173, 0.18);
  color: #c9fffb;
  font-size: 12px;
}

.calendar-more {
  color: var(--muted);
  font-size: 12px;
}

.calendar-day-focus {
  display: grid;
  gap: 12px;
}

.calendar-day-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.drawer {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 14, 0.62);
  display: flex;
  justify-content: flex-end;
  z-index: 25;
}

.drawer-panel {
  width: min(520px, 100%);
  height: 100%;
  overflow: auto;
  background: rgba(19, 22, 30, 0.98);
  border-left: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow);
}

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.drawer-meta > div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 11, 16, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal-card {
  width: min(760px, 100%);
  padding: 22px;
  max-height: min(88vh, 900px);
  overflow: auto;
}

.toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: grid;
  gap: 10px;
  z-index: 30;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(18, 20, 28, 0.94);
  box-shadow: var(--shadow);
}

.toast.success {
  border-color: rgba(138, 210, 174, 0.35);
}

.toast.danger {
  border-color: rgba(214, 124, 124, 0.35);
}

.toast.info {
  border-color: rgba(22, 183, 173, 0.35);
}

@media (max-width: 1100px) {
  .cards, .two-col, .three-col, .row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .shell { width: min(100vw - 20px, 100%); padding-top: 12px; }
  .topbar, .toolbar, .panel-head, .list-card {
    flex-direction: column;
    align-items: stretch;
  }
  .cards, .two-col, .three-col, .row {
    grid-template-columns: 1fr;
  }
  .tabs {
    padding: 12px 16px 0;
  }
  .tab-panel {
    padding: 18px 16px 20px;
  }
  .hero {
    padding: 20px;
  }
  .toast-host {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast {
    width: 100%;
    max-width: none;
  }

  .drawer-panel {
    width: 100%;
  }

  .calendar-month,
  .calendar-week,
  .drawer-meta {
    grid-template-columns: 1fr;
  }
}
