:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #e6eaf2;
  --shadow: 0 10px 24px rgba(15, 23, 42, .07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 74px;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding-bottom: 90px;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.appbar-inner {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 1080px;
  margin: 0 auto;
  padding-inline: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .20);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand small {
  color: var(--muted);
  font-size: .76rem;
  margin-top: 2px;
}

.icon-btn {
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 1.25rem;
}

.desktop-nav {
  align-items: center;
  gap: 8px;
}

.desktop-nav a,
.mobile-nav a {
  text-decoration: none;
  color: #475569;
  font-weight: 750;
}

.desktop-nav a {
  padding: 9px 13px;
  border-radius: 999px;
}

.desktop-nav a:hover,
.desktop-nav a.active {
  color: var(--primary);
  background: #eef4ff;
}

.mobile-nav {
  display: grid;
  gap: 10px;
}

.mobile-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
}

.mobile-nav a.active {
  color: var(--primary);
  background: #eef4ff;
}

.app-container {
  max-width: 940px;
  padding-top: 12px;
}

.home-container {
  max-width: 620px;
}

.compact-hero,
.mini-header {
  border-radius: 18px;
  padding: 14px 15px;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.compact-hero {
  margin-bottom: 12px;
}

.compact-hero h1,
.mini-header h1 {
  font-size: clamp(1.16rem, 5.4vw, 1.55rem);
  font-weight: 950;
  margin: 0 0 4px;
  line-height: 1.12;
}

.compact-hero p,
.mini-header p {
  color: var(--muted);
  margin: 0;
  font-size: .91rem;
}

.mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mini-header::before,
.compact-hero::before {
  content: "";
  width: 42px;
  height: 4px;
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  margin-bottom: 10px;
}

.mini-header > div,
.compact-hero > div {
  flex: 1;
}

.mini-header .btn {
  border-radius: 13px;
  font-weight: 850;
  white-space: nowrap;
  padding: 8px 10px;
  font-size: .86rem;
}

.mini-badge {
  display: none;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin: 12px 0;
}

.home-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.home-action strong {
  display: block;
  font-weight: 900;
  font-size: 1rem;
}

.home-action small {
  color: var(--muted);
  font-size: .86rem;
}

.info-card,
.app-card {
  border: 1px solid var(--border);
  border-radius: 19px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.info-card {
  margin-top: 12px;
  padding: 15px;
}

.info-card h2,
.feedback-card h2 {
  font-size: 1.02rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.info-card p {
  margin-bottom: 11px;
}

.formula {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 13px;
  padding: 10px;
  font-weight: 800;
  color: #334155;
  font-size: .94rem;
}

.calculator-page {
  display: grid;
  gap: 12px;
}

.input-card,
.result-panel,
.feedback-card {
  padding: 14px;
}

.section-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title h2 {
  font-size: 1.1rem;
  font-weight: 950;
  margin: 0;
}

.section-title p {
  color: var(--muted);
  margin: 2px 0 0;
  font-size: .86rem;
}

.ghost-btn {
  display: none;
}

.notes-expander {
  border: 1px solid var(--border);
  border-radius: 17px;
  background: #fbfdff;
  overflow: hidden;
}

.notes-expander summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 950;
  color: #1e293b;
}

.notes-expander summary::-webkit-details-marker {
  display: none;
}

.notes-expander summary .summary-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notes-expander summary .summary-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eef4ff;
  color: var(--primary);
}

.notes-expander summary .summary-text {
  display: grid;
  gap: 1px;
}

.notes-expander summary small {
  color: var(--muted);
  font-weight: 750;
  font-size: .82rem;
}

.notes-expander summary .chevron {
  color: var(--primary);
  transition: transform .2s ease;
}

.notes-expander[open] summary .chevron {
  transform: rotate(180deg);
}

.notes-expander .grades-list {
  padding: 0 10px 10px;
  border-top: 1px solid var(--border);
  background: #fff;
}

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

.grade-item {
  padding: 9px;
  background: #fbfdff;
  border: 1px solid var(--border);
  border-radius: 15px;
}

.grade-item label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 850;
  font-size: .76rem;
  margin-bottom: 6px;
  color: #334155;
}

