:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #eef2ff;
  --ink: #172033;
  --muted: #667085;
  --line: #dce3ee;
  --blue: #2563eb;
  --green: #0f9f6e;
  --red: #dc2626;
  --amber: #c47f17;
  --shadow: 0 20px 60px rgba(24, 35, 55, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(15, 159, 110, 0.1), transparent 30%),
    var(--bg);
  color: var(--ink);
}

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

a {
  color: inherit;
}

.app-header {
  padding: 28px clamp(16px, 3vw, 40px) 18px;
}

.topbar,
.layout,
.hero-grid {
  width: min(1440px, 100%);
  margin: 0 auto;
}

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

.topbar h1,
.section-heading h2,
.subject-meta h3,
.dialog-head h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 0.95;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions,
.task-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button,
.button-small,
.icon-button {
  border: 0;
  cursor: pointer;
  text-decoration: none;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  padding: 0 18px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.button-secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.user-pill,
.admin-pill {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 13px;
  font-size: 0.9rem;
  font-weight: 850;
}

.admin-pill {
  border-color: rgba(15, 159, 110, 0.28);
  background: #ecfdf5;
  color: #047857;
}

.button.full {
  width: 100%;
}

.button-small {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  padding: 0 12px;
  font-size: 0.88rem;
  font-weight: 800;
}

.button-muted {
  background: #e7edf5;
  color: var(--ink);
}

.button-danger {
  background: #fee2e2;
  color: #991b1b;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.8fr) repeat(3, minmax(150px, 1fr));
  gap: 14px;
}

.focus-panel,
.stat-card,
.panel,
.subject-row {
  border: 1px solid rgba(220, 227, 238, 0.9);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.focus-panel {
  display: flex;
  min-height: 150px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  border-radius: 8px;
  padding: 22px;
}

.week-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
}

.week-switcher label {
  color: var(--muted);
  font-weight: 700;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

select:focus,
input:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.8);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.focus-copy {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.focus-copy strong,
.stat-card strong {
  font-size: 2.8rem;
  line-height: 1;
}

.focus-copy span,
.stat-card span {
  color: var(--muted);
  font-weight: 700;
}

.stat-card {
  display: grid;
  min-height: 150px;
  align-content: space-between;
  border-radius: 8px;
  padding: 20px;
}

.stat-card strong {
  justify-self: end;
}

.stat-blue {
  border-top: 5px solid var(--blue);
}

.stat-red {
  border-top: 5px solid var(--red);
}

.stat-green {
  border-top: 5px solid var(--green);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  padding: 12px clamp(16px, 3vw, 40px) 44px;
}

.flash-wrap {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 40px) 10px;
}

.flash {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px 14px;
  font-weight: 800;
}

.flash-success {
  border-color: rgba(15, 159, 110, 0.28);
  background: #ecfdf5;
  color: #047857;
}

.flash-warning {
  border-color: rgba(196, 127, 23, 0.32);
  background: #fffbeb;
  color: #92400e;
}

.task-board {
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 16px;
}

.section-heading h2 {
  font-size: 1.65rem;
}

.section-heading.compact {
  align-items: flex-start;
  margin-top: 0;
}

.today-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 800;
}

.subject-list {
  display: grid;
  gap: 12px;
}

.subject-row {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  border-left: 6px solid var(--subject-color);
  border-radius: 8px;
  padding: 14px;
}

.subject-meta {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.subject-meta h3 {
  font-size: 1.05rem;
}

.day-chip {
  width: max-content;
  border-radius: 999px;
  background: #f2f6ff;
  background: color-mix(in srgb, var(--subject-color) 13%, white);
  color: var(--subject-color);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.task-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.empty-task {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 16px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.task-card summary {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
}

.task-card summary::-webkit-details-marker {
  display: none;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--blue);
}

.task-soon .status-dot {
  background: var(--amber);
}

.task-late .status-dot {
  background: var(--red);
}

.task-done .status-dot {
  background: var(--green);
}

.task-title {
  overflow: hidden;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-due {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.task-body {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.task-body p {
  margin: 0;
  color: #344054;
  line-height: 1.55;
}

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

.task-tags span {
  border-radius: 999px;
  background: #edf2f7;
  color: #475467;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 800;
}

.observation {
  border-left: 3px solid #f3c969;
  background: #fff8e1;
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 14px;
  position: sticky;
  top: 14px;
}

.panel {
  border-radius: 8px;
  padding: 18px;
}

.panel-note,
.auth-link {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.task-form,
.subject-form,
.dialog-form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 800;
}

.field-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.task-dialog {
  width: min(760px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.32);
}

.task-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.dialog-form {
  padding: 22px;
}

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

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
}

.user-list {
  display: grid;
  gap: 8px;
}

.mail-test-form {
  margin-top: 14px;
}

.user-row {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 11px 12px;
}

.user-row strong {
  font-size: 0.94rem;
}

.user-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-form {
  margin-top: 8px;
}

.role-form select {
  min-height: 38px;
  padding: 8px 10px;
}

.role-chip {
  display: inline-flex;
  width: max-content;
  align-items: center;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
}

.auth-layout {
  display: grid;
  width: min(980px, 100%);
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: stretch;
}

.auth-copy,
.auth-card {
  border: 1px solid rgba(220, 227, 238, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-copy {
  display: grid;
  align-content: end;
  min-height: 520px;
  padding: clamp(24px, 4vw, 42px);
}

.auth-copy h1 {
  margin: 0 0 16px;
  font-size: clamp(2.5rem, 6vw, 5.2rem);
  line-height: 0.94;
}

.auth-copy p:last-child {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.auth-card {
  display: grid;
  align-content: center;
  padding: 24px;
}

.auth-card .flash {
  margin-bottom: 14px;
}

.auth-link {
  margin: 16px 0 0;
  text-align: center;
}

.auth-link a {
  color: var(--blue);
  font-weight: 900;
}

.site-footer {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 40px) 28px;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.5;
  text-align: center;
}

.auth-page .site-footer {
  width: min(980px, 100%);
  padding: 0;
}

@media (max-width: 1120px) {
  .hero-grid,
  .layout {
    grid-template-columns: 1fr;
  }

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

  .focus-panel {
    grid-column: 1 / -1;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar,
  .focus-panel,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .button {
    flex: 1;
  }

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

  .focus-copy {
    justify-items: start;
    text-align: left;
  }

  .subject-row {
    grid-template-columns: 1fr;
  }

  .task-card summary {
    grid-template-columns: 12px minmax(0, 1fr);
  }

  .task-due {
    grid-column: 2;
  }

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

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: auto;
  }
}
