:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #f9fbff;
    --ink: #172033;
    --muted: #667085;
    --line: #dbe3ef;
    --primary: #2f6fed;
    --primary-dark: #2458bd;
    --primary-soft: #e8f0ff;
    --accent: #16a085;
    --warning: #b7791f;
    --danger: #c2410c;
    --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}




input[type="file"] {
    font-size: 16px;
    padding: 6px;
}

/* Style the file-selector button */
input[type="file"]::file-selector-button {
    background-color: #686868;      /* Green button */
    color: rgb(255, 253, 253);
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

/* Hover effect */
input[type="file"]::file-selector-button:hover {
    background-color: #4e4e4e;
}

/* Optional: disable outline when focused */
input[type="file"]:focus {
    outline: none;
}



body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(47, 111, 237, 0.08), transparent 34rem),
        linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

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

button {
    cursor: pointer;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 86px;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #49c6e5);
    color: white;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow);
}

.brand-icon svg,
.section-icon svg,
.icon-btn svg,
.back-to-top svg,
.hint svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-icon svg {
    width: 34px;
    height: 34px;
}

.app-header h1 {
    margin: 0;
    font-size: 1.65rem;
    letter-spacing: -0.04em;
}

.app-header p {
    margin: 0.18rem 0 0;
    color: var(--muted);
}

.header-actions {
    display: flex;
    gap: 0.65rem;
    align-items: center;
}

.layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    min-height: calc(100vh - 86px);
}

.sidebar {
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    padding: 1.25rem;
}

.sidebar-sticky {
    position: sticky;
    top: 104px;
    max-height: calc(100vh - 125px);
    overflow-y: auto;
    padding-right: 0.35rem;
}

.workspace {
    padding: 2rem;
    min-width: 0;
}

.hero-card,
.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 1.6rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
}

.hero-card::after {
    content: "";
    position: absolute;
    right: -4rem;
    top: -4rem;
    width: 14rem;
    height: 14rem;
    background: radial-gradient(circle, rgba(47, 111, 237, 0.14), transparent 65%);
    pointer-events: none;
}

.hero-card h2 {
    font-size: clamp(1.7rem, 3vw, 2.75rem);
    margin: 0.2rem 0 0.7rem;
    letter-spacing: -0.05em;
    line-height: 1.05;
}

.hero-card p {
    color: var(--muted);
    max-width: 56rem;
}

.eyebrow {
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
}

.hero-stat {
    min-width: 150px;
    padding: 1rem;
    background: var(--primary-soft);
    border-radius: 16px;
    text-align: center;
    color: var(--primary-dark);
}

.hero-stat span {
    font-size: 2.4rem;
    font-weight: 800;
    display: block;
}

.hero-stat small {
    color: var(--muted);
}

.card {
    padding: 1.4rem;
    margin-bottom: 1.25rem;
}

.panel {
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: none;
}

.section-title,
.card-heading,
.graph-toolbar,
.selector-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.card-heading.compact {
    margin-top: 1rem;
}

.section-title {
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0.6rem;
}

.section-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
}

.section-icon svg {
    width: 20px;
    height: 20px;
}

h2,
h3 {
    margin: 0;
    letter-spacing: -0.02em;
}

.card h2,
.panel h2 {
    font-size: 1.15rem;
}

h3 {
    font-size: 1rem;
    margin-top: 1.1rem;
    margin-bottom: 0.6rem;
}

.card p,
.panel p {
    color: var(--muted);
    margin: 0.3rem 0 0;
}

label {
    display: block;
    margin-top: 0.85rem;
    margin-bottom: 0.35rem;
    color: #344054;
    font-weight: 650;
    font-size: 0.9rem;
}

input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink);
    border-radius: 12px;
    padding: 0.72rem 0.8rem;
    outline: none;
    transition: 0.16s border-color, 0.16s box-shadow, 0.16s background;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(47, 111, 237, 0.65);
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
    background: white;
}

textarea {
    resize: vertical;
    line-height: 1.55;
}

.file-grid,
.form-grid,
.info-grid,
.two-col {
    display: grid;
    gap: 1rem;
}

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

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

.file-box {
    border: 1px dashed #b9c6da;
    background: var(--surface-2);
    border-radius: 16px;
    padding: 1rem;
    margin: 0;
}

.file-box span {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 750;
}

input[type="file"] {
    width: 100%;
    color: var(--muted);
}

.check-line {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    line-height: 1.35;
}

.check-line input {
    width: auto;
    transform: translateY(1px);
}

.check-line span {
    flex: 1;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.mini-btn,
.icon-btn {
    border: 0;
    border-radius: 12px;
    font-weight: 750;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    transition: 0.16s transform, 0.16s box-shadow, 0.16s background, 0.16s border-color;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), #49a7ff);
    color: white;
    padding: 0.78rem 1.05rem;
    box-shadow: 0 10px 22px rgba(47, 111, 237, 0.24);
}

.primary-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--primary-dark), #2f91ea);
}

.secondary-btn,
.ghost-btn,
.mini-btn {
    background: white;
    color: var(--ink);
    border: 1px solid var(--line);
    padding: 0.7rem 0.9rem;
}

