:root {
  --bg: #070a12;
  --panel: rgba(16, 22, 38, 0.88);
  --panel2: rgba(23, 31, 52, 0.92);
  --line: rgba(167, 129, 255, 0.22);
  --line-strong: rgba(190, 164, 255, 0.48);
  --text: #f1edff;
  --muted: #aaa2c8;
  --accent: #a981ff;
  --accent2: #5ee8ff;
  --danger: #ff7c93;
  --ok: #8fffc0;
  --shadow: rgba(0, 0, 0, 0.45);
  --field: rgba(5, 8, 18, 0.55);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #18204a 0, transparent 35%),
              radial-gradient(circle at bottom right, #291a4a 0, transparent 35%),
              var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(94, 232, 255, 0.05), transparent 25%, rgba(169, 129, 255, 0.06)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0, rgba(255,255,255,0.025) 1px, transparent 1px, transparent 120px);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,1), rgba(0,0,0,0.35));
}

.shell {
  width: min(1780px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(10, 14, 28, 0.74);
  box-shadow: 0 16px 40px var(--shadow);
  backdrop-filter: blur(10px);
}

h1, h2, h3 { margin: 0; }

h1 {
  font-size: clamp(26px, 3vw, 44px);
  letter-spacing: 0.03em;
}

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

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.auth-card, .tabs-card, .content-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 18px;
  box-shadow: 0 16px 40px var(--shadow);
  backdrop-filter: blur(12px);
}

.auth-card {
  width: min(460px, 100%);
  margin: 80px auto 0;
  padding: 24px;
}

.auth-card label {
  display: block;
  margin: 18px 0 8px;
  color: #dcd3ff;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input, textarea, select {
  width: 100%;
  color: var(--text);
  background: var(--field);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 11px;
  outline: none;
  font: inherit;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(169, 129, 255, 0.18);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, border-color 0.15s ease;
}

button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.primary-btn {
  margin-top: 20px;
  width: 100%;
  background: linear-gradient(135deg, #7d55ff, #39c9e6);
}

.ghost-btn, .tiny-btn, .add-btn, .delete-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.tiny-btn { padding: 7px 9px; font-size: 12px; }
.add-btn { color: var(--ok); }
.delete-btn { color: var(--danger); padding: 7px 9px; }

.error-line {
  color: var(--danger);
  min-height: 22px;
  margin-top: 12px;
}

.hidden { display: none !important; }

.planner {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  align-items: start;
}

.tabs-card {
  padding: 14px;
  position: sticky;
  top: 16px;
}

.tabs-header, .content-header, .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.class-tabs {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.class-tab {
  text-align: left;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.08);
  color: #dcd5ff;
}

.class-tab.active {
  border-color: var(--line-strong);
  background: linear-gradient(135deg, rgba(169,129,255,0.28), rgba(94,232,255,0.10));
  color: white;
}

.content-card {
  padding: 18px;
  overflow: hidden;
}

.header-actions {
  min-width: min(360px, 45vw);
}

.guide-box {
  margin: 16px 0;
  padding: 13px 14px;
  color: #dfd8ff;
  background: rgba(169, 129, 255, 0.10);
  border: 1px solid rgba(169, 129, 255, 0.20);
  border-radius: 12px;
  line-height: 1.45;
}

.section-card {
  margin-top: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.035);
  border-radius: 16px;
  overflow: hidden;
}

.section-header {
  padding: 14px 14px;
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.section-header p {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1780px;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid rgba(255,255,255,0.08);
  border-right: 1px solid rgba(255,255,255,0.06);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px;
  background: #141a2f;
  color: #d4cbff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 7px;
}

td input, td textarea, td select {
  min-width: 96px;
  background: rgba(2, 4, 12, 0.38);
  border-color: rgba(255,255,255,0.08);
  font-size: 13px;
}

td textarea {
  min-width: 250px;
  min-height: 66px;
}

.meta-cell {
  min-width: 180px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.empty-row {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .planner { grid-template-columns: 1fr; }
  .tabs-card { position: static; }
  .class-tabs { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
  .topbar, .content-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; }
}
