:root {
    /* Iowa State University palette applied sitewide */
    --color-bg: #0a0f1a;              /* deep neutral background */
    --color-surface: #0e1626;         /* dark panel */
    --color-header: #020617;          /* almost black-blue */
    --color-border: rgba(148, 163, 184, 0.22); /* subtle border */

    /* ISU primary colors */
    --isu-cardinal: #C8102E;  /* Pantone 186 C */
    --isu-gold: #F1BE48;      /* Pantone 142 C */

    /* ISU supporting neutrals */
    --isu-olive: #524727;     /* Pantone 449 C */
    --isu-tan: #9B945F;       /* Pantone 451 C */
    --isu-sand: #CAC7A7;      /* Pantone 454 C */

    /* Semantic accents mapped to ISU */
    --color-accent: var(--isu-cardinal);
    --color-accent-soft: rgba(200, 16, 46, 0.15); /* cardinal soft */
    --color-accent-strong: #7C2529;   /* Pantone 1815 C, deep cardinal */
    --color-gray: #94a3b8;            /* slate-400 */
    --color-text: #e5e7eb;            /* light text */

    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.35);
    --radius-lg: 0.9rem;
    --radius-md: 0.6rem;

    --font-sans: system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    line-height: 1.5;
    background:
      radial-gradient(circle at 20% 0%, rgba(200,16,46,0.18), rgba(200,16,46,0) 35%),
      radial-gradient(circle at 80% 10%, rgba(241,190,72,0.12), rgba(241,190,72,0) 35%),
      linear-gradient(180deg, #0a0f1a, #0b1220);
    background-attachment: fixed;
}

/* subtle holographic grid overlay */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
      linear-gradient(rgba(100,116,139,0.07) 1px, transparent 1px),
      linear-gradient(90deg, rgba(100,116,139,0.07) 1px, transparent 1px);
    background-size: 40px 40px, 40px 40px;
    mix-blend-mode: overlay;
    z-index: 0;
}


header, header * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

a {
    color: var(--color-accent-strong);
    text-decoration: none;
    transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
    color: var(--color-accent);
}

.container {
    width: min(1120px, 100% - 2.5rem);
    margin-inline: auto;
}

main {
    padding-top: 88px;
    padding-bottom: 48px;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: linear-gradient(90deg, #020617 0%, rgba(200,16,46,0.22) 40%, #020617 100%);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.7);
    border-bottom: 1px solid #0f172a;
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: 0.6rem;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    cursor: default;
}

.logo-img {
    height: 40px;
    -webkit-user-drag: none;
    user-drag: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav a {
    position: relative;
    font-size: 0.95rem;
    color: #e5e7eb;
    cursor: pointer;
    letter-spacing: 0.01em;
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -0.3rem;
    width: 0;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--color-accent-soft), var(--color-accent));
    transition: width 0.18s ease-out;
}

.nav a:hover {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(200,16,46,0.45);
}

.nav a:hover::after {
    width: 100%;
}

.nav a.nav-current {
    color: #ffffff;
    font-weight: 600;
}

.nav a.nav-current::after {
    width: 100%;
}