.grade-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  padding-inline: 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-weight: 950;
  font-size: .75rem;
}

.grade-item input,
.exam-box input {
  width: 100%;
  border: 1px solid #d9e0ec;
  border-radius: 11px;
  padding: 9px 10px;
  outline: none;
  font-weight: 750;
  background: #fff;
  min-height: 40px;
}

.grade-item input:focus,
.exam-box input:focus {
  border-color: rgba(37, 99, 235, .55);
  box-shadow: 0 0 0 .18rem rgba(37, 99, 235, .10);
}

.exam-box {
  margin-top: 10px;
  padding: 12px;
  border-radius: 17px;
  background: linear-gradient(180deg, #f8fbff, #fff);
  border: 1px solid rgba(37, 99, 235, .15);
}

.exam-box label {
  display: block;
  font-weight: 900;
  margin-bottom: 7px;
  font-size: .95rem;
}

.exam-box small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
  font-size: .82rem;
}

.input-wrap {
  position: relative;
}

.input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
}

.input-wrap input {
  padding-left: 38px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.action-row .btn {
  border-radius: 13px;
  padding: 9px 10px;
  font-weight: 850;
  min-height: 44px;
  font-size: .93rem;
}

.result-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.result-label {
  color: var(--muted);
  font-weight: 800;
  font-size: .86rem;
}

#finalGrade {
  display: block;
  font-size: clamp(2.05rem, 12vw, 3.75rem);
  line-height: .95;
  font-weight: 950;
  letter-spacing: -1px;
}

.result-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 1.25rem;
}

.result-progress {
  height: 10px;
  border-radius: 999px;
  background: #edf1f7;
  margin: 11px 0;
}

.progress-bar {
  border-radius: 999px;
  transition: width .25s ease;
}

.status-badge {
  width: 100%;
  padding: 10px 12px;
  border-radius: 13px;
  font-weight: 900;
  text-align: center;
}

.status-badge.neutral {
  background: #f1f5f9;
  color: #475569;
}

.status-badge.approved {
  background: #dcfce7;
  color: #166534;
}

