
:root {
  --bg: #eef5f6;
  --bg-soft: #f8fbfb;
  --card: #ffffff;
  --text: #102132;
  --muted: #64748b;
  --line: #dbe6ea;
  --brand: #113b5d;
  --brand-2: #1f7a8c;
  --accent: #f2a950;
  --success: #1c8c64;
  --warning: #ca7a13;
  --danger: #b93838;
  --shadow: 0 24px 60px rgba(17, 59, 93, .12);
  --radius: 24px;
  --radius-sm: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: radial-gradient(circle at top left, rgba(31, 122, 140, .14), transparent 34%),
    linear-gradient(135deg, #eef5f6 0%, #fbf8f0 100%);
}

body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card,
.panel-card,
.modal-card {
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(219, 230, 234, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card {
  width: min(520px, 100%);
  padding: 42px;
  text-align: center;
}

.brand-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 26px;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 900;
  letter-spacing: -.08em;
  font-size: 1.4rem;
  box-shadow: 0 18px 34px rgba(17, 59, 93, .22);
}

.eyebrow {
  color: var(--brand-2);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .72rem;
  font-weight: 800;
  margin: 0 0 8px;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: .98;
  letter-spacing: -.055em;
  margin-bottom: 16px;
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.05;
  letter-spacing: -.04em;
  margin-bottom: 10px;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.auth-copy,
.section-heading p,
.microcopy {
  color: var(--muted);
  line-height: 1.55;
}

.microcopy {
  font-size: .9rem;
}

.full {
  width: 100%;
}

.primary-button,
.ghost-button,
.small-button,
.danger-button,
.icon-button {
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 14px 30px rgba(17, 59, 93, .22);
}

.primary-button:hover,
.ghost-button:hover,
.small-button:hover,
.danger-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

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

.small-button {
  background: #edf7f8;
  color: var(--brand-2);
  min-height: 36px;
  font-size: .9rem;
}

.danger-button {
  background: #fff4f4;
  color: var(--danger);
  border: 1px solid #f3c2c2;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 1.6rem;
  color: var(--brand);
  background: #f4f8f9;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(245,250,250,.78));
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(17, 59, 93, .08);
}

.topbar h1 {
  margin-bottom: 0;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 18px 0;
  padding: 8px;
  background: rgba(255, 255, 255, .65);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tab-button {
  min-height: 48px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.tab-button.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 14px 26px rgba(17, 59, 93, .2);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section-grid,
.hours-layout {
  display: grid;
  gap: 18px;
}

.section-grid {
  grid-template-columns: minmax(320px, 430px) 1fr;
}

.hours-layout {
  grid-template-columns: 290px 1fr;
}

.panel-card {
  padding: 24px;
}

.section-heading.compact {
  margin-bottom: 16px;
}

.form-card {
  position: sticky;
  top: 16px;
  align-self: start;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span,
.toggle-row span,
.effectiveness-box > span {
  color: #244257;
  font-weight: 800;
  font-size: .88rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 16px;
  min-height: 46px;
  padding: 0 14px;
  outline: none;
}

textarea {
  padding-top: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 122, 140, .65);
  box-shadow: 0 0 0 4px rgba(31, 122, 140, .11);
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.inline-heading,
.form-actions,
.modal-actions,
.diary-header,
.hours-toolbar,
.chart-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.inline-heading {
  margin: 10px 0 12px;
}

.schedule-help {
  margin: 0 0 12px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 1.15fr .8fr .75fr 42px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.schedule-row button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid #f0b4b4;
  background: #fff7f7;
  color: var(--danger);
  font-weight: 900;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  min-height: auto;
}

.class-list,
.diary-grid,
.stack-list {
  display: grid;
  gap: 12px;
}

.class-card,
.diary-class-card,
.stack-item,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  padding: 16px;
}

.class-card {
  display: grid;
  gap: 12px;
}

.class-card-header,
.class-card-actions,
.record-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.class-card h3,
.diary-class-card h3,
.stack-item strong {
  margin: 0 0 4px;
}

.schedule-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.schedule-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 850;
  background: #eef7f8;
  color: var(--brand-2);
}

.status-pill.inactive {
  background: #f2f4f6;
  color: var(--muted);
}

.status-pill.done {
  background: #e8f8ef;
  color: var(--success);
}

.status-pill.cancelled {
  background: #fff5e5;
  color: var(--warning);
}

.status-pill.bank {
  background: #f1efff;
  color: #5e4bb6;
}

.empty-state {
  color: var(--muted);
  line-height: 1.5;
}

.diary-header {
  margin-bottom: 18px;
}

.date-field,
.month-field {
  min-width: 190px;
  margin-bottom: 0;
}

.month-picker-field {
  position: relative;
  min-width: 240px;
}

.native-month-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  min-height: 0;
  height: 0;
  padding: 0;
  border: 0;
}

.month-display-button {
  width: 100%;
  min-height: 46px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-weight: 700;
  padding: 0 14px;
}

.month-display-button::after {
  content: "▾";
  color: var(--muted);
  font-size: .88rem;
}

.month-display-button[aria-expanded="true"] {
  border-color: rgba(31, 122, 140, .65);
  box-shadow: 0 0 0 4px rgba(31, 122, 140, .11);
}

.month-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(340px, 92vw);
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 48px rgba(17, 59, 93, .16);
  z-index: 20;
}

.month-picker-grid {
  margin-bottom: 12px;
}

.month-popover .field {
  margin-bottom: 0;
}

.month-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
  font-size: .88rem;
  margin-bottom: 16px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 99px;
  margin-right: 6px;
}

.legend-dot.planned { background: var(--brand-2); }
.legend-dot.muted { background: #a7b4c3; }
.legend-dot.done { background: var(--success); }

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

.diary-class-card {
  text-align: left;
  position: relative;
  border: 1px solid var(--line);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.diary-class-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(17, 59, 93, .12);
}

.diary-class-card.planned {
  border-color: rgba(31, 122, 140, .45);
  background: linear-gradient(135deg, #ffffff, #f0fbfc);
}

.diary-class-card.unplanned {
  color: #6a7787;
  background: #f7f8fa;
}

.diary-class-card.registered {
  border-color: rgba(28, 140, 100, .45);
}

.diary-meta {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
  margin: 8px 0 12px;
}

.hours-content {
  min-width: 0;
}

.stack-item {
  text-align: left;
  width: 100%;
  background: #fff;
  color: var(--text);
}

.stack-item.active {
  border-color: var(--brand-2);
  background: #eff9fa;
  box-shadow: 0 10px 20px rgba(31, 122, 140, .11);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metric-card strong {
  display: block;
  font-size: 1.7rem;
  letter-spacing: -.04em;
  margin-bottom: 4px;
}

.metric-card span {
  color: var(--muted);
  font-weight: 750;
  font-size: .88rem;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  padding: 18px;
}

.chart-fields {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(150px, .8fr) minmax(150px, .8fr);
  gap: 10px;
  align-items: end;
}

.chart-fields .field {
  margin-bottom: 0;
}

canvas {
  width: 100%;
  height: auto;
  margin-top: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdfd, #f5f8f9);
}

.lesson-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(680px, calc(100vw - 24px));
}

.lesson-dialog::backdrop {
  background: rgba(16, 33, 50, .48);
  backdrop-filter: blur(6px);
}

.modal-card {
  padding: 24px;
}

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

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f4f8f9;
  margin-bottom: 18px;
}

.segmented-control label {
  position: relative;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 900;
}

.segmented-control input:checked + span {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 10px 20px rgba(17, 59, 93, .09);
}

.calculated-time,
.effectiveness-box {
  border-radius: 18px;
  background: #f6fafb;
  border: 1px solid var(--line);
  padding: 14px;
  margin-bottom: 16px;
}

.effectiveness-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.effectiveness-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
}

.effectiveness-options input {
  width: 16px;
  height: 16px;
  min-height: auto;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--text);
  color: #fff;
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 20px 38px rgba(16, 33, 50, .24);
  z-index: 50;
  max-width: 360px;
}

