:root {
  --green-deep: #062c1e;
  --green-mid: #0b3d2b;
  --green-rich: #11523a;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --glass-dark: rgba(6, 44, 30, 0.56);
  --glass-white-subtle: rgba(255, 255, 255, 0.12);
  --glass-white-card: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(255, 255, 255, 0.22);
  --text-dark: #0f241c;
  --text-muted: #4b6359;
  --text-light: #f3faf7;
  --danger: #dc2626;
  --amber: #d97706;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-mac: 0 24px 60px rgba(2, 18, 12, 0.42), 0 4px 16px rgba(2, 18, 12, 0.2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  color: var(--text-dark);
  background: linear-gradient(145deg, var(--green-deep) 0%, var(--green-mid) 52%, var(--green-rich) 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient macOS Sequoia Orbs */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.45;
}

.orb-1 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #10b981, transparent 70%);
  top: -120px;
  left: -100px;
}

.orb-2 {
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, #176b4c, transparent 70%);
  bottom: -160px;
  right: -120px;
}

.orb-3 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, #34d399, transparent 70%);
  top: 42%;
  left: 55%;
  opacity: 0.2;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 18px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Glass Surfaces */
.glass-dark {
  background: var(--glass-white-subtle);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-mac);
  color: var(--text-light);
}

.glass-light {
  background: var(--glass-white-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow-mac);
}

/* Top Menu Bar */
.top-menubar {
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
}

.menubar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ecfdf5;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
}

.sync-pill.is-saving .sync-dot {
  background: #fbbf24;
  animation: pulse 1s infinite ease-in-out;
}

.sync-pill.is-error .sync-dot {
  background: #f87171;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

/* macOS Window Frame */
.mac-window {
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s ease, opacity 0.25s ease;
}

.window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid rgba(6, 44, 30, 0.08);
  background: rgba(255, 255, 255, 0.45);
}

.window-header.dark-header {
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.traffic-lights {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.traffic-lights .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.window-title {
  font-size: 0.84rem;
  font-weight: 600;
  opacity: 0.85;
  margin-right: auto;
}

.header-hint {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--emerald-dark);
  background: rgba(16, 185, 129, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Auth Card */
.view-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-card {
  max-width: 540px;
  width: 100%;
  margin: 36px auto;
}

.auth-body {
  padding: 36px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.crest-circle {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--green-rich), var(--emerald));
  display: grid;
  place-items: center;
  font-size: 2rem;
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.28);
}

.auth-body h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--green-deep);
}

.auth-desc {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.auth-footnote {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-microsoft {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  background: #0b3d2b;
  color: #ffffff;
  font-size: 0.96rem;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(6, 44, 30, 0.28);
}

.btn-microsoft:hover:not(:disabled) {
  background: #11523a;
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #ffffff;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  font-size: 0.95rem;
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.32);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(16, 185, 129, 0.4);
}

.btn-emerald {
  background: rgba(16, 185, 129, 0.14);
  color: var(--green-mid);
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-weight: 700;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.btn-emerald:hover:not(:disabled) {
  background: var(--emerald);
  color: #ffffff;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--green-mid);
  color: #ffffff;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 14px;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.24);
}

.btn-ghost-dark {
  background: rgba(6, 44, 30, 0.08);
  color: var(--green-deep);
  border-radius: 10px;
  padding: 7px 12px;
  font-weight: 600;
}

.btn-sm {
  font-size: 0.82rem;
  padding: 7px 12px;
}

.btn-lg {
  padding: 14px 26px;
  font-size: 1rem;
}

/* Profile Card */
.verified-chip {
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.24);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
  padding: 4px 10px;
  border-radius: 999px;
}

.profile-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 14px;
}

.profile-field label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.68);
  margin-bottom: 5px;
}

.locked-value {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  word-break: break-word;
}

.locked-value.mono {
  font-variant-numeric: tabular-nums;
}