.status-badge.recovery {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.failed {
  background: #fee2e2;
  color: #991b1b;
}

.live-chart {
  margin-top: 12px;
  padding: 12px;
  border-radius: 17px;
  background: #fbfdff;
  border: 1px solid var(--border);
}

.live-chart h3 {
  font-size: .96rem;
  font-weight: 950;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-row {
  display: grid;
  grid-template-columns: 82px 1fr 50px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.chart-row:last-child {
  margin-bottom: 0;
}

.chart-label {
  color: #475569;
  font-weight: 850;
  font-size: .74rem;
}

.chart-track {
  height: 12px;
  border-radius: 999px;
  background: #edf1f7;
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--primary);
  transition: width .25s ease, background-color .25s ease;
}

.chart-bar.online {
  background: #2563eb;
}

.chart-bar.exam {
  background: #7c3aed;
}

.chart-bar.final {
  background: #64748b;
}

.chart-bar.final.approved {
  background: var(--success);
}

.chart-bar.final.recovery {
  background: var(--warning);
}

.chart-bar.final.failed {
  background: var(--danger);
}

.chart-value {
  text-align: right;
  color: #334155;
  font-weight: 950;
  font-size: .8rem;
}

.chart-help {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-top: 12px;
}

.mini-stat {
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 9px;
  background: #fbfdff;
}

.mini-stat span {
  color: var(--muted);
  font-size: .74rem;
  display: block;
  font-weight: 750;
}

.mini-stat strong {
  font-size: 1.06rem;
  font-weight: 950;
}

.feedback-empty,
.feedback-box {
  border-radius: 15px;
  padding: 12px;
}

.feedback-empty {
  background: #f8fafc;
  color: var(--muted);
  border: 1px dashed #cbd5e1;
}

.feedback-box {
  background: #fbfdff;
  border: 1px solid var(--border);
}

.feedback-box h3 {
  font-size: .98rem;
  font-weight: 950;
  margin-bottom: 6px;
}

.feedback-box p {
  color: #475569;
  margin-bottom: 0;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  height: 74px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .99);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 24px rgba(15, 23, 42, .08);
}

.bottom-nav a {
  color: #64748b;
  text-decoration: none;
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: .72rem;
  font-weight: 850;
  border-radius: 16px;
  padding: 7px 4px;
  transition: background .2s ease, color .2s ease;
}

.bottom-nav i {
  font-size: 1.16rem;
  line-height: 1;
}

.bottom-nav a.active {
  background: linear-gradient(180deg, #eef4ff, #eaf1ff);
  color: var(--primary);
}

@media (max-width: 374px) {
  .grades-list {
    grid-template-columns: 1fr;
  }

  .compact-hero p,
  .mini-header p {
    font-size: .86rem;
  }

  .chart-row {
    grid-template-columns: 74px 1fr 46px;
  }

  .chart-label {
    font-size: .7rem;
  }
}

@media (min-width: 576px) {
  .compact-hero,
  .mini-header,
  .input-card,
  .result-panel,
  .feedback-card,
  .info-card {
    padding: 18px;
  }

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

@media (min-width: 992px) {
  body {
    padding-bottom: 0;
  }

  .app-container {
    padding-top: 22px;
    padding-bottom: 38px;
  }

  .calculator-page {
    grid-template-columns: 1.25fr .75fr;
    align-items: start;
  }

  .mini-header,
  .feedback-card {
    grid-column: 1 / -1;
  }

  .result-panel {
    position: sticky;
    top: 76px;
  }

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

  .bottom-nav {
    display: none;
  }
}


/* Ajustes v5: informações da calculadora dentro da appbar */
.calculator-page {
  padding-top: 10px;
}

.calculator-page .mini-header {
  display: none;
}

.appbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.appbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 900;
  white-space: nowrap;
}

.appbar-pill:hover {
  color: var(--primary-dark);
  background: #e0ebff;
}

.appbar-title-extra {
  display: none;
}

@media (min-width: 390px) {
  .appbar-title-extra {
    display: inline;
  }
}

@media (max-width: 374px) {
  .appbar-pill {
    height: 32px;
    padding: 0 9px;
    font-size: .78rem;
  }
}


/* Ajustes v6: inputs de avaliações mais proporcionais */
.notes-expander .grades-list {
  padding: 10px;
}

.grade-item {
  padding: 8px;
  border-radius: 13px;
  background: #ffffff;
}

.grade-item label {
  font-size: .72rem;
  line-height: 1.15;
  margin-bottom: 5px;
  min-height: 22px;
}

.grade-number {
  min-width: 28px;
  height: 22px;
  padding-inline: 7px;
  font-size: .7rem;
}

.grade-item input {
  min-height: 34px;
  height: 34px;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 800;
}

.grade-item input::placeholder {
  font-size: .82rem;
  font-weight: 700;
}

.grades-list {
  gap: 7px;
}

.exam-box {
  padding: 10px;
  border-radius: 15px;
}

.exam-box label {
  font-size: .9rem;
  margin-bottom: 6px;
}

.exam-box input {
  min-height: 38px;
  height: 38px;
  padding-top: 7px;
  padding-bottom: 7px;
  border-radius: 10px;
  font-size: .92rem;
}

.input-wrap input {
  padding-left: 36px;
}

.input-wrap i {
  left: 11px;
}

.exam-box small {
  font-size: .78rem;
}

@media (min-width: 576px) {
  .grades-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .grades-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}


/* Validação de notas */
.grade-item input.is-invalid,
.exam-box input.is-invalid {
  border-color: var(--danger);
  background: #fff7f7;
  box-shadow: 0 0 0 .18rem rgba(220, 38, 38, .10);
}

.feedback-error {
  border-color: rgba(220, 38, 38, .25);
  background: #fff7f7;
}

.feedback-error h3 {
  color: #991b1b;
}


/* Ajuste v3: campo de nota amigável no mobile */
.grade-item input,
.exam-box input {
  appearance: textfield;
  -moz-appearance: textfield;
}

.grade-item input::-webkit-outer-spin-button,
.grade-item input::-webkit-inner-spin-button,
.exam-box input::-webkit-outer-spin-button,
.exam-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}


/* Máscara de nota da direita para a esquerda */
.grade-item input,
.exam-box input {
  appearance: textfield;
  -moz-appearance: textfield;
}

.grade-item input::-webkit-outer-spin-button,
.grade-item input::-webkit-inner-spin-button,
.exam-box input::-webkit-outer-spin-button,
.exam-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}


