:root {
    color-scheme: light;
    --forest-950: #17352a;
    --forest-800: #285440;
    --forest-700: #356b51;
    --forest-100: #e7f0e9;
    --cream: #f7f3e8;
    --paper: #fffdf8;
    --ink: #202a25;
    --muted: #647069;
    --line: #d9ddd7;
    --orange: #e86f3a;
    --orange-dark: #c94f20;
    --red: #a43d32;
    --shadow: 0 18px 50px rgb(23 53 42 / 10%);
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input,
textarea {
    font: inherit;
}

button,
.drop-zone {
    -webkit-tap-highlight-color: transparent;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 5rem 1.5rem 7rem;
    background: var(--forest-950);
    color: white;
}

.hero::after {
    position: absolute;
    right: -6rem;
    bottom: -12rem;
    width: 30rem;
    height: 30rem;
    border: 4rem solid rgb(255 255 255 / 4%);
    border-radius: 50%;
    content: "";
}

.hero__content,
main,
footer {
    width: min(100%, 68rem);
    margin-inline: auto;
}

.eyebrow,
.step {
    margin: 0 0 0.5rem;
    color: var(--orange);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 13ch;
    margin-bottom: 1rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.6rem, 7vw, 5rem);
    font-weight: 500;
    line-height: 0.98;
}

h2 {
    margin-bottom: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.65rem, 4vw, 2.25rem);
    font-weight: 500;
    line-height: 1.15;
}

.intro {
    max-width: 42rem;
    margin-bottom: 1.5rem;
    color: #dce8df;
    font-size: 1.1rem;
}

.privacy-note {
    display: inline-flex;
    gap: 0.65rem;
    align-items: center;
    margin: 0;
    padding: 0.7rem 1rem;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 999px;
    background: rgb(255 255 255 / 7%);
    color: #eff7f1;
    font-size: 0.9rem;
}

.privacy-note span {
    color: #8bc49c;
}

main {
    position: relative;
    z-index: 1;
    margin-top: -3.5rem;
    padding: 0 1.5rem 4rem;
}

.panel {
    padding: clamp(1.4rem, 4vw, 2.5rem);
    border: 1px solid rgb(23 53 42 / 9%);
    border-radius: 1.25rem;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.input-panel,
.results {
    margin-top: 1.5rem;
}

.section-heading {
    display: flex;
    gap: 1.5rem;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.workflow-lead {
    max-width: 48rem;
    margin: 0 0 2rem;
    color: var(--muted);
    font-size: 1.05rem;
}

.workflow-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
}

.workflow-summary::-webkit-details-marker {
    display: none;
}

.workflow-summary::after {
    flex: none;
    margin-left: 1rem;
    color: var(--forest-700);
    content: "Visa guide +";
    font-size: 0.85rem;
    font-weight: 800;
}

.workflow-guide[open] .workflow-summary::after {
    content: "Dölj guide −";
}

.workflow-content {
    margin-top: 2rem;
}

.workflow-steps {
    display: grid;
    margin: 0;
    padding: 0;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    list-style: none;
}

.workflow-card {
    position: relative;
    min-width: 0;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: #fbfcf8;
}

.workflow-card h3 {
    margin: 0 0 0.7rem;
    padding-right: 2rem;
    color: var(--forest-950);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
}

.workflow-card p {
    color: var(--muted);
    font-size: 0.92rem;
}

.workflow-number {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: grid;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border-radius: 50%;
    background: var(--forest-100);
    color: var(--forest-800);
    font-size: 0.8rem;
    font-weight: 850;
}

.paper-note {
    display: flex;
    width: 9rem;
    min-height: 7.5rem;
    flex-direction: column;
    gap: 0.25rem;
    justify-content: center;
    margin: 1rem auto 0;
    padding: 1rem 1.3rem;
    transform: rotate(-2deg);
    background: #fff7bb;
    box-shadow: 0 5px 14px rgb(23 53 42 / 12%);
    color: #3e4037;
    font-family: "Comic Sans MS", "Bradley Hand", cursive;
}

.paper-note .own-name {
    margin-bottom: 0.2rem;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.workflow-card .workflow-tip {
    margin-bottom: 0.8rem;
    padding-left: 0.7rem;
    border-left: 3px solid var(--orange);
    color: var(--ink);
    font-size: 0.84rem;
}

.sheet-example {
    display: grid;
    overflow: hidden;
    border: 1px solid #c7cec8;
    border-radius: 0.45rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: white;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
}

.sheet-example div {
    min-height: 1.7rem;
    overflow: hidden;
    padding: 0.3rem 0.4rem;
    border-right: 1px solid #d9dfda;
    border-bottom: 1px solid #d9dfda;
    text-overflow: ellipsis;
}

.sheet-example div:nth-child(3n) {
    border-right: 0;
}

.sheet-example div:nth-last-child(-n + 3) {
    border-bottom: 0;
}

.sheet-example .sheet-column {
    min-height: auto;
    background: #e8ede9;
    color: var(--forest-800);
    font-weight: 800;
    text-align: center;
}

.export-list {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.export-list li + li {
    margin-top: 0.45rem;
}

.format-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--forest-700);
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
}

.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding: 0.3rem;
    border-radius: 0.75rem;
    background: var(--forest-100);
}

.tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--forest-800);
    cursor: pointer;
    font-weight: 750;
}