/* Session toggle (header) */
.session-toggle {
    margin-left: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.session-toggle .session-label {
    font-size: 0.85rem;
    color: #cbd5e1;
    cursor: pointer;
}

.switch {
    --switch-width: 46px;
    --switch-height: 24px;
    --switch-padding: 3px;
    --thumb-size: 18px;
    position: relative;
    width: var(--switch-width);
    height: var(--switch-height);
    display: inline-block;
}

.switch input {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.switch-track {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #0b1220, #0b1322);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.switch-track::before {
    content: "";
    position: absolute;
    top: var(--switch-padding);
    left: var(--switch-padding);
    width: var(--thumb-size);
    height: var(--thumb-size);
    background: #e5e7eb;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45), inset 0 -1px 0 rgba(0,0,0,0.15);
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.switch input:checked + .switch-track {
    background: linear-gradient(90deg, rgba(200,16,46,0.22), rgba(200,16,46,0.45));
    border-color: rgba(200,16,46,0.7);
    box-shadow: 0 0 0 2px rgba(200,16,46,0.18);
}

.switch input:checked + .switch-track::before {
    transform: translateX(calc(var(--switch-width) - var(--thumb-size) - var(--switch-padding) * 2));
    background: #ffffff;
}

.switch input:focus-visible + .switch-track {
    outline: none;
    border-color: rgba(200,16,46,0.8);
    box-shadow: 0 0 0 3px rgba(200,16,46,0.28);
}

.switch:hover .switch-track {
    border-color: rgba(148, 163, 184, 0.55);
}

@media (max-width: 680px) {
    header .container {
        flex-direction: column;
        align-items: flex-start;
        padding-block: 0.5rem 0.7rem;
    }

    .nav {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

h1, h2, h3 {
    color: #e5e7eb;
    margin-top: 0;
}

h1 {
    font-size: clamp(1.9rem, 3vw, 2.3rem);
    margin-bottom: 0.4rem;
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 0.35rem;
}

p {
    margin-top: 0.2rem;
    margin-bottom: 0.75rem;
    color: var(--color-gray);
    max-width: 70ch;
}

.section {
    margin: 2.2rem 0;
    padding: 1.4rem 1.6rem;
    border-radius: var(--radius-lg);
    background: rgba(14, 22, 38, 0.85);
    border: 1px solid var(--color-border);
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.55);
}

.section h2 {
    margin-top: 0.1rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    background: rgba(200,16,46,0.14);
    color: #F1BE48;
    padding: 0.12rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.home-hero {
    margin-top: 0.8rem;
    margin-bottom: 1.8rem;
    padding: 1.5rem 1.6rem 1.6rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.08), rgba(15, 23, 42, 0.95));
    color: #e5e7eb;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(200, 16, 46, 0.35);
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr);
    gap: 1.5rem;
}

.home-hero h1 {
    color: #f9fafb;
}

.home-hero p {
    color: #e5e7eb;
}

.home-hero-highlight {
    font-size: 0.9rem;
    color: var(--isu-gold);
}

.hero-stats {
    display: grid;
    gap: 0.6rem;
    align-content: start;
    font-size: 0.85rem;
}

.hero-stat-card {
    background: rgba(15, 23, 42, 0.92);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(55, 65, 81, 0.9);
}

.hero-stat-label {
    color: #9ca3af;
    font-size: 0.75rem;
}

.hero-stat-value {
    color: #f9fafb;
    font-weight: 600;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 1.25rem;
}

.card {
    background: rgba(8, 13, 24, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1.1rem 1.35rem 1.3rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(200, 16, 46, 0.18);
    box-shadow: 0 8px 26px rgba(2, 6, 23, 0.6);
}


.card h2 {
    margin-bottom: 0.4rem;
}

.card p:last-child {
    margin-bottom: 0;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.7rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: rgba(200, 16, 46, 0.08);
    border: 1px solid rgba(200, 16, 46, 0.28);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-accent-strong);
}

.btn-link:hover {
    background: rgba(200, 16, 46, 0.16);
    border-color: rgba(200, 16, 46, 0.5);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 1.2rem;
    border-radius: 999px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #7C2529, #C8102E);
    color: #fff4e5;
    text-shadow: 0 0 10px rgba(200,16,46,0.45);
    box-shadow: 0 6px 16px rgba(200, 16, 46, 0.35), inset 0 0 0 1px rgba(255,255,255,0.08);
    transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, filter 0.08s ease-out;
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 10px 22px rgba(200, 16, 46, 0.5), 0 0 14px rgba(200,16,46,0.25);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 5px 12px rgba(200, 16, 46, 0.35);
}

.table-wrapper {
    margin-top: 1rem;
    overflow-x: auto;
}

/* Dual library layout */
.dual-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
}

@media (min-width: 980px) {
    .dual-grid {
        /* Single-library layout: keep single column at all widths */
        grid-template-columns: 1fr;
    }
}

/* KPI grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.kpi-card {
    border: 1px solid var(--color-border);
    background: linear-gradient(180deg, rgba(2,6,23,0.6), rgba(2,6,23,0.35));
    border-radius: var(--radius-md);
    padding: 0.65rem 0.75rem;
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.45);
}

.kpi-title {
    font-size: 0.78rem;
    color: #cbd5e1;
    margin-bottom: 0.15rem;
}

.kpi-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: #e5e7eb;
}

.kpi-sub {
    font-size: 0.75rem;
    color: var(--color-gray);
}

/* Charts layout */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

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

.chart-card {
    border: 1px solid var(--color-border);
    background: linear-gradient(180deg, rgba(2,6,23,0.6), rgba(2,6,23,0.35));
    border-radius: var(--radius-md);
    padding: 0.6rem 0.75rem 0.9rem;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.5);
    overflow: hidden; /* prevent any canvas growth from affecting layout */
}

.chart-card h4 {
    margin: 0.1rem 0 0.6rem;
    font-size: 0.95rem;
    color: #e5e7eb;
}