/* Segunda nota opcional por Avaliação Online */
.grade-item-header {
  display: grid;
  gap: 6px;
  margin-bottom: 7px;
}

.grade-item-header label {
  margin-bottom: 0;
}

.btn-second-grade {
  width: 100%;
  border: 1px solid #dbeafe;
  background: #eef4ff;
  color: var(--primary);
  border-radius: 10px;
  min-height: 30px;
  padding: 5px 8px;
  font-size: .76rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.btn-second-grade.active {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.grade-input-group {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.grade-input-group small {
  color: var(--muted);
  font-size: .70rem;
  font-weight: 800;
}

.second-grade-area[hidden] {
  display: none;
}

.second-grade-help {
  color: #64748b !important;
  font-size: .68rem !important;
  font-weight: 700 !important;
}

.unit-average-preview {
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  font-size: .73rem;
  font-weight: 800;
  text-align: center;
}

.unit-average-preview strong {
  color: var(--primary);
}

@media (min-width: 576px) {
  .grade-item-header {
    min-height: 62px;
  }
}


/* Refino do layout de segunda nota */
.grade-item {
  display: grid;
  gap: 8px;
}

.grade-item-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.btn-second-grade {
  align-self: flex-start;
  width: auto;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .70rem;
  font-weight: 900;
  gap: 4px;
  line-height: 1;
}

.btn-second-grade i {
  font-size: .78rem;
}

.dual-grade-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.grade-item.has-second-grade .dual-grade-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.grade-primary-area,
.second-grade-area {
  min-width: 0;
}

.grade-input-group {
  margin-top: 0;
}

.grade-input-group small {
  font-size: .69rem;
}

.grade-item input {
  min-height: 36px;
  height: 36px;
}

.second-grade-help {
  margin-top: 2px;
  line-height: 1.25;
}

.unit-average-preview {
  margin-top: 0;
  padding: 6px 8px;
  font-size: .72rem;
}

@media (min-width: 576px) {
  .grade-item-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (max-width: 420px) {
  .grade-item.has-second-grade .dual-grade-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .btn-second-grade {
    font-size: .68rem;
    padding: 2px 8px;
  }
}


/* Ajustes de texto abaixo das duas notas */
.second-grade-help {
  display: block;
  margin-top: 2px;
  color: #64748b !important;
  font-size: .68rem !important;
  font-weight: 700 !important;
  line-height: 1.3;
}

.grade-item.has-second-grade .second-grade-help {
  grid-column: 1 / -1;
}

.unit-average-preview {
  text-align: center;
}


/* Destaque visual para cards com nota vazia */
.empty-note-card {
  border-color: #f59e0b !important;
  background: linear-gradient(180deg, #fffaf0, #ffffff) !important;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, .15);
}

.complete-note-card {
  border-color: #dbeafe !important;
}

/* Remoção do botão calcular e ajuste do bloco de ações */
.action-row.single-action {
  grid-template-columns: 1fr;
}

.auto-calc-note {
  margin-top: 8px;
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}

.auto-calc-note i {
  color: var(--primary);
  margin-right: 4px;
}

/* Feedback com reações */
.reaction-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-weight: 900;
}

.reaction-pill i {
  font-size: .9rem;
}

.reaction-pill small {
  font-size: .72rem;
  font-weight: 900;
  color: inherit;
}

.feedback-empty p,
.feedback-box p {
  margin-bottom: 0;
}


/* Créditos, versão e toast */
.project-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0 4px;
}

.dev-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid var(--border);
  color: #334155;
  font-size: .78rem;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
}

.dev-pill i {
  color: var(--primary);
}

.version-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: .70rem;
  font-weight: 900;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%) translateY(18px);
  z-index: 2000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .94);
  color: #fff;
  font-size: .86rem;
  font-weight: 850;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-toast i {
  color: #86efac;
}