.config-warning {
  position: fixed;
  z-index: 100;
  inset: 16px 16px auto 16px;
  background: #fff8e6;
  border: 1px solid #f6d189;
  color: #614108;
  padding: 14px 16px;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(97, 65, 8, .12);
}

@media (max-width: 900px) {
  .section-grid,
  .hours-layout,
  .diary-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .form-card {
    position: static;
  }

  .topbar,
  .diary-header,
  .hours-toolbar,
  .chart-controls,
  .inline-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .form-actions,
  .modal-actions {
    justify-content: stretch;
  }

  .topbar-actions > *,
  .form-actions > *,
  .modal-actions > * {
    width: 100%;
  }

  .tabbar {
    border-radius: 24px;
    grid-template-columns: 1fr;
  }

  .chart-fields {
    grid-template-columns: 1fr;
  }

  .date-field,
  .month-field {
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 10px;
  }

  .auth-card,
  .panel-card,
  .modal-card,
  .topbar {
    padding: 18px;
    border-radius: 22px;
  }

  .two-columns,
  .schedule-row {
    grid-template-columns: 1fr;
  }

  .schedule-row button {
    width: 100%;
  }

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


.agenda-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.agenda-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.native-date-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.agenda-timeline {
  background: #171b29;
  border-radius: 28px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #f8fbff;
}

.agenda-day {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.agenda-day.focus .agenda-date-badge {
  box-shadow: 0 0 0 6px rgba(188, 205, 255, .18);
}

.agenda-date-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 10px;
}

.agenda-weekday,
.agenda-month-label {
  font-size: .9rem;
  font-weight: 800;
  color: #d7deff;
  text-transform: lowercase;
}

.agenda-month-label {
  color: #a6b1da;
  font-size: .8rem;
}

.agenda-date-badge {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #bfcfff;
  color: #101626;
  font-size: 1.85rem;
  font-weight: 900;
  box-shadow: 0 18px 30px rgba(10, 16, 30, .24);
}

.agenda-day-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.agenda-day-content::before {
  content: "";
  position: absolute;
  top: 20px;
  left: -28px;
  width: 20px;
  height: 2px;
  background: rgba(230, 236, 255, .8);
}

.agenda-card,
.agenda-empty-card {
  border: 0;
  border-radius: 26px;
  padding: 18px 20px;
  text-align: left;
  color: #f5fff8;
  background: #5cb680;
  box-shadow: 0 16px 28px rgba(0, 0, 0, .18);
}

.agenda-card {
  width: 100%;
}

.agenda-card.scheduled,
.agenda-card.done,
.agenda-card.compensation,
.agenda-card.reduced {
  background: #4ea978;
}

.agenda-card.extra,
.agenda-card.manual-extra {
  background: #2f80ed;
  color: #fff;
}

.agenda-card.cancelled {
  background: #f59e0b;
  color: #fff;
}

.agenda-empty-card {
  background: #2c3347;
  color: #f3f6ff;
}

.agenda-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.agenda-card-head strong,
.agenda-card-time {
  color: inherit;
}

.agenda-card-head strong {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.06;
}

.agenda-card-time {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  opacity: .95;
}

.agenda-card-note,
.agenda-empty-card span {
  margin: 10px 0 0;
  font-size: .92rem;
  color: rgba(255, 255, 255, .85);
}

.agenda-empty-card strong {
  display: block;
  margin-bottom: 6px;
}

.agenda-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(15, 27, 45, .18);
  color: #fff;
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}

