:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-strong: #eef2fa;
  --ink: #252b36;
  --muted: #606877;
  --line: #d8deea;
  --accent: #2a4588;
  --accent-dark: #1f346b;
  --accent-soft: #dfe7f8;
  --brand-red: #8A191B;
  --brand-red-dark: #741216;
  --warn: #9a4d12;
  --warn-bg: #fff4df;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(31, 52, 107, 0.1);
  --header-bg: #fefefe;
  --instructions: #fffccf;
  --lineB: #94a3c4;
  --logo-src: url("logo-dec.png");
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1B1D21;
  --surface: #22252A;
  --surface-strong: #283447;
  --ink: #e2e8f4;
  --muted: #94a3c4;
  --line: #334155;
  --accent: #2a4588;
  --accent-dark: #3b5bab;
  --accent-soft: #1e3160;
  --accent-time: #e2e8f4;
  --brand-red: #8A191B;
  --brand-red-dark: #741216;
  --warn: #c27829;
  --warn-bg: #2d1f07;
  --danger: #e05a50;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.4);
  --header-bg: #22252A;
  --instructions: #44321D;
  --logo-src: url("logo-dec-dark.png");
}


* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-header {
  background: var(--header-bg);
  border-bottom: 4px solid var(--accent);
  padding: 16px clamp(14px, 3vw, 42px);
  transition: background 0.25s ease;
}

.header-inner {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1320px;
  width: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--accent-dark);
  font-family: "Bebas Neue", Arial, Helvetica, sans-serif;
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
  font-weight: 400;
  line-height: 0.95;
  white-space: nowrap;
}

h2 {
  font-size: 1.1rem;
}

.eyebrow {
  color: var(--brand-red);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: flex-start;
  min-width: 0;
  text-align: left;
}

.brand-title {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: center;
}

.department-logo {
  display: block;
  height: clamp(43px, 5.6vw, 67px);
  object-fit: contain;
  width: auto;
}

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

.header-actions {
  flex-shrink: 1;
  justify-content: flex-end;
}

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

.app-shell {
  padding: 0 clamp(14px, 3vw, 42px) 36px;
}

.workspace {
  margin: 18px auto 18px;
  max-width: 1320px;
}

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

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 9px 32px 9px 11px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23606877' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.primary-button,
.secondary-button,
.new-event-button,
.icon-button,
.switch-option {
  align-items: center;
  border-radius: 7px;
  display: inline-flex;
  font-weight: 600;
  font-size: 0.9rem;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
}

.primary-button {
  background: var(--brand-red);
  border: 1px solid var(--brand-red);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-red-dark);
}

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

.new-event-button {
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  color: #fff;
}

.new-event-button:hover {
  background: var(--accent-dark);
  border: 1px solid var(--accent);
  color: var(--surface-strong);
}

.icon-button {
  aspect-ratio: 1;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.25rem;
  min-width: 42px;
  padding: 0;
}

/* ── Botão Backup com dropdown ── */
.backup-dropdown {
  position: relative;
}

.backup-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 52, 107, 0.15);
  display: flex;
  flex-direction: column;
  min-width: 160px;
  overflow: hidden;
  z-index: 10;
}

.backup-menu-item {
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 16px;
  text-align: left;
  width: 100%;
}

.backup-menu-item:hover {
  background: var(--accent-soft);
}

.backup-menu-item+.backup-menu-item {
  border-top: 1px solid var(--line);
}

[data-theme="dark"] .backup-menu {
  background: var(--surface);
}

[data-theme="dark"] .backup-menu-item:hover {
  background: var(--surface-strong);
}



.workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
}

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

.schedule-panel {
  min-height: 570px;
}

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

