:root {
  color-scheme: light;
  --rubi: #A0174B;
  --bordo: #7D1039;
  --ambar: #C9A227;
  --dourado: #E8B84B;
  --carvao: #1A181B;
  --carvao-2: #252126;
  --paper: #FBF8F4;
  --paper-2: #F4EEE6;
  --surface: #FFFFFF;
  --surface-2: #FFF9EE;
  --ink: #241A1E;
  --muted: #6C5D63;
  --line: rgba(36, 26, 30, .12);
  --line-strong: rgba(36, 26, 30, .2);
  --shadow: 0 12px 34px rgba(36, 26, 30, .08);
  --shadow-soft: 0 8px 22px rgba(36, 26, 30, .06);
  --sidebar-bg: linear-gradient(180deg, #FFFFFF, #FFF8EA);
  --sidebar-ink: #241A1E;
  --sidebar-muted: #7B6970;
  --sidebar-line: rgba(36, 26, 30, .12);
  --sidebar-hover: rgba(160, 23, 75, .08);
  --sidebar-action-bg: rgba(255, 255, 255, .72);
  --sidebar-action-border: rgba(36, 26, 30, .12);
  --radius: 8px;
  --sans: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121013;
  --paper-2: #19161A;
  --surface: #201C21;
  --surface-2: #2A2322;
  --ink: #FFFFFF;
  --muted: rgba(255, 255, 255, .86);
  --line: rgba(255, 247, 237, .12);
  --line-strong: rgba(255, 247, 237, .22);
  --shadow: 0 18px 44px rgba(0, 0, 0, .34);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, .24);
  --sidebar-bg: linear-gradient(180deg, #1A181B, #27151F);
  --sidebar-ink: #FFFFFF;
  --sidebar-muted: rgba(255, 255, 255, .82);
  --sidebar-line: rgba(255, 255, 255, .1);
  --sidebar-hover: rgba(255, 255, 255, .08);
  --sidebar-action-bg: rgba(255, 255, 255, .07);
  --sidebar-action-border: rgba(255, 255, 255, .14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(145deg, rgba(26, 24, 27, .94), rgba(125, 16, 57, .86)),
    url("iconmultiplika.png") center / 360px no-repeat;
}

.login-card {
  width: min(100%, 460px);
  background: rgba(255, 255, 255, .96);
  color: #241A1E;
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

.brand-lockup,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup img {
  width: 142px;
  height: auto;
}

.brand-lockup span,
.eyebrow {
  color: var(--rubi);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 28px 0 10px;
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1.12;
}

.login-card p {
  margin: 0 0 24px;
  color: #625258;
}

.login-form {
  display: grid;
  gap: 14px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(160, 23, 75, .55);
  box-shadow: 0 0 0 4px rgba(160, 23, 75, .12);
}

.button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(160, 23, 75, .28);
  box-shadow: var(--shadow-soft);
}

.button.primary {
  background: linear-gradient(135deg, var(--rubi), var(--bordo));
  color: #fff;
}

.button.gold {
  background: linear-gradient(135deg, var(--dourado), var(--ambar));
  color: #241A1E;
}

.button.ghost,
.icon-button {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.button.danger {
  color: #fff;
  background: #9E1F3F;
}

.button.small {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 13px;
}

.icon-button.wide {
  width: 100%;
  justify-content: flex-start;
}

.login-hint {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(160, 23, 75, .18);
  border-radius: 8px;
  background: #FFF8EA;
  color: #625258;
  font-size: 13px;
}

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-weight: 700;
}

.alert.error {
  color: #7C1231;
  background: rgba(160, 23, 75, .1);
  border: 1px solid rgba(160, 23, 75, .24);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 14px;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  border-right: 1px solid var(--sidebar-line);
}

.brand {
  padding: 6px 8px 14px;
  color: var(--sidebar-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand img {
  width: 146px;
}

.brand span {
  font-size: 12px;
  color: var(--sidebar-muted);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--sidebar-muted);
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

.nav button:hover,
.nav button.active {
  color: var(--sidebar-ink);
  background: var(--sidebar-hover);
  border-color: rgba(232, 184, 75, .24);
}

.nav button.active svg {
  color: var(--dourado);
}

.sidebar-actions {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.sidebar-actions .icon-button {
  background: var(--sidebar-action-bg);
  color: var(--sidebar-ink);
  border-color: var(--sidebar-action-border);
}

.sidebar-actions .logout {
  color: var(--sidebar-muted);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

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

.topbar h1 {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.1;
}

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

.user-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.reminder-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.reminder {
  border: 1px solid rgba(201, 162, 39, .34);
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface-2) 82%, var(--dourado)), var(--surface));
  border-radius: 8px;
  padding: 12px;
}

.reminder strong {
  display: block;
  margin-bottom: 3px;
}

.reminder span {
  color: var(--muted);
  font-size: 13px;
}

.app-view {
  min-width: 0;
}

.toolbar,
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .filters {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar label {
  min-width: 170px;
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric b {
  display: block;
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.team-grid,
.discipline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.team-card,
.discipline-card,
.panel,
.calendar-day,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.team-card {
  padding: 16px;
}

.team-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(160, 23, 75, .14), rgba(232, 184, 75, .2));
  color: var(--rubi);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 650;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-card h3,
.discipline-card h3,
.panel h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
}

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

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.chip,
.status-chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.chip .dot,
.day-event .dot,
.lesson-card .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--rubi);
}

.published-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.published-line b {
  font-family: var(--serif);
  font-size: 1.8rem;
}

.badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  border-color: rgba(201, 162, 39, .35);
  background: rgba(232, 184, 75, .14);
  color: color-mix(in srgb, var(--ambar) 65%, var(--ink));
}

.badge.locked {
  opacity: .42;
  filter: grayscale(1);
}

.panel {
  padding: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.discipline-card {
  overflow: hidden;
}

.discipline-band {
  height: 8px;
  background: var(--discipline-color, var(--rubi));
}

.discipline-card-body {
  padding: 15px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.kanban-column {
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 76%, var(--paper));
  padding: 10px;
}

.kanban-column.drag-over {
  outline: 3px solid rgba(232, 184, 75, .34);
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.column-head h3 {
  margin: 0;
  font-size: 14px;
}

.count-pill {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(160, 23, 75, .12);
  color: var(--rubi);
  font-size: 12px;
  font-weight: 900;
}

.lesson-list {
  display: grid;
  gap: 9px;
}

.lesson-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--discipline-color, var(--rubi));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 15px rgba(36, 26, 30, .05);
  cursor: grab;
}

.lesson-card:active {
  cursor: grabbing;
}

.lesson-card h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.lesson-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lesson-card .card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.history-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.history-panel h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 1.15rem;
}

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

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 74%, var(--surface));
}