.long-press-pulse {
  animation: longPressPulse .45s ease;
}

@keyframes longPressPulse {
  0% { transform: scale(1); }
  50% { transform: scale(.985); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
  100% { transform: scale(1); }
}

@media (min-width: 992px) {
  .app-toast {
    bottom: 24px;
  }
}


/* Refatoração da navegação - v1.10.0 */
.mobile-nav-shell {
  display: grid;
  gap: 14px;
  min-height: 100%;
}

.mobile-nav-hero {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow);
}

.mobile-nav-hero-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mobile-nav-hero-icon {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .20);
}

.mobile-nav-hero h6 {
  margin: 0;
  font-size: 1rem;
  font-weight: 950;
  color: var(--text);
}

.mobile-nav-hero p {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.4;
}

.mobile-nav-section {
  display: grid;
  gap: 10px;
}

.mobile-nav-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: .82rem;
  font-weight: 950;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.mobile-nav-grid {
  display: grid;
  gap: 10px;
}

.mobile-nav-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
  color: var(--text);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.mobile-nav-card:hover,
.mobile-nav-card:focus {
  transform: translateY(-1px);
  border-color: #cdddfd;
  box-shadow: 0 12px 22px rgba(15, 23, 42, .08);
}

.mobile-nav-card.active {
  background: linear-gradient(180deg, #eef4ff, #f8fbff);
  border-color: #bfd4ff;
  color: var(--primary);
}

.mobile-nav-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #eef4ff;
  color: var(--primary);
  font-size: 1rem;
  flex-shrink: 0;
}

.mobile-nav-card-text {
  min-width: 0;
}

.mobile-nav-card-text strong {
  display: block;
  font-size: .94rem;
  font-weight: 950;
  line-height: 1.2;
  margin-bottom: 2px;
}

.mobile-nav-card-text small {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

.mobile-nav-card-arrow {
  color: #94a3b8;
  font-size: .95rem;
}

.mobile-nav-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.mobile-nav-credit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid var(--border);
  color: #334155;
  font-size: .78rem;
  font-weight: 850;
  text-align: center;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
}

.mobile-nav-credit i {
  color: var(--primary);
}

.mobile-nav-version {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: .70rem;
  font-weight: 900;
}

.mobile-nav-version i {
  color: var(--primary);
}

.offcanvas .offcanvas-body.mobile-nav {
  padding: 14px;
  background: #fbfcff;
}

.offcanvas .offcanvas-header {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .96);
}

.offcanvas .offcanvas-title {
  font-weight: 950;
}

.project-meta {
  display: none !important;
}


/* =========================
   Versão 2.0.0: disciplinas e melhorias
========================= */

.subject-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.subject-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.subject-card h2 {
  font-size: 1.05rem;
  font-weight: 950;
  margin: 0;
}

.subject-card p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: .84rem;
}

.subject-current-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subject-grid {
  display: grid;
  gap: 10px;
}

.subject-field {
  display: grid;
  gap: 5px;
}

.subject-field label {
  color: #334155;
  font-size: .76rem;
  font-weight: 900;
}

.subject-field input,
.subject-field select {
  width: 100%;
  border: 1px solid #d9e0ec;
  border-radius: 12px;
  padding: 10px 11px;
  min-height: 40px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.subject-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.subject-actions .btn {
  border-radius: 13px;
  font-weight: 850;
  min-height: 40px;
}

.subject-actions .btn-save {
  grid-column: 1 / -1;
}

.subject-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
}

.subject-status i {
  color: var(--success);
}

.progress-summary {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fbfdff;
}

.progress-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #475569;
  font-size: .78rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.progress-mini-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: #edf1f7;
}

.progress-mini-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  transition: width .25s ease;
}

