:root {
    --bg-top: #f3efe4;
    --bg-bottom: #d7e7e2;
    --card: rgba(255, 252, 247, 0.92);
    --ink: #1f2937;
    --muted: #5b6472;
    --line: #d6d6ce;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --error-bg: #fff1f2;
    --error-line: #ef4444;
    --dialysis: #dbeafe;
    --icu: #fee2e2;
    --surgery: #ede9fe;
    --ward: #dcfce7;
    --outpatient: #fef3c7;
    --shadow: 0 20px 60px rgba(31, 41, 55, 0.12);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 32%),
        linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
    min-height: 100vh;
}

code {
    font-family: "SFMono-Regular", Consolas, monospace;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.hero-card,
.plan-card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero-card {
    padding: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    color: var(--accent-dark);
    font-weight: 700;
}

h1,
h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.02em;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
}

h2 {
    font-size: 1.7rem;
}

.lead {
    margin: 16px 0 0;
    max-width: 780px;
    color: var(--muted);
    line-height: 1.7;
}

.notice-box,
.error-box {
    margin-top: 20px;
    padding: 16px 18px;
    border-radius: 18px;
}

.notice-box {
    background: rgba(15, 118, 110, 0.08);
    border: 1px solid rgba(15, 118, 110, 0.12);
}

.notice-box p,
.error-box p {
    margin: 4px 0;
}

.error-box {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-left: 6px solid var(--error-line);
}

.generator-form {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.generator-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
}

.generator-form span {
    font-size: 0.95rem;
}

select,
input[type="file"],
button {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--line);
    font: inherit;
}

select,
input[type="file"] {
    padding: 12px 14px;
    background: white;
}

button {
    padding: 13px 18px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover {
    transform: translateY(-1px);
}

.primary-button {
    background: var(--accent);
    color: white;
    border-color: transparent;
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.primary-button:hover,
.secondary-button:hover {
    box-shadow: 0 14px 28px rgba(17, 94, 89, 0.18);
}

.secondary-button {
    background: white;
    color: var(--accent-dark);
}

.results {
    margin-top: 24px;
    display: grid;
    gap: 24px;
}

.plan-card {
    padding: 24px;
}

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

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: white;
}

table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid #ecece4;
    border-right: 1px solid #f1f1eb;
    text-align: center;
    white-space: nowrap;
}

thead th {
    position: sticky;
    top: 0;
    background: #f8f7f2;
    z-index: 1;
}

tbody th {
    background: #fcfbf7;
    text-align: left;
}

.dept-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.dept-dialysis {
    background: var(--dialysis);
    color: #1d4ed8;
}

.dept-icu {
    background: var(--icu);
    color: #b91c1c;
}

.dept-surgery {
    background: var(--surgery);
    color: #6d28d9;
}

.dept-ward {
    background: var(--ward);
    color: #15803d;
}

.dept-outpatient {
    background: var(--outpatient);
    color: #b45309;
}

@media (max-width: 900px) {
    .generator-form {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 20px, 100%);
        padding-top: 16px;
    }

    .hero-card,
    .plan-card {
        padding: 18px;
        border-radius: 20px;
    }

    .generator-form {
        grid-template-columns: 1fr;
    }

    .plan-header {
        flex-direction: column;
        align-items: flex-start;
    }

    th,
    td {
        padding: 8px 10px;
    }
}
