/* Theme colors, typography, and detailed component styling. */
/* Theme variables let one setting change the site colors without rewriting each rule. */
:root,
:root[data-theme="ocean"] {
  --tg-navy: #173d60;
  --tg-navy-dark: #102d48;
  --tg-navy-soft: #e8f2f9;
  --tg-accent: #147b78;
  --tg-accent-dark: #0d605e;
  --tg-line: #d9e5ee;
  --tg-canvas: #f3f7fa;
  --tg-glow: rgba(20, 123, 120, .2);
}
:root {
  --tg-radius: 6px;
  --tg-radius-lg: 8px;
  --tg-text: #1f2c3b;
  --tg-muted: #5b6b7c;
  --tg-shadow: 0 1px 2px rgba(16, 32, 49, .06);
  --tg-font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --tg-font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
}
:root[data-theme="forest"] {
  --tg-navy: #215442;
  --tg-navy-dark: #153e31;
  --tg-navy-soft: #e9f5ef;
  --tg-accent: #a7532e;
  --tg-accent-dark: #864124;
  --tg-line: #d7e8dc;
  --tg-canvas: #f4f8f4;
  --tg-glow: rgba(48, 126, 84, .2);
}
:root[data-theme="plum"] {
  --tg-navy: #593876;
  --tg-navy-dark: #422857;
  --tg-navy-soft: #f1ebf7;
  --tg-accent: #a54670;
  --tg-accent-dark: #823657;
  --tg-line: #e7ddec;
  --tg-canvas: #f8f5fa;
  --tg-glow: rgba(143, 80, 175, .2);
}
:root[data-theme="sunset"] {
  --tg-navy: #91452f;
  --tg-navy-dark: #6d3223;
  --tg-navy-soft: #fff0e9;
  --tg-accent: #9d5b15;
  --tg-accent-dark: #78420d;
  --tg-line: #eedfd5;
  --tg-canvas: #fcf7f2;
  --tg-glow: rgba(196, 98, 61, .2);
}
:root[data-theme="slate"] {
  --tg-navy: #36495f;
  --tg-navy-dark: #263648;
  --tg-navy-soft: #edf2f7;
  --tg-accent: #405f9f;
  --tg-accent-dark: #304b80;
  --tg-line: #dbe3ec;
  --tg-canvas: #f4f6f9;
  --tg-glow: rgba(73, 105, 151, .2);
}