/* Callouts & Banners */
.callout {
  width: 100%;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.callout-amber {
  background: rgba(255, 251, 235, 0.92);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #78350f;
}

.callout-error {
  background: rgba(254, 226, 226, 0.95);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #991b1b;
  text-align: left;
  font-weight: 600;
}

.callout-success {
  background: rgba(209, 250, 229, 0.95);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #065f46;
  font-weight: 600;
}

.callout-icon {
  font-size: 1.2rem;
  line-height: 1.2;
}

/* Existing Submission Banner */
.submission-status-inner {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.submission-status-inner h3 {
  margin: 6px 0 4px;
  font-size: 1.05rem;
}

.submission-status-inner p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.approved {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.returned {
  background: #fee2e2;
  color: #991b1b;
}

.timestamp-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Calculator */
.card-content {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-toolbar h2 {
  margin: 0 0 4px;
  font-size: 1.22rem;
  color: var(--green-deep);
}

.section-sub {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.subjects-table-head {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1.1fr 0.8fr 1fr 0.6fr;
  gap: 10px;
  padding: 0 12px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.calculator-card.no-nstp .subjects-table-head,
.calculator-card.no-nstp .subject-row {
  grid-template-columns: 2.4fr 1.1fr 1.1fr 0.9fr 0.7fr;
}

.calculator-card.no-nstp .nstp-col-head,
.calculator-card.no-nstp .col-nstp {
  display: none;
}

.subjects-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subject-row {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1.1fr 0.8fr 1fr 0.6fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(6, 44, 30, 0.1);
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.subject-row.is-excluded {
  opacity: 0.62;
  background: rgba(243, 244, 246, 0.7);
  border-style: dashed;
}

.subject-row input[type="text"],
.subject-row input[type="number"],
.subject-row select {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(6, 44, 30, 0.16);
  background: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-dark);
  outline: none;
}

.subject-row input:focus,
.subject-row select:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.subject-row input:disabled {
  background: #f1f5f9;
  color: #64748b;
}

.mobile-label {
  display: none;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.exclude-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  user-select: none;
}

.exclude-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--emerald-dark);
  cursor: pointer;
}

.btn-remove-row {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  border-radius: 10px;
  padding: 9px 10px;
  font-weight: 700;
  font-size: 0.85rem;
}

.btn-remove-row:hover:not(:disabled) {
  background: var(--danger);
  color: #ffffff;
}

/* Calculator Footer & Metrics */
.calculator-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(6, 44, 30, 0.08);
}

.metrics-group {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: wrap;
}

.metric-box {
  background: rgba(6, 44, 30, 0.05);
  border: 1px solid rgba(6, 44, 30, 0.09);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-box.highlight {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
}

.metric-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--green-deep);
  font-variant-numeric: tabular-nums;
}

/* DL Result Banner */
.dl-result-card {
  border-radius: var(--radius-md);
  padding: 20px 22px;
  line-height: 1.55;
  font-size: 0.96rem;
  animation: fadeUp 0.25s ease;
}

.dl-result-card.qualified {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.14));
  border: 1.5px solid rgba(16, 185, 129, 0.55);
  color: #064e3b;
}

.dl-result-card.encouragement {
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.9), rgba(255, 255, 255, 0.85));
  border: 1.5px solid rgba(217, 119, 6, 0.35);
  color: #78350f;
}

.dl-result-card h3 {
  margin: 0 0 6px;
  font-size: 1.12rem;
}

.dl-result-card p {
  margin: 0;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Upload Card */
.upload-card.is-locked {
  opacity: 0.68;
}

.upload-card.is-unlocked {
  border: 1.5px solid rgba(16, 185, 129, 0.7);
  box-shadow: 0 24px 60px rgba(16, 185, 129, 0.25);
}

.lock-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(6, 44, 30, 0.08);
  color: var(--text-muted);
}

.lock-pill.unlocked {
  background: rgba(16, 185, 129, 0.16);
  color: #065f46;
}

.drop-zone {
  border: 2px dashed rgba(11, 61, 43, 0.28);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.drop-zone:hover:not(.disabled),
.drop-zone.drag-over {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.08);
}

.drop-zone.disabled {
  cursor: not-allowed;
  pointer-events: none;
}

.upload-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}

.drop-zone-prompt p {
  margin: 0 0 4px;
  font-size: 0.94rem;
}

.drop-zone-prompt span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-preview-box {
  border-radius: var(--radius-md);
  border: 1px solid rgba(6, 44, 30, 0.14);
  background: #ffffff;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(6, 44, 30, 0.04);
  border-bottom: 1px solid rgba(6, 44, 30, 0.08);
}

.preview-meta {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.preview-meta span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.preview-media {
  padding: 16px;
  display: flex;
  justify-content: center;
  background: #f8fafc;
}

.preview-media img {
  max-width: 100%;
  max-height: 380px;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.preview-media iframe {
  width: 100%;
  height: 380px;
  border: none;
  border-radius: 10px;
}

.submit-actions {
  display: flex;
  justify-content: flex-end;
}

/* Loading Spinner */
.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--green-mid);
  font-weight: 600;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(16, 185, 129, 0.25);
  border-top-color: var(--emerald-dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

[hidden] {
  display: none !important;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .subjects-table-head {
    display: none;
  }

  .subject-row,
  .calculator-card.no-nstp .subject-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .subject-row .col-subject {
    grid-column: 1 / -1;
  }

  .mobile-label {
    display: block;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px 12px 44px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .subject-row,
  .calculator-card.no-nstp .subject-row {
    grid-template-columns: 1fr;
  }

  .auth-body {
    padding: 28px 18px;
  }

  .calculator-footer,
  .submit-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .metrics-group {
    width: 100%;
  }

  .metric-box {
    flex: 1;
  }
}

/* Status badge variants */
.status-badge.returned {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.draft {
  background: #e0f2fe;
  color: #075985;
}

.status-badge.none {
  background: #f1f5f9;
  color: #475569;
}

/* Live Countdown Banner */
.countdown-banner {
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: linear-gradient(135deg, rgba(11, 61, 43, 0.78), rgba(16, 185, 129, 0.22));
}

.countdown-banner.is-urgent {
  border-color: rgba(245, 158, 11, 0.65);
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.78), rgba(217, 119, 6, 0.28));
}

.countdown-banner.is-expired {
  border-color: rgba(239, 68, 68, 0.7);
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.85), rgba(220, 38, 38, 0.3));
}

.countdown-inner {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.countdown-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #ecfdf5;
  margin-bottom: 6px;
}

.countdown-copy h3 {
  margin: 0 0 4px;
  font-size: 1.08rem;
  color: #ffffff;
}

.countdown-copy p {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
}

.countdown-clock {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.clock-unit {
  min-width: 64px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  text-align: center;
  display: flex;
  flex-direction: column;
}

.clock-unit strong {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.clock-unit span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 2px;
}