.section-heading__col {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.section-heading__col:first-child {
  flex-shrink: 0;
}

.section-heading__col:last-child {
  flex: 1;
}

.schedule-area {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.agenda-toolbar {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  padding: 12px 16px;
}

.agenda-toolbar>label {
  flex: 0 1 280px;
  margin-bottom: 0;
}

.agenda-toolbar-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.Instructions-area {
  justify-content: center;
  align-items: center;
  background: var(--instructions);
  border: 1px solid #f0a656;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  color: var(--accent);
  font-size: 0.8rem;
  text-align: center;
}

.contact-link {
  color: var(--accent-dark);
  text-decoration: none;
  white-space: nowrap;
}

.contact-link:hover {
  text-decoration: underline;
}

.contact-link svg {
  margin-right: 3px;
  vertical-align: middle;
}

.contact-sep {
  color: var(--muted);
  margin: 0 6px;
}

.room-filter-name {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: "Bebas Neue", Arial, Helvetica, sans-serif;
  font-size: 2rem;
  color: var(--accent-dark);
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stacked-form,
.dialog-body {
  display: grid;
  gap: 14px;
}

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

.full-width {
  width: 100%;
}

.item-list,
.class-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.room-item,
.class-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 13px;
}

.room-item {
  background: #fbfcff;
}

.class-item {
  background: #fff;
  grid-template-columns: minmax(0, 1fr) auto;
}

.item-title {
  font-weight: 900;
}

.item-meta {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.room-actions {
  justify-content: space-between;
  width: 100%;
}

.room-buttons-right {
  display: flex;
  gap: 8px;
}

.small-button {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 800;
  min-height: 34px;
  padding: 6px 10px;
}

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

.view-switch {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  padding: 3px;
}

.switch-option {
  background: transparent;
  border: 0;
  color: var(--muted);
  min-height: 34px;
  padding: 6px 12px;
}

.switch-option.active {
  background: #fff;
  box-shadow: 0 1px 5px rgba(31, 52, 107, 0.12);
  color: var(--ink);
}

.empty-state {
  align-content: center;
  background: var(--surface-strong);
  border: 1px dashed #b8c8c0;
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 8px;
  min-height: 240px;
  padding: 24px;
  text-align: center;
}

.empty-state h3 {
  color: var(--ink);
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(20, 28, 25, 0.3);
  max-width: min(680px, calc(100vw - 24px));
  padding: 0;
  width: 680px;
}

dialog::backdrop {
  background: rgba(31, 52, 107, 0.42);
}

.dialog-body {
  padding: 20px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

legend {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 0 5px;
}

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

.days-grid label {
  align-items: center;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  display: flex;
  font-size: 0.84rem;
  gap: 6px;
  justify-content: center;
  min-height: 38px;
}

.days-grid input {
  min-height: 0;
  width: auto;
}

.warning {
  background: var(--warn-bg);
  border: 1px solid #f1c987;
  border-radius: 8px;
  color: var(--warn);
  font-size: 0.9rem;
  padding: 10px 12px;
}

.week-grid {
  --week-hour-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: auto repeat(6, minmax(0, 1fr));
  overflow: hidden;
}

.day-header {
  background: var(--accent);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid rgba(255, 255, 255, 0.26);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
  padding: 10px;
  text-align: center;
}

.day-header:nth-child(7) {
  border-right: 0;
}

.time-header {
  background: var(--accent-dark);
}

.day-abbr,
.time-stacked {
  display: none;
}

.time-stacked {
  flex-direction: column;
  line-height: 1.15;
}

.time-slot,
.week-cell {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  height: var(--week-hour-height);
  min-height: var(--week-hour-height);
}

.time-slot {
  align-items: center;
  background: var(--surface-strong);
  color: var(--accent-dark);
  display: flex;
  font-size: 0.88rem;
  font-weight: 900;
  justify-content: center;
  padding: 8px 10px;
  text-align: center;
}

.week-cell {
  align-content: start;
  background: #fff;
  display: grid;
  gap: 5px;
  overflow: visible;
  padding: 2px;
}

.week-cell:nth-child(7n) {
  border-right: 0;
}

.week-entry {
  background: #f8eeee;
  border: 1px solid #cfa2a4;
  border-radius: 6px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc((var(--duration-hours, 1) * var(--week-hour-height)) - 5px);
  padding: 7px 6px;
  position: relative;
  text-align: center;
  width: 100%;
  z-index: 1;
}

.week-entry strong {
  display: block;
  font-size: 0.84rem;
  line-height: 1.15;
}

.week-entry span {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
  line-height: 1.4;
}

.toast {
  background: var(--ink);
  border-radius: 8px;
  bottom: 18px;
  color: #fff;
  left: 50%;
  max-width: min(460px, calc(100vw - 28px));
  padding: 12px 16px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 3;
}

.agenda-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.month-year-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 6px;
}

.month-year-selector select {
  background: transparent;
  border: 0;
  min-height: 34px;
  padding: 0 28px 0 8px;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink);
  width: auto;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23606877' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}

.month-year-selector select:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}

.year-control {
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 1px solid var(--line);
  padding-left: 8px;
  font-size: 0.8rem;
}

.year-control button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-weight: 800;
  padding: 0 6px;
  min-height: 34px;
}

.year-control button:hover {
  color: var(--ink);
}

.year-control span {
  font-weight: 800;
  min-width: 40px;
  text-align: center;
  color: var(--ink);
}

.week-entry.is-event {
  background: #e8f4fd;
  border-color: #7bb5ec;
}

.week-entry.is-event span {
  color: #1f346b;
}

.week-entry.is-group {
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.event-rows-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.event-row-btn {
  background: transparent;
  border: 0;
  width: 100%;
  padding: 6px 4px;
  text-align: center;
  color: var(--ink);
  cursor: pointer;
  border-radius: 4px;
}

.event-row-btn:hover {
  background: rgba(42, 69, 136, 0.08);
}

.event-row-btn strong {
  display: block;
  font-size: 0.8rem;
  line-height: 1.15;
}

.event-row-btn span {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
  line-height: 1.3;
}

.event-row-divider {
  border: 0;
  border-top: 1px dashed #7bb5ec;
  margin: 0;
}

/* ── Grade mensal ── */
.month-grid {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
}

.month-day-header {
  background: var(--accent);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid rgba(255, 255, 255, 0.26);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
  padding: 10px;
  text-align: center;
}

.month-day-header:nth-child(7n) {
  border-right: 0;
}

.month-cell {
  align-content: start;
  background: #fff;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 108px;
  padding: 6px;
}

.month-cell:nth-child(7n) {
  border-right: 0;
}

.month-cell.is-outside {
  background: #f6f7f9;
}

.month-cell.is-outside .month-day-number {
  color: var(--muted);
  opacity: 0.5;
}

.month-day-number {
  align-self: flex-end;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 2px;
}

.month-entry {
  background: #f8eeee;
  border: 1px solid #cfa2a4;
  border-radius: 5px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  text-align: left;
  width: 100%;
}

.month-entry strong {
  font-size: 0.78rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-entry span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
}

.month-entry span::before {
  content: attr(data-full);
}

.month-entry.is-event {
  background: #e8f4fd;
  border-color: #7bb5ec;
}

.month-entry.is-event span {
  color: #1f346b;
}

.room-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  border-top: 1px solid #7bb5ec;
  padding: 2px 0;
  text-align: center;
  font-weight: 700;
}

.class-item.is-event-item {
  border-left: 4px solid var(--accent);
  background: #fcfdfe;
}

/* ── Tooltip flutuante para eventos na grade ── */
.event-tooltip {
  position: fixed;
  background: #1f2937;
  border-radius: 6px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 7px 11px;
  pointer-events: none;
  white-space: pre;
  z-index: 100;
  text-align: center;
}

[data-theme="dark"] .event-tooltip {
  background: #374151;
  color: #e2e8f4;
}

/* ── Card de detalhes mobile ── */
.detail-card {
  position: fixed;
  width: 180px;
  height: 220px;
  border-radius: 8px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  overflow: hidden;
}

.detail-card.is-class {
  background: #f8eeee;
  border: 1px solid #cfa2a4;
  color: var(--ink);
}

.detail-card.is-event {
  background: #e8f4fd;
  border: 1px solid #7bb5ec;
  color: var(--ink);
}

.detail-card-close {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border: none;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
}

.detail-card.is-class .detail-card-close {
  background-color: #E9C9C9;
  color: #7A3F45;
}

.detail-card.is-event .detail-card-close {
  background-color: #B9DDF9;
  color: #3D6499;
}

[data-theme="dark"] .detail-card.is-class .detail-card-close {
  background-color: #4B3439;
  color: #D5AEB2;
}

[data-theme="dark"] .detail-card.is-event .detail-card-close {
  background-color: #284166;
  color: #A1D2F7;
}

.detail-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 8px 8px;
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
  overflow-y: auto;
}