.tab[aria-selected="true"] {
    background: var(--paper);
    box-shadow: 0 2px 10px rgb(23 53 42 / 10%);
}

.drop-zone {
    display: flex;
    min-height: 15rem;
    flex-direction: column;
    gap: 0.35rem;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed #aebdb3;
    border-radius: 1rem;
    background: #fbfcf8;
    cursor: pointer;
    text-align: center;
    transition: 150ms border-color, 150ms background;
}

.drop-zone:hover,
.drop-zone.is-dragging {
    border-color: var(--orange);
    background: #fff8ef;
}

.drop-zone__icon {
    display: grid;
    width: 3rem;
    height: 3rem;
    margin-bottom: 0.5rem;
    place-items: center;
    border-radius: 50%;
    background: var(--forest-100);
    color: var(--forest-700);
    font-size: 1.5rem;
}

.drop-zone > span:not(.drop-zone__icon, .button-like) {
    color: var(--muted);
}

.button-like,
.primary-button,
.secondary-button {
    border-radius: 0.65rem;
    cursor: pointer;
    font-weight: 800;
}

.button-like {
    margin-top: 0.8rem;
    padding: 0.65rem 1rem;
    background: var(--forest-800);
    color: white;
}

.selected-file:not(:empty) {
    margin-top: 0.65rem;
    color: var(--forest-800);
    font-weight: 700;
}

.textarea-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 750;
}

textarea {
    width: 100%;
    resize: vertical;
    padding: 1rem;
    border: 1px solid #aeb8b1;
    border-radius: 0.75rem;
    background: #fbfcf8;
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.settings-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin: 1.5rem 0;
    padding: 1rem 1.15rem;
    border-radius: 0.8rem;
    background: #f1f4ef;
}

.settings-row label span,
.settings-row label small {
    display: block;
}

.settings-row label span {
    font-weight: 800;
}

.settings-row label small {
    margin-top: 0.2rem;
    color: var(--muted);
}

input[type="number"] {
    width: 5.5rem;
    padding: 0.65rem;
    border: 1px solid #aeb8b1;
    border-radius: 0.6rem;
    background: white;
    font-weight: 750;
    text-align: center;
}

.primary-button {
    width: 100%;
    padding: 0.9rem 1.4rem;
    border: 0;
    background: var(--orange);
    color: white;
    font-size: 1.05rem;
}

.primary-button:hover {
    background: var(--orange-dark);
}

.messages {
    margin-bottom: 1rem;
    padding: 1rem;
    border-left: 4px solid var(--red);
    border-radius: 0.4rem;
    background: #fbecea;
    color: #702b24;
}

.messages ul {
    margin: 0.4rem 0 0;
    padding-left: 1.3rem;
}

.download-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.secondary-button {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--forest-700);
    background: transparent;
    color: var(--forest-700);
}

.statistics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin: 0 0 2rem;
}

.statistic {
    padding: 1rem;
    border-radius: 0.8rem;
    background: var(--forest-100);
}

.statistic dt {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 750;
    text-transform: uppercase;
}

.statistic dd {
    margin: 0.15rem 0 0;
    color: var(--forest-950);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.8rem;
}

.patrol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

.patrol-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: white;
}

.patrol-card h3 {
    margin: 0;
    padding: 0.85rem 1rem;
    background: var(--forest-800);
    color: white;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

.patrol-card ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.patrol-card li {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    border-top: 1px solid var(--line);
}

.status {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.status--yes {
    color: var(--forest-700);
}

.status--no {
    color: var(--red);
}

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.25rem;
    margin: -0.75rem 0 1.5rem;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    background: #f1f4ef;
    color: var(--muted);
    font-size: 0.82rem;
}

.status-legend > div {
    display: flex;
    gap: 0.45rem;
    align-items: baseline;
}

.status-legend .status {
    flex: none;
}

.visualization {
    margin-top: 2rem;
    border-top: 1px solid var(--line);
    padding-top: 1.25rem;
}

.visualization summary {
    cursor: pointer;
    color: var(--forest-700);
    font-weight: 800;
}

.visualization img {
    display: block;
    width: 100%;
    margin-top: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: white;
}

.format-dialog {
    width: min(90vw, 38rem);
    padding: 1.5rem;
    border: 0;
    border-radius: 1rem;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 24px 80px rgb(0 0 0 / 28%);
}

.format-dialog::backdrop {
    background: rgb(23 53 42 / 72%);
}

.dialog-heading {
    display: flex;
    gap: 1rem;
    align-items: start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.close-button {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: none;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--forest-100);
    color: var(--forest-800);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.format-dialog > p {
    color: var(--muted);
}

.format-dialog pre {
    overflow-x: auto;
    margin-top: 1.5rem;
    padding: 1.25rem;
    border-radius: 0.8rem;
    background: var(--forest-950);
    color: #e6f1e9;
}

footer {
    padding: 0 1.5rem 3rem;
    color: var(--muted);
    text-align: center;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

:focus-visible {
    outline: 3px solid #ef9b73;
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

@media (max-width: 42rem) {
    .hero {
        padding-top: 3.5rem;
    }

    .section-heading,
    .settings-row,
    .results-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .statistics {
        grid-template-columns: 1fr;
    }

    .workflow-steps {
        grid-template-columns: 1fr;
    }

    input[type="number"] {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