.secondary-btn:hover,
.ghost-btn:hover,
.mini-btn:hover {
    border-color: rgba(47, 111, 237, 0.45);
    background: var(--primary-soft);
}

.small {
    padding: 0.5rem 0.7rem;
    font-size: 0.86rem;
}

.mini-btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
}

.mini-btn.muted {
    color: var(--muted);
}

.button-row,
.mini-actions,
.download-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    margin-top: 1rem;
}

.download-grid a {
    text-decoration: none;
    padding: 0.55rem 0.72rem;
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-radius: 10px;
    font-weight: 750;
    font-size: 0.88rem;
}

.hint {
    position: relative;
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    border: 1px solid #cfd8e6;
    background: #eef2f7;
    color: #667085;
    padding: 5px;
}

.hint:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.hint::after {
    content: attr(data-tip);
    position: absolute;
    right: 0;
    top: 32px;
    z-index: 100;
    width: min(280px, 70vw);
    padding: 0.72rem;
    border-radius: 12px;
    background: #111827;
    color: white;
    box-shadow: var(--shadow);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: 0.14s opacity, 0.14s transform;
}

.hint:hover::after,
.hint:focus::after {
    opacity: 1;
    transform: translateY(0);
}

.selector-header {
    margin-top: 1rem;
}

#odCount {
    margin: 0.2rem 0 0;
    font-size: 0.88rem;
}

.search-input {
    margin-top: 0.75rem;
}

.od-list {
    margin-top: 0.75rem;
    max-height: 330px;
    overflow-y: auto;
    border: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 16px;
    padding: 0.4rem;
}

.od-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.52rem 0.55rem;
    border-radius: 10px;
}

.od-row:hover {
    background: white;
}

.od-row input {
    width: auto;
}

.od-row span {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.muted-text,
.list-note {
    color: var(--muted);
    font-size: 0.88rem;
}

.table-shell {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: white;
    max-height: 520px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.data-table th {
    position: sticky;
    top: 0;
    background: #eef4ff;
    z-index: 1;
    color: #243b67;
    text-align: left;
    font-weight: 800;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 0.58rem 0.65rem;
    white-space: nowrap;
}

.data-table tr:nth-child(even) td {
    background: #fbfdff;
}

.subsection {
    margin-top: 1.25rem;
}

pre {
    white-space: pre-wrap;
    background: #101828;
    color: #e6edf7;
    border-radius: 14px;
    padding: 1rem;
    overflow: auto;
    max-height: 260px;
}

.graph-card {
    overflow: visible;
}

.graph-toolbar {
    margin-bottom: 1rem;
}

.graph-stage {
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem;
    overflow: auto;
    text-align: center;
}

.graph-stage img,
#growthCurveArea img,
#barGraphImg {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.menu-wrap {
    position: relative;
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid var(--line);
    color: var(--muted);
}

.icon-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    stroke: none;
}

.menu-panel {
    display: none;
    position: absolute;
    right: 0;
    top: 48px;
    min-width: 240px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    z-index: 30;
    padding: 0.4rem;
}

.menu-panel.open {
    display: block;
}

.menu-panel button {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.72rem 0.8rem;
    border-radius: 10px;
    color: var(--ink);
}

.menu-panel button:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.text-output {
    background: #fbfdff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem;
    line-height: 1.65;
    color: #26334d;
}

.color-grid {
    margin-top: 0.6rem;
    display: grid;
    gap: 0.45rem;
}

.color-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 0.5rem;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.45rem;
}

.color-row label {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.color-row input[type="color"] {
    width: 52px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
}

.progress-panel {
    position: sticky;
    top: 86px;
    z-index: 45;
    margin: 0;
    padding: 0.75rem 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 25px rgba(23, 32, 51, 0.06);
}

.progress-copy {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.45rem;
}

.progress-copy strong {
    color: var(--ink);
}

.progress-track {
    height: 8px;
    border-radius: 999px;
    background: #e6edf7;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.25s ease;
}

.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow);
    display: none;
    place-items: center;
    z-index: 40;
}

.back-to-top.show {
    display: grid;
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

.footer {
    border-top: 1px solid var(--line);
    background: #0f172a;
    color: #dbeafe;
    padding: 1.2rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer span {
    color: #93a4bc;
    margin-left: 0.6rem;
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: #101828;
    color: white;
    border-radius: 999px;
    padding: 0.72rem 1rem;
    box-shadow: var(--shadow);
    z-index: 100;
}

.hidden {
    display: none !important;
}

@media (max-width: 1040px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-sticky {
        position: static;
        max-height: none;
    }

    .workspace {
        padding: 1rem;
    }

    .main {
        max-width: 100%;
    }
}

@media (max-width: 760px) {
    .app-header,
    .footer,
    .hero-card,
    .section-title,
    .card-heading,
    .graph-toolbar,
    .selector-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions button {
        flex: 1;
    }

    .file-grid,
    .form-grid,
    .info-grid,
    .two-col {
        grid-template-columns: 1fr;
    }
}