.detail-card-body strong {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.detail-card-edit {
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
  font-size: 0.75rem;
  padding: 6px;
  cursor: pointer;
  text-align: center;
  flex-shrink: 0;
}

.detail-card-edit:hover {
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .detail-card.is-class {
  background: #2d1f22;
  border-color: #7a3f45;
  color: var(--ink);
}

[data-theme="dark"] .detail-card.is-event {
  background: #1a2a42;
  border-color: #3d6499;
  color: var(--ink);
}

[data-theme="dark"] .detail-card-edit {
  border-top-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .detail-card-edit:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ── Informação do usuário no header ── */
.user-info {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s;
}

.user-info:hover {
  color: var(--accent);
}

/* ── Botão Sair ── */
#logoutButton {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s;
}

#logoutButton:hover {
  color: var(--danger);
  filter: brightness(1.4);
}

@media (max-width: 980px) {

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

  .schedule-area {
    order: 0;
  }

  aside.panel {
    order: 1;
  }

}

@media (max-width: 640px) {

  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
    overflow-x: hidden;
  }

  .app-header {
    padding: 16px 10px 2px;
  }

  .header-inner {
    align-items: stretch;
    flex-direction: column;
  }

  .class-item {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions>.theme-toggle-wrapper {
    align-self: center;
  }

  .header-actions>#loginButton {
    width: 100%;
  }

  .header-actions-row {
    display: flex;
    gap: 10px;
    width: 100%;
  }

  .header-actions-row>.backup-dropdown {
    margin-left: auto;
  }

  .panel {
    padding: 12px 10px;
  }

  .user-info,
  #logoutButton {
    font-size: 0.9rem;
  }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .schedule-panel .section-heading {
    gap: 16px;
    position: relative;
  }

  .schedule-panel .section-heading__col:first-child {
    padding-right: 118px;
  }

  .schedule-panel .view-switch {
    position: absolute;
    right: 0;
    top: 6px;
  }

  .section-heading__col:last-child {
    justify-content: space-between;
  }

  .section-heading__col:first-child {
    width: 100%;
  }

  .room-filter-name {
    text-align: left;
    font-size: 1.5rem;
  }

  .agenda-controls {
    flex-shrink: 0;
    gap: 6px;
  }

  .dialog-actions,
  .two-columns {
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    align-items: center;
    justify-content: center;
    text-align: left;
  }

  .brand-title {
    text-align: center;
  }

  .department-logo {
    height: 43px;
  }

  .time-slot {
    font-size: 0.78rem;
    padding: 4px 5px;
  }

  .time-header {
    padding: 10px 5px;
  }

  .week-grid {
    --week-hour-height: 52px;
  }

  .day-header {
    font-weight: 700;
    font-size: 0.75rem;
  }

  .week-entry {
    overflow: hidden;
  }

  .week-entry strong {
    font-size: 0.65em;
    font-weight: 500;
    word-break: break-word;
  }

  .week-entry span {
    display: none;
  }

  .day-full,
  .time-range {
    display: none;
  }

  .day-abbr {
    display: block;
  }

  .time-stacked {
    display: flex;
  }

  .event-row-btn {
    overflow: hidden;
  }

  .event-row-btn strong {
    word-break: break-word;
  }

  .month-cell {
    min-height: 64px;
    padding: 4px;
  }

  .month-day-header {
    font-size: 0.68rem;
    padding: 6px 2px;
  }

  .month-day-number {
    font-size: 0.7rem;
  }

  .month-entry {
    gap: 1px;
    padding: 2px 4px;
  }

  .month-entry strong {
    font-size: 0.62rem;
  }

  .month-entry span {
    font-size: 0.58rem;
  }

  .month-entry span::before {
    content: attr(data-short);
  }

  .agenda-toolbar {
    flex-wrap: wrap;
    overflow-x: hidden;
    padding: 12px 10px;
  }

  .agenda-toolbar>label {
    flex: 1 1 100%;
    min-width: 0;
  }

  .agenda-toolbar-actions {
    margin-left: 0;
    width: 100%;
  }

  aside.panel {
    overflow-x: hidden;
  }

  .app-shell select {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 800px) {

  .header-inner {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .brand-lockup {
    justify-content: center;
  }

  .brand-title {
    text-align: center;
  }

  .header-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}

.agenda-toolbar-actions button {
  flex: 1;
}

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

@media (max-width: 360px) {

  .week-entry strong {
    font-size: 0.5em;
    font-weight: 500;
    word-break: break-word;
  }
}

/* ── Interruptor de tema (claro/escuro) ── */
.theme-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.theme-toggle {
  position: relative;
  width: 46px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  cursor: pointer;
  min-height: 28px;
  transition: background 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  background: var(--line);
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: left 0.25s ease;
}

[data-theme="dark"] .theme-toggle-thumb {
  left: auto;
  right: 3px;
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  transition: color 0.2s;
}

.theme-toggle-icon svg {
  width: 100%;
  height: 100%;
}

.theme-icon-sun {
  color: #F0A615;
  width: 22px;
  height: 22px;
}

.theme-icon-moon {
  color: #AAB0BB;
}

[data-theme="dark"] .theme-icon-sun {
  color: #444A55;
}

[data-theme="dark"] .theme-icon-moon {
  color: #FFFFFF;
}

/* Transições globais para mudança de tema */
body,
.app-header,
.panel,
.agenda-toolbar,
.metric,
.room-item,
.class-item,
.week-grid,
.week-cell,
.time-slot,
.week-entry,
.day-header,
.month-grid,
.month-cell,
.month-day-header,
.month-entry,
dialog,
input,
select,
textarea {
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

/* Inputs e selects em modo escuro */
[data-theme="dark"] input,
[data-theme="dark"] textarea {
  background: var(--surface-strong);
  color: var(--ink);
  border-color: var(--line);
}

[data-theme="dark"] select {
  background-color: var(--surface-strong);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2394a3c4' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  color: var(--ink);
  border-color: var(--line);
}

/* Botão secundário em modo escuro */
[data-theme="dark"] .secondary-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .secondary-button:hover {
  background: var(--surface-strong);
}

/* Links de contato em modo escuro*/
[data-theme="dark"] .contact-link {
  color: var(--ink);
}

/*Área de instruções em modo escuro*/
[data-theme="dark"] .Instructions-area {
  /*background: #252b36;*/
  border: 1px solid #694820;
  color: var(--ink);
}

[data-theme="dark"] .contact-sep {
  color: var(--accent);
}

/* Botão novo evento em modo escuro*/
[data-theme="dark"] .new-event-button:hover {
  background: #1f346b;
  color: var(--ink);
}

/* Pequenos botões em modo escuro */
[data-theme="dark"] .small-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

/* Ícone do botão em modo escuro */
[data-theme="dark"] .icon-button {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--ink);
}

/* Switch de visualização em modo escuro */
[data-theme="dark"] .view-switch {
  background: var(--surface-strong);
  border-color: var(--line);
}

/* Header em modo escuro*/
[data-theme="dark"] h1 {
  color: var(--muted);
}

[data-theme="dark"] .switch-option.active {
  background: var(--surface);
  color: var(--ink);
}

/* Cabeçalhos dos cards em modo escuro*/
[data-theme="dark"] .eyebrow {
  color: var(--danger);
}

/* Semana: células da grade */
[data-theme="dark"] .week-cell {
  background: var(--surface);
}

/* Cards de sala na barra lateral */
[data-theme="dark"] .room-item {
  background: var(--surface);
}

/* Botão Excluir em modo escuro */
[data-theme="dark"] .danger {
  background: var(--surface);
  border-color: var(--line);
  color: var(--danger);
}

/* Semana: aula */
[data-theme="dark"] .week-entry {
  background: #2d1f22;
  border-color: #7a3f45;
  color: var(--ink);
}

/* Semana: rótulo slot de tempo*/
[data-theme="dark"] .time-slot {
  color: var(--muted);
}

/* Semana: evento esporádico */
[data-theme="dark"] .week-entry.is-event {
  background: #1a2a42;
  border-color: #3d6499;
}

[data-theme="dark"] .week-entry.is-event span {
  color: #93bbf0;
}

/* Mês: células da grade */
[data-theme="dark"] .month-cell {
  background: var(--surface);
}

/* Mês: dias fora do mês */
[data-theme="dark"] .month-cell.is-outside {
  background: #20242c;
}

/* Mês: rótulo do dia */
[data-theme="dark"] .month-day-number {
  color: var(--muted);
}

/* Mês: aula */
[data-theme="dark"] .month-entry {
  background: #2d1f22;
  border-color: #7a3f45;
  color: var(--ink);
}

/* Mês: evento esporádico */
[data-theme="dark"] .month-entry.is-event {
  background: #1a2a42;
  border-color: #3d6499;
}

[data-theme="dark"] .month-entry.is-event span {
  color: #93bbf0;
}
}

/* Linha de separação nos eventos agrupados */
[data-theme="dark"] .event-row-divider {
  border-top-color: #3d6499;
}

/* Toast em modo escuro */
[data-theme="dark"] .toast {
  background: var(--surface-strong);
  color: var(--ink);
}

/* Aviso em modo escuro */
[data-theme="dark"] .warning {
  background: var(--warn-bg);
  border-color: #7a5020;
  color: #f0b060;
}

/* Nome da sala em modo escuro */
[data-theme="dark"] .room-filter-name {
  color: var(--muted);
}

/* Empty state */
[data-theme="dark"] .empty-state {
  background: var(--surface-strong);
  border-color: var(--line);
}

/* Scrollbar em modo escuro (Webkit) */
[data-theme="dark"] ::-webkit-scrollbar {
  background: var(--surface);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}