.agenda-status-pill.cancelled {
  background: rgba(255, 255, 255, .12);
}

@media (max-width: 900px) {
  .agenda-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 620px) {
  .agenda-day {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
  }

  .agenda-date-badge {
    width: 52px;
    height: 52px;
    font-size: 1.55rem;
  }

  .agenda-card,
  .agenda-empty-card {
    border-radius: 22px;
    padding: 16px;
  }

  .agenda-day-content::before {
    left: -22px;
    width: 14px;
  }
}


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

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

.message-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  padding: 16px;
}

.message-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--brand);
}

.message-card p {
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.45;
}

.copy-button {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #edf7f8;
  font-size: 1.25rem;
}

.agenda-action-help {
  background: #f6fafb;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}

.agenda-card.rescheduled,
.agenda-card.rescheduled-done {
  background: #64748b;
  color: #fff;
}

.agenda-status-pill.rescheduled,
.agenda-status-pill.rescheduled-done {
  background: rgba(255, 255, 255, .18);
}

@media (min-width: 901px) {
  .app-shell {
    max-width: 1120px;
  }

  .panel-card {
    padding: clamp(22px, 2vw, 28px);
  }
}

@media (max-width: 900px) {
  .messages-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 16px;
  }

  .app-shell {
    width: min(100% - 12px, 1180px);
  }

  .tabbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 24px;
  }

  .tab-button {
    min-height: 54px;
    font-size: .98rem;
  }

  input,
  select,
  textarea {
    min-height: 52px;
    font-size: 1rem;
  }

  .primary-button,
  .ghost-button,
  .small-button,
  .danger-button {
    min-height: 50px;
  }

  .message-card {
    grid-template-columns: 1fr;
  }

  .copy-button {
    width: 100%;
  }
}


.agenda-add-button {
  min-height: 42px;
  padding-inline: 16px;
}

.add-agenda-lesson-dialog .modal-card {
  max-width: 680px;
}

@media (max-width: 620px) {
  .agenda-toolbar {
    display: grid;
    grid-template-columns: 1fr 54px;
    width: 100%;
  }

  .agenda-toolbar .ghost-button,
  .agenda-toolbar .agenda-add-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .agenda-toolbar .icon-button {
    width: 100%;
  }
}


.schedule-start-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbfb;
}

.compact-inline {
  margin-top: 0;
}

.soft-disabled {
  opacity: .62;
}

.agenda-day.today .agenda-date-badge {
  outline: 4px solid #ffffff;
  box-shadow: 0 0 0 8px rgba(242, 169, 80, .65), 0 18px 30px rgba(10, 16, 30, .24);
}

.agenda-day.today .agenda-weekday::after {
  content: " hoje";
  color: #f2d399;
}

.agenda-status-pill.extra,
.agenda-status-pill.manual-extra {
  background: rgba(255, 255, 255, .22);
}

.agenda-status-pill.cancelled {
  background: rgba(255, 255, 255, .22);
}