.utility-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.utility-actions .btn {
  border-radius: 13px;
  font-weight: 850;
  min-height: 40px;
  font-size: .86rem;
}

.result-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.result-actions .btn {
  border-radius: 13px;
  font-weight: 850;
  min-height: 40px;
}

.feedback-approved {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.feedback-recovery {
  background: #fffbeb;
  border-color: #fde68a;
}

.feedback-failed,
.feedback-impossible,
.feedback-error {
  background: #fff7f7;
  border-color: #fecaca;
}

.feedback-partial {
  background: #eff6ff;
  border-color: #bfdbfe;
}

@media (min-width: 576px) {
  .subject-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .subject-actions .btn-save {
    grid-column: auto;
  }
}


/* =========================
   Versão 2.1.0: desktop wide
========================= */

@media (min-width: 1200px) {
  .app-container {
    max-width: 1440px;
    width: min(1440px, calc(100vw - 64px));
  }

  .calculator-page {
    grid-template-columns: minmax(760px, 1.65fr) minmax(380px, .85fr);
    column-gap: 24px;
    row-gap: 18px;
  }

  .subject-card,
  .input-card {
    grid-column: 1 / 2;
  }

  .result-panel {
    grid-column: 2 / 3;
    grid-row: 1 / span 2;
    top: 86px;
  }

  .feedback-card {
    grid-column: 1 / -1;
  }

  .grades-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  .grade-item {
    min-width: 0;
  }

  .subject-grid {
    grid-template-columns: 1.2fr .8fr;
  }

  .notes-expander .grades-list {
    padding: 14px;
  }

  .input-card,
  .result-panel,
  .feedback-card,
  .subject-card {
    padding: 22px;
  }
}

@media (min-width: 1600px) {
  .app-container {
    max-width: 1680px;
    width: min(1680px, calc(100vw - 96px));
  }

  .calculator-page {
    grid-template-columns: minmax(980px, 1.8fr) minmax(420px, .75fr);
    column-gap: 30px;
  }

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

@media (min-width: 1900px) {
  .app-container {
    max-width: 1840px;
  }

  .calculator-page {
    grid-template-columns: minmax(1120px, 1.9fr) minmax(440px, .7fr);
  }

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

/* =========================
   Versão 2.1.3: disciplinas em modal
========================= */
.home-tools {
  margin: 12px 0;
}

.home-manage-btn,
.subject-toolbar {
  width: 100%;
  border: 1px solid #dbe6ff;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #eef4ff);
  box-shadow: var(--shadow);
}

.home-manage-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  color: var(--text);
  text-align: left;
}

.home-manage-btn strong,
.home-manage-btn small {
  display: block;
}

.home-manage-btn strong {
  font-weight: 950;
}

.home-manage-btn small {
  color: var(--muted);
  font-size: .84rem;
  margin-top: 2px;
}

.subject-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  margin-bottom: 2px;
}

.subject-toolbar span {
  display: block;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 850;
}

.subject-toolbar strong {
  display: block;
  font-size: 1rem;
  font-weight: 950;
  color: var(--text);
  margin-top: 1px;
}

.subject-toolbar .btn {
  border-radius: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.subject-modal-content {
  border: 0;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(15, 23, 42, .22);
}

.subject-modal-header {
  border-bottom: 1px solid var(--border);
  background: #fbfdff;
}

.subject-modal-header h5 {
  font-weight: 950;
}

.subject-modal-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: .86rem;
}

.subject-card-modal {
  border: 0;
  box-shadow: none;
  padding: 0;
}

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

.subject-field-name {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .subject-grid-modal {
    grid-template-columns: .55fr 1fr;
  }
}

@media (max-width: 575px) {
  .subject-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .subject-toolbar .btn {
    width: 100%;
  }
}

@media (min-width: 1200px) {
  .calculator-page .subject-toolbar {
    grid-column: 1 / 2;
  }

  .calculator-page .input-card {
    grid-row: 2 / 3;
  }

  .calculator-page .result-panel {
    grid-row: 1 / span 2;
  }
}