.chart-card canvas {
    width: 100% !important;
    display: block; /* avoid inline-canvas baseline spacing issues */
}

/* Diet tabs (browser-like) */
.diet-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
}

.diet-tab {
    appearance: none;
    border: 1px solid var(--color-border);
    background: linear-gradient(180deg, rgba(2,6,23,0.7), rgba(2,6,23,0.45));
    color: var(--color-text);
    padding: 6px 12px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
}

.diet-tab:hover { opacity: 0.9; }

.diet-tab.active {
    background: linear-gradient(180deg, rgba(200,16,46,0.18), rgba(2,6,23,0.6));
    border-color: var(--color-accent-strong);
}

.diet-tab.plus {
    width: 36px;
    text-align: center;
    font-weight: 600;
}

.diet-tab.plus.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: rgba(8, 13, 24, 0.7);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.5);
}

.table thead {
    background: #0b1220;
}

.table th,
.table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    text-align: left;
    vertical-align: top;
}

.table th {
    font-weight: 600;
    font-size: 0.8rem;
    color: #e5e7eb;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr.highlight {
    background: rgba(200, 16, 46, 0.12);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem 1.2rem;
    margin-top: 0.8rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-field label {
    font-size: 0.8rem;
    color: #cbd5e1;
    font-weight: 500;
}

.form-field input,
.form-field select {
    padding: 0.4rem 0.55rem;
    border-radius: 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    font-size: 0.85rem;
    font-family: inherit;
    background: #0b1220;
    color: #e5e7eb;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: rgba(200,16,46,0.7);
    box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.25);
    background: #0d1628;
}

/* Global input/select styling so fields outside .form-field look consistent */
input[type="text"],
input[type="number"],
input[type="file"],
input[type="search"],
input[type="email"],
input[type="password"],
select,
textarea {
    appearance: none;
    padding: 0.4rem 0.55rem;
    border-radius: 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    font-size: 0.9rem;
    font-family: inherit;
    background: #0b1220;
    color: #e5e7eb;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="file"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(200,16,46,0.7);
    box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.25);
    background: #0d1628;
}

input::placeholder,
textarea::placeholder {
    color: rgba(203, 213, 225, 0.6);
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Compact inputs inside tables */
.table input[type="text"],
.table input[type="number"],
.table select, .table textarea {
    width: 100%;
    padding: 0.32rem 0.5rem;
    font-size: 0.84rem;
    background: #081021;
    border-color: rgba(148, 163, 184, 0.26);
}

/* Action buttons cell: keep controls side-by-side with spacing */
.table td.actions-cell {
    display: flex;
    align-items: flex-start; /* align to top when name wraps to multiple lines */
    gap: 0.25rem;
}

/* Icon buttons for actions */
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(8, 13, 24, 0.6);
    color: #cbd5e1;
    transition: transform 0.08s ease-out, background-color 0.12s ease, border-color 0.12s ease;
}
.icon-button:hover {
    transform: translateY(-0.5px);
    background: rgba(8, 13, 24, 0.85);
    border-color: rgba(209, 213, 219, 0.7);
    color: #ffffff;
}
.icon-button .fa-trash-can { color: #e11d48; }
.icon-button:hover .fa-trash-can { color: #f43f5e; }
.icon-button i { pointer-events: none; }

.table input[type="text"]:focus,
.table input[type="number"]:focus,
.table select:focus,
.table textarea:focus {
    background: #0c162a;
}

/* Diet tab rename input refine */
#diet-tab-name-input {
    min-width: 180px;
    background: #0b1220;
    border: 1px solid rgba(148, 163, 184, 0.28);
}

/* File input tweaks */
input[type="file"] {
    padding: 0.3rem;
    background: transparent;
}

.muted {
    color: #94a3b8;
    font-size: 0.85rem;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8rem;
    background: rgba(2, 6, 23, 0.6);
    padding: 0.12rem 0.3rem;
    border-radius: 0.3rem;
    border: 1px solid rgba(148,163,184,0.2);
}

.icon-button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    color: #6b7280;
}

.icon-button:hover {
    color: #b91c1c;
    transform: translateY(-0.5px);
}

.diet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.diet-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 0%, rgba(15,23,42,0.8), rgba(15,23,42,0.55) 40%, rgba(15,23,42,0.8));
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-backdrop.open {
    display: flex;
}

.modal-panel {
    background: #020617;
    color: #e5e7eb;
    padding: 1.5rem 1.6rem;
    border-radius: 0.9rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.45);
}

