:root {
  --bg: #0f172a;
  --panel: rgba(15, 23, 42, 0.76);
  --panel-strong: rgba(30, 41, 59, 0.98);
  --line: rgba(148, 163, 184, 0.22);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --brand: #8b5cf6;
  --brand-2: #06b6d4;
  --danger: #f97316;
  --success: #22c55e;
  --cell: rgba(15, 23, 42, 0.66);
  --cell-hover: rgba(51, 65, 85, 0.86);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.26), transparent 34rem),
    radial-gradient(circle at top right, rgba(6, 182, 212, 0.2), transparent 30rem),
    var(--bg);
}

button, textarea, input { font: inherit; }

.app-header {
  width: min(1480px, calc(100% - 32px));
  margin: 24px auto 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.72));
  box-shadow: var(--shadow);
}

h1, h2, p { margin: 0; }

h1 { font-size: clamp(28px, 4vw, 48px); letter-spacing: -0.05em; line-height: 0.95; }
h2 { font-size: 24px; letter-spacing: -0.03em; }

.eyebrow {
  color: #67e8f9;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.subtext { color: var(--muted); margin-top: 10px; font-size: 15px; }

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

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

.notice, .status-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: rgba(15, 23, 42, 0.78);
  color: var(--soft);
}

.status-box.error { border-color: rgba(248, 113, 113, 0.55); color: #fecaca; }
.status-box.success { border-color: rgba(34, 197, 94, 0.55); color: #bbf7d0; }

.calendar-wrap {
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.62);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 220px);
}

.calendar-grid {
  min-width: 1080px;
  display: grid;
  grid-template-columns: 86px repeat(7, minmax(140px, 1fr));
}

.grid-cell, .time-cell, .day-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.time-cell, .day-cell {
  background: rgba(15, 23, 42, 0.95);
  position: sticky;
  z-index: 3;
}

.corner-cell {
  left: 0;
  top: 0;
  z-index: 6;
}

.day-cell {
  top: 0;
  min-height: 72px;
  padding: 14px;
}

.day-name { font-weight: 800; font-size: 14px; }
.day-date { color: var(--muted); font-size: 12px; margin-top: 4px; }

.time-cell {
  left: 0;
  min-height: 116px;
  padding: 14px 10px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.grid-cell {
  min-height: 116px;
  padding: 10px;
  background: var(--cell);
  transition: background 0.15s ease;
}

.grid-cell:hover { background: var(--cell-hover); }

.add-note-btn {
  width: 100%;
  border: 1px dashed rgba(148, 163, 184, 0.42);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.3);
  color: var(--muted);
  cursor: pointer;
  padding: 8px 10px;
  text-align: center;
}

.add-note-btn:hover {
  color: white;
  border-color: rgba(103, 232, 249, 0.8);
  background: rgba(6, 182, 212, 0.1);
}

.notes-list { display: grid; gap: 8px; margin-top: 8px; }

.note-card {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.note-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.35;
  font-size: 13px;
  color: #f8fafc;
}

.note-time {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.primary-btn, .secondary-btn, .icon-btn {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  padding: 12px 16px;
}

.secondary-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  padding: 11px 14px;
}

.primary-btn:disabled, .secondary-btn:disabled { opacity: 0.56; cursor: not-allowed; }

.icon-btn {
  width: 38px;
  height: 38px;
  font-size: 28px;
  line-height: 1;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.note-dialog {
  width: min(540px, calc(100% - 30px));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0;
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--shadow);
}

.note-dialog::backdrop { background: rgba(2, 6, 23, 0.72); backdrop-filter: blur(4px); }

.note-form { padding: 20px; }
.dialog-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.field-label { display: block; margin-bottom: 8px; font-weight: 800; }

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.38);
  color: var(--text);
  padding: 12px;
  outline: none;
}

textarea:focus { border-color: rgba(103, 232, 249, 0.78); }
.field-help { margin-top: 7px; color: var(--muted); font-size: 12px; }
.turnstile-box { margin-top: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.hp-field {
  position: absolute;
  left: -99999px;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .app-header { align-items: flex-start; flex-direction: column; padding: 20px; }
  .shell, .app-header { width: min(100% - 20px, 1480px); }
  .calendar-wrap { max-height: calc(100vh - 260px); }
}