.history-item strong,
.history-item span,
.history-item time {
  display: block;
}

.history-item span,
.history-item time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

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

.month-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-title {
  min-width: 210px;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.35rem;
}

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

.weekday {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 6px;
}

.calendar-day {
  min-height: 140px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.calendar-day.outside {
  opacity: .48;
}

.calendar-day.today {
  outline: 2px solid rgba(160, 23, 75, .42);
}

.day-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 900;
}

.day-event {
  border: 1px solid var(--line);
  border-left: 4px solid var(--event-color, var(--rubi));
  border-radius: 8px;
  padding: 7px;
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
  font-size: 12px;
}

.day-event strong {
  display: block;
  color: var(--ink);
  line-height: 1.25;
}

.day-event span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.day-event.ghost {
  border-style: dashed;
  opacity: .75;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 14px;
}

.import-layout textarea {
  min-height: 440px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

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

.form-grid .span-2 {
  grid-column: 1 / -1;
}

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

.check-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.check-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-pill:has(input:checked) {
  border-color: rgba(160, 23, 75, .38);
  background: rgba(160, 23, 75, .12);
  color: var(--rubi);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 13, 15, .48);
  backdrop-filter: none;
  pointer-events: none;
}

.modal-root:not([hidden]) {
  display: grid;
  pointer-events: auto;
}

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

.modal-head,
.modal-foot {
  position: sticky;
  background: var(--surface);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.modal-head {
  top: 0;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-family: var(--serif);
}

.modal-body {
  padding: 16px;
}

.modal-foot {
  bottom: 0;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 15px;
  border-radius: 8px;
  background: var(--carvao);
  color: #FFF7ED;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
  font-weight: 700;
}

[data-theme="dark"] .muted,
[data-theme="dark"] .lesson-card .meta,
[data-theme="dark"] .lesson-card .card-footer,
[data-theme="dark"] .day-number,
[data-theme="dark"] .day-event span,
[data-theme="dark"] .history-item span,
[data-theme="dark"] .history-item time,
[data-theme="dark"] .user-pill,
[data-theme="dark"] label {
  color: #FFFFFF;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  color: #FFFFFF;
  background: #18151A;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: rgba(255, 255, 255, .68);
}

.login-card label,
[data-theme="dark"] .login-card label {
  color: #625258;
}

.login-card input,
[data-theme="dark"] .login-card input {
  background: #FFFFFF !important;
  color: #241A1E !important;
  border-color: rgba(36, 26, 30, .14) !important;
}

.login-card input::placeholder,
[data-theme="dark"] .login-card input::placeholder {
  color: #7B6970;
}

.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: 1120px) {
  .kanban-board {
    grid-template-columns: repeat(5, 260px);
  }

  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(100px, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .brand {
    padding-bottom: 10px;
  }

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

  .nav button {
    justify-content: center;
    font-size: 13px;
    padding: 9px;
  }

  .sidebar-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .calendar-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .weekday {
    display: none;
  }

  .calendar-day {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .login-card {
    padding: 22px;
  }

  .nav,
  .sidebar-actions,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .toolbar,
  .calendar-controls,
  .month-switcher {
    width: 100%;
  }

  .topbar-actions > *,
  .toolbar .button,
  .month-switcher .button {
    flex: 1;
  }

  .toolbar label {
    min-width: 100%;
  }

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