.modal-panel.modal-panel-wide {
    max-width: 720px;
    max-height: 80vh;
    overflow: auto;
}

.modal-panel h3 {
    margin-top: 0;
    margin-bottom: 0.4rem;
    color: #e5e7eb;
}

.modal-panel p {
    color: #cbd5f5;
    max-width: none;
}

.modal-actions {
    margin-top: 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-panel .form-field input,
.modal-panel .form-field select {
    background: #020617;
    color: #e5e7eb;
    border-color: rgba(148, 163, 184, 0.8);
}

.modal-panel .form-field input::placeholder,
.modal-panel .form-field select::placeholder {
    color: #6b7280;
}

.modal-panel .form-field input:focus,
.modal-panel .form-field select:focus {
    background: #020617;
}

.modal-panel .table {
    background: #020617;
    box-shadow: none;
}

.modal-panel .table thead {
    background: #020617;
    border-bottom: 1px solid rgba(148, 163, 184, 0.6);
}

.modal-panel .table th {
    color: #e5e7eb;
    border-bottom-color: rgba(148, 163, 184, 0.6);
}

.modal-panel .table td {
    border-bottom-color: rgba(30, 64, 175, 0.5);
    color: #e5e7eb;
}

.modal-panel .table tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.7);
}

.modal-panel .table input[type="number"] {
    width: 100%;
    padding: 0.25rem 0.4rem;
    font-size: 0.78rem;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.85);
    color: #e5e7eb;
    transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.08s ease-out;
}

.btn-secondary:hover {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(209, 213, 219, 0.9);
    transform: translateY(-0.5px);
}

.btn-secondary:active {
    transform: translateY(0);
}

#formulate-status {
    font-size: 0.78rem;
    color: #4b5563;
}

.modal-panel .muted {
    font-size: 0.8rem;
}

.modal-panel.modal-panel-wide::-webkit-scrollbar {
    width: 6px;
}
.modal-panel.modal-panel-wide::-webkit-scrollbar-track {
    background: #020617;
}
.modal-panel.modal-panel-wide::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.7);
    border-radius: 999px;
}


/* ---- Layout fixes for Programs (cards/sections/modals) ---- */
/* Constrain sections so inner card shadows and grids don't visually bleed */
.section {
  position: relative;
  overflow: clip; /* prevents card shadows/content from extending outside */
}

/* Ensure cards never overflow their grid/section container */
.card {
  max-width: 100%;
  min-width: 0;
}
.home-grid > .card,
.dual-grid > .card {
  min-width: 0; /* allow cards to shrink within grid tracks */
}

/* Grids inside cards should not overflow horizontally */
.form-grid,
.table-wrapper {
  max-width: 100%;
}