html { scroll-behavior: smooth; }
body { background: var(--tg-canvas); color: var(--tg-text); font-family: var(--tg-font); line-height: 1.55; }
::selection { background: var(--tg-navy-soft); color: var(--tg-navy-dark); }
a { color: var(--tg-navy); }
a:hover { color: var(--tg-accent-dark); }
/* Shared app frame, form controls, and data tables use the selected theme. */
.app-main { background: var(--tg-canvas); }
.app-main > main { width: 100%; max-width: 1600px; margin-inline: auto; }
.side-panel, .side-panel.offcanvas-lg {
  background: var(--tg-navy-dark) !important;
  border-right: 1px solid rgba(255,255,255,.08);
}
.side-brand { min-height: 82px; }
.side-link { border-radius: var(--tg-radius); padding: .6rem .8rem; border-left: 3px solid transparent; transition: background .15s ease, color .15s ease; }
.side-link:hover { background: rgba(255,255,255,.08); }
.side-link.active { border-left-color: var(--tg-accent); box-shadow: none; }
.side-link i, .side-link .fa-solid { width: 1.3rem; text-align: center; }
.topbar { background: var(--tg-navy-dark); min-height: 60px; border-bottom: 1px solid rgba(255,255,255,.1); }
.topbar-user { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--tg-radius); background: rgba(255,255,255,.14); }
.page-header { padding: .3rem 0 1rem; margin-bottom: 1.35rem !important; }
.page-header { border-bottom: 1px solid var(--tg-line); }
.page-header h1 { font-family: var(--tg-font-display); font-weight: 700; font-size: 1.75rem; letter-spacing: -.01em; color: var(--tg-navy-dark); }
.app-card { border: 1px solid var(--tg-line); border-radius: var(--tg-radius-lg); box-shadow: var(--tg-shadow); }
.app-card .card-body { padding: 1.15rem; }
.app-card, .drop-zone, .form-control, .form-select, .btn { transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.btn { border-radius: var(--tg-radius); font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--tg-navy); --bs-btn-border-color: var(--tg-navy); --bs-btn-hover-bg: var(--tg-navy-dark); --bs-btn-hover-border-color: var(--tg-navy-dark); }
.form-control, .form-select { border-color: var(--tg-line); border-radius: var(--tg-radius); min-height: 42px; }
.form-control:focus, .form-select:focus { border-color: var(--tg-accent); box-shadow: 0 0 0 .2rem var(--tg-glow); }
.form-label { color: #2f4054; font-weight: 600; font-size: .88rem; }
.table { --bs-table-bg: transparent; }
.table thead th { color: var(--tg-muted); background: var(--tg-navy-soft); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--tg-line); white-space: nowrap; }
.table td { font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background-color .18s ease; }
.table tbody tr:hover { background: var(--tg-navy-soft); }
.stat-icon { width: 46px; height: 46px; border-radius: var(--tg-radius); }
.stat-big { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.drop-zone { background: var(--tg-navy-soft); border-color: color-mix(in srgb, var(--tg-navy) 34%, white); }
.drop-zone:hover, .drop-zone.drag-over { background: color-mix(in srgb, var(--tg-navy-soft) 82%, white); border-color: var(--tg-accent); }
.progress { border-radius: 999px; background: var(--tg-navy-soft); }
.progress-bar.bg-navy { background-color: var(--tg-navy) !important; }
.alert { border-radius: var(--tg-radius); }
.alert-info { --bs-alert-color: var(--tg-navy-dark); --bs-alert-bg: var(--tg-navy-soft); --bs-alert-border-color: var(--tg-line); }

/* The public sign-in and registration pages use a separate full-page layout. */
.auth-wrap { min-height: 100vh; padding: 2rem; background: var(--tg-canvas); }
.auth-portal { min-height: 100vh; background: var(--tg-canvas); }
.auth-portal-band { position: relative; padding: 1.25rem 2rem 4.5rem; overflow: hidden; color: #fff; background: var(--tg-navy-dark); }
.auth-portal-band::before { content: ""; position: absolute; inset: 0; opacity: .23; background: repeating-linear-gradient(115deg, transparent 0 66px, rgba(255,255,255,.09) 67px 68px, transparent 69px 136px); pointer-events: none; }
.auth-portal-band::after { content: ""; position: absolute; left: 50%; bottom: 0; width: min(760px, 90%); height: 1px; transform: translateX(-50%); background: rgba(255,255,255,.22); }
.auth-portal-nav, .auth-portal-intro { position: relative; z-index: 1; }
.auth-portal-nav { width: min(1120px, 100%); margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.auth-portal-brand { display: inline-flex; align-items: center; gap: .8rem; color: #fff; text-decoration: none; font-size: 1.15rem; font-weight: 760; letter-spacing: -.025em; }
.auth-portal-brand:hover { color: #fff; opacity: .88; }
.auth-portal-brand .brand-logo { width: 38px; height: 38px; padding: 3px; background: #fff; border-radius: 8px; }
.auth-portal-institution { font-size: .78rem; color: rgba(255,255,255,.72); text-align: right; }
.auth-portal-intro { width: min(700px, 100%); margin: 1.8rem auto 0; text-align: center; }
.auth-portal-overline { display: inline-block; padding-bottom: .45rem; border-bottom: 1px solid rgba(255,255,255,.45); font-size: .7rem; font-weight: 760; letter-spacing: .22em; text-transform: uppercase; }
.auth-portal-intro h1 { margin: 1rem auto .6rem; font-family: var(--tg-font-display); font-size: clamp(1.8rem, 3.5vw, 2.5rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.18; }
.auth-portal-intro p { margin: 0; color: rgba(255,255,255,.76); }
.auth-portal-main { position: relative; z-index: 2; padding: 0 1rem 2.5rem; margin-top: -4rem; }
.auth-panel { width: min(100%, 510px); margin: auto; position: relative; padding: 2rem clamp(1.5rem, 4vw, 2.7rem) 1.6rem; border: 1px solid var(--tg-line); border-top: 4px solid var(--tg-accent); border-radius: var(--tg-radius-lg); background: #fff; box-shadow: 0 2px 10px rgba(11, 35, 56, .08); }
.auth-panel-register { width: min(100%, 720px); }
.auth-panel-mark { position: absolute; top: -24px; left: clamp(1.5rem, 4vw, 2.7rem); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 9px; color: #fff; background: var(--tg-accent); box-shadow: 0 7px 18px var(--tg-glow); }
.auth-panel-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: .4rem 0 .55rem; }
.auth-panel-kicker { margin: 0 0 .25rem; color: var(--tg-accent-dark); font-size: .7rem; font-weight: 800; letter-spacing: .16em; }
.auth-panel-heading h2 { margin: 0; color: var(--tg-navy-dark); font-family: var(--tg-font-display); font-size: 1.55rem; font-weight: 700; }
.auth-panel-number { color: #5b6b7c; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.auth-panel-description { margin-bottom: 1.7rem; color: #667789; font-size: .92rem; }
.auth-field { margin-bottom: 1rem; }
.auth-field .form-label { margin-bottom: .3rem; color: #3b4b5e; font-size: .83rem; font-weight: 700; }
.auth-field .input-icon { position: relative; border-bottom: 1px solid #b8c8d7; transition: border-color .18s ease, box-shadow .18s ease; }
.auth-field .input-icon:focus-within { border-bottom: 2px solid var(--tg-accent); }
.auth-field .input-icon > .fa-solid { position: absolute; left: .15rem; top: 50%; transform: translateY(-50%); color: #8193a6; pointer-events: none; }
.auth-field .form-control { min-height: 42px; padding: .4rem 2.4rem .4rem 1.7rem; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.auth-field .form-control:focus { box-shadow: none; }
.auth-field .form-select { min-height: 43px; border: 0; border-bottom: 1px solid #b8c8d7; border-radius: 0; padding-left: .15rem; background-color: transparent; box-shadow: none; }
.auth-field .form-select:focus { border-bottom: 2px solid var(--tg-accent); }
.auth-fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; }
.auth-help { margin: -.55rem 0 1.2rem; color: #667789; font-size: .78rem; }
.auth-submit { width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-top: .3rem; padding: .6rem 1.1rem; border-radius: 7px; }
.auth-panel-switch { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--tg-line); font-size: .87rem; color: #657487; text-align: center; }
.auth-panel-switch a { font-weight: 720; }
.auth-portal-notes { display: flex; justify-content: center; gap: 2rem; padding: 1.4rem 0 0; color: #667789; font-size: .77rem; }
.auth-portal-notes .fa-solid { color: var(--tg-accent); margin-right: .35rem; }
.password-toggle { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: #65788b; padding: .5rem; border-radius: 8px; }
.password-toggle:hover { color: var(--tg-navy); background: var(--tg-navy-soft); }
.landing-shell { width: min(1140px, 100%); }
.landing-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: clamp(2.5rem, 6vw, 5rem); }
.landing-hero { display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: clamp(2rem, 5vw, 5rem); }
.landing-hero h1 { font-family: var(--tg-font-display); font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.12; letter-spacing: -.015em; font-weight: 700; color: var(--tg-navy-dark); }
.landing-hero h1 em { color: var(--tg-navy); font-style: normal; }
.landing-visual { position: relative; padding: 1.5rem; border-radius: var(--tg-radius-lg); background: var(--tg-navy-dark); border-bottom: 4px solid var(--tg-accent); }
.landing-visual .visual-card { position: relative; z-index: 1; padding: 1.2rem; border-radius: var(--tg-radius); background: #fff; }
.landing-visual .visual-step { display: flex; gap: .9rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--tg-line); }
.landing-visual .visual-step:last-child { border: 0; }
.landing-visual .visual-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: var(--tg-radius); color: var(--tg-navy); background: var(--tg-navy-soft); }
.theme-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; }
.theme-option { display: block; cursor: pointer; }
.theme-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-option span { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .75rem .3rem; border: 2px solid var(--tg-line); border-radius: var(--tg-radius); font-size: .78rem; font-weight: 650; transition: border-color .15s, box-shadow .15s; }
.theme-option:hover span { border-color: var(--tg-navy); }
.theme-option input:checked + span { border-color: var(--tg-navy); box-shadow: 0 0 0 3px var(--tg-glow); }
.theme-option input:focus-visible + span { outline: 3px solid var(--tg-accent); outline-offset: 2px; }
.theme-swatch { width: 34px; height: 34px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 3px rgba(255,255,255,.65); }

@keyframes tg-rise { from { opacity: 0; } to { opacity: 1; } }
#page-content > *, .auth-panel, .landing-hero { animation: tg-rise .2s ease both; }

/* Shared components from style.css, dashboard.css and production.css, aligned to the design tokens */
.dash-welcome { background: var(--tg-navy-dark); border-radius: var(--tg-radius-lg); border-bottom: 4px solid var(--tg-accent); }
.dash-metric .metric-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-metric .metric-label, .empty-state { color: var(--tg-muted); }
.report-paper { border-radius: var(--tg-radius-lg); font-family: var(--tg-font-display); }
.report-paper h1 { font-family: var(--tg-font-display); color: var(--tg-navy-dark); }
.report-paper th { color: var(--tg-muted); }
.repo-card { transition: border-color .15s ease; }
.repo-card:hover { transform: none; box-shadow: var(--tg-shadow); border-color: var(--tg-navy); }
.repo-table th { color: var(--tg-muted); font-weight: 700; }
.quick-action:hover .card { border-color: var(--tg-accent); }
.rank-badge, .term-chip { border-radius: var(--tg-radius); }
.term-chip { background: var(--tg-navy-soft); color: var(--tg-navy-dark); border-color: var(--tg-line); }
.sim-progress { border-radius: var(--tg-radius); background: var(--tg-navy-soft); }
.result-card { border-left-width: 4px; }
.compare-header { border-radius: var(--tg-radius); }
.card-list .card, .feature-card, .hero-card { border-radius: var(--tg-radius-lg); }
.hero { background: var(--tg-navy-dark); border-bottom: 4px solid var(--tg-accent); padding: 3.5rem 0; }
.hero h1, .hero .display-5, .hero .display-6 { font-family: var(--tg-font-display); font-weight: 700; letter-spacing: -.01em; }
.hero-card { box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.feature-icon { border-radius: var(--tg-radius); }
.step-number { border-radius: var(--tg-radius); }
.public-nav { background: #fff; }
.public-footer { background: var(--tg-navy-dark); }
.objective-item { border-left-color: var(--tg-accent); }
.auth-wrap { background: var(--tg-canvas); }
.btn:focus-visible, .nav-link:focus-visible, a:focus-visible, .form-control:focus-visible { outline: 3px solid var(--tg-accent); outline-offset: 2px; }
@media (max-width: 767.98px) {
  .auth-wrap { padding: 1rem; }
  .auth-portal-band { padding: 1rem 1rem 5rem; }
  .auth-portal-institution { display: none; }
  .auth-portal-intro { margin-top: 2.2rem; }
  .auth-portal-intro h1 { font-size: 2rem; }
  .auth-portal-main { margin-top: -2.8rem; }
  .auth-panel { padding: 2.25rem 1.4rem 1.5rem; }
  .auth-panel-mark { left: 1.4rem; }
  .auth-fields-grid { grid-template-columns: 1fr; }
  .auth-portal-notes { flex-direction: column; align-items: center; gap: .4rem; }
  .landing-hero { grid-template-columns: 1fr; }
  .landing-visual { order: -1; }
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .app-card, .landing-visual { box-shadow: none !important; }
  #page-content > * { animation: none !important; }
}