/* Tame very long words/codes in labels and table cells */
.card, .section, .table, .modal-panel {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Modal improvements: allow scrolling within viewport and backdrop */
.modal-backdrop {
  overflow: auto;          /* enable page scroll when content is tall */
  padding: 1rem;           /* keep panel off the very edge on small screens */
}

.modal-panel {
  max-width: min(900px, 92vw);  /* roomier default, responsive */
  max-height: min(85vh, 100%);  /* contain content within viewport */
  overflow: auto;               /* scroll inside the panel if needed */
  box-sizing: border-box;
}

/* Wide panel variant keeps same height constraints but may be wider */
.modal-panel.modal-panel-wide {
  max-width: min(1100px, 96vw);
  max-height: min(85vh, 100%);
  overflow: auto;
}

/* Inputs/selects within modals should not force overflow */
.modal-panel .form-field,
.modal-panel .form-field > * {
  min-width: 0;
  max-width: 100%;
}

/* Ensure selects stretch and remain inside panel */
.modal-panel select,
.modal-panel input[type="text"],
.modal-panel input[type="number"],
.modal-panel input[type="search"],
.modal-panel textarea {
  width: 100%;
}

/* Tables inside modals/cards should be fully scrollable within container */
.modal-panel .table-wrapper,
.card .table-wrapper {
  overflow: auto;
  max-width: 100%;
}


/* ---- Global footer styles ---- */
.site-footer {
  position: relative;
  margin-top: 2rem;
  background: linear-gradient(90deg, #020617 0%, #0b1220 50%, #020617 100%);
  border-top: 1px solid #0f172a;
  box-shadow: 0 -6px 18px rgba(2, 6, 23, 0.55);
}
.site-footer .footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 1rem 0; /* container handles horizontal padding */
  flex-wrap: wrap;
}
.site-footer .footer-credits {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--color-gray);
}
.site-footer .footer-credits .dev-by strong {
  color: #e5e7eb;
}
.site-footer .footer-credits .footer-meta .sep {
  margin: 0 0.4rem;
  color: rgba(148,163,184,0.7);
}
.site-footer .footer-logos {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}
.site-footer .footer-logo img {
  display: block;
  height: 36px;
  width: auto;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.site-footer .footer-logo.pdf-logo object {
  display: block;
  height: 38px; /* slightly taller for visual balance */
  width: auto; /* browser will size proportionally when possible */
  border: none;
  background: transparent;
}
.site-footer a.footer-logo:hover img {
  filter: drop-shadow(0 2px 6px rgba(200,16,46,0.45));
}
@media (max-width: 640px) {
  .site-footer .footer-inner { align-items: flex-start; }
  .site-footer .footer-logos { margin-left: auto; }
}


/* ---- Footer info panels (disclaimer/acknowledgement/contributors) ---- */
.site-footer .footer-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
  flex: 1 1 0;
  min-width: 0;
}
.site-footer .footer-block {
  background: linear-gradient(180deg, rgba(2,6,23,0.6), rgba(2,6,23,0.35));
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 0.65rem;
  padding: 0.75rem 0.9rem;
  box-shadow: 0 6px 16px rgba(2,6,23,0.45);
}
.site-footer .footer-block-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #e5e7eb;
  margin-bottom: 0.35rem;
  position: relative;
}
.site-footer .footer-block-title::after {
  content: "";
  position: absolute;
  left: 0; bottom: -0.25rem;
  width: 44px; height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(200,16,46,0.2), rgba(200,16,46,0.7));
}
.site-footer .footer-block p {
  margin: 0.5rem 0 0;
  color: var(--color-gray);
  font-size: 0.9rem;
}
.site-footer .footer-block a {
  color: var(--color-accent);
}
.site-footer .footer-block a:hover {
  color: var(--color-accent-strong);
  text-shadow: 0 0 6px rgba(200,16,46,0.35);
}
@media (max-width: 640px) {
  .site-footer .footer-info { gap: 0.75rem; }
}


/* --- Footer visual refinements (v2) --- */
.site-footer::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(200,16,46,0), rgba(200,16,46,0.8), rgba(200,16,46,0));
  box-shadow: 0 0 12px rgba(200,16,46,0.35);
}
.site-footer .footer-inner {
  padding: 1.2rem 0 1.4rem;
}
.site-footer .footer-block {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease-out;
}
.site-footer .footer-block:hover {
  border-color: rgba(200,16,46,0.5);
  box-shadow: 0 8px 20px rgba(2,6,23,0.65), 0 0 12px rgba(200,16,46,0.15) inset;
  transform: translateY(-1px);
}
.site-footer .footer-block-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
}
.site-footer .footer-block-title .footer-icon {
  color: var(--color-accent);
  text-shadow: 0 0 8px rgba(200,16,46,0.35);
}
.site-footer .footer-block p { line-height: 1.6; }
.footer-list {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
}
.footer-list li {
  position: relative;
  margin: 0.25rem 0;
  padding-left: 1.1rem;
  color: var(--color-gray);
}
.footer-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.65em;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--color-accent);
  box-shadow: 0 0 10px rgba(200,16,46,0.45);
}


/* --- Footer brand (SAIL logo) and layout adjustments --- */
.site-footer .footer-brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex: 0 0 auto; /* prevent brand from stealing space from info and overlapping */
}
.site-footer .footer-brand-img {
  display: block;
  height: 96px;
  width: auto;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
/* Allow wrapping on medium screens; enforce single-row only on very wide screens */
@media (min-width: 1280px) {
  .site-footer .footer-inner { flex-wrap: nowrap; }
  .site-footer .footer-info { grid-template-columns: repeat(3, 1fr); }
  .site-footer .footer-brand-img { height: 120px; }
}


/* Ensure footer children can shrink on one line without overflowing */
.site-footer .footer-inner > * { min-width: 0; }

/** Footer container full-width override (edge-to-edge) **/
.site-footer .container {
  width: 100%;
  max-width: none;
  margin-inline: 0; /* remove centered constraint for footer only */
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
@media (min-width: 1024px) {
  .site-footer .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}


/* --- Header container full-width override (edge-to-edge) --- */
header .container {
  width: 100%;
  max-width: none;
  margin-inline: 0; /* remove centered constraint for header only */
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
@media (min-width: 1024px) {
  header .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}
