:root {
    --bg: #f4f7f5;
    --bg-accent: #e8f0ec;
    --surface: #ffffff;
    --ink: #1a2e28;
    --muted: #5c726a;
    --line: #d5e0db;
    --teal: #0f766e;
    --teal-dark: #0b5a54;
    --teal-soft: #ccfbf1;
    --amber: #b45309;
    --amber-soft: #fef3c7;
    --red: #b91c1c;
    --red-soft: #fee2e2;
    --green: #15803d;
    --green-soft: #dcfce7;
    --shadow: 0 12px 32px rgba(26, 46, 40, 0.08);
    --radius: 14px;
    --font: "Source Sans 3", "Segoe UI", sans-serif;
    --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(ellipse 80% 50% at 10% -10%, rgba(15, 118, 110, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(180, 83, 9, 0.08), transparent 45%),
        linear-gradient(180deg, var(--bg-accent), var(--bg));
}

.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 36px 20px 64px;
}

.brand {
    margin-bottom: 28px;
}

.brand-mark {
    display: inline-block;
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 10px;
}

.brand h1 {
    margin: 0 0 8px;
    font-family: var(--display);
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.brand p {
    margin: 0;
    max-width: 640px;
    color: var(--muted);
    line-height: 1.55;
    font-size: 1.02rem;
}

.steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.step-pill {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.55);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.step-pill.active {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

.step-pill.done {
    background: var(--teal-soft);
    border-color: #99f6e4;
    color: var(--teal-dark);
}

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

.panel h2 {
    margin: 0 0 6px;
    font-family: var(--display);
    font-size: 1.45rem;
    font-weight: 650;
}

.panel .lede {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.5;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 18px;
    border: 1px solid;
    font-size: 0.95rem;
}

.alert-error {
    background: var(--red-soft);
    border-color: #fecaca;
    color: var(--red);
}

.alert-info {
    background: var(--teal-soft);
    border-color: #99f6e4;
    color: var(--teal-dark);
}

.alert-success {
    background: var(--green-soft);
    border-color: #86efac;
    color: var(--green);
}

.dropzone {
    border: 2px dashed #9cb5ad;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #f8fbf9;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--teal);
    background: var(--teal-soft);
}

.dropzone strong {
    display: block;
    font-size: 1.08rem;
    margin-bottom: 6px;
}

.dropzone span {
    color: var(--muted);
    font-size: 0.94rem;
}

.hidden-input { display: none; }

.file-name {
    margin-top: 12px;
    color: var(--teal);
    font-weight: 650;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

label.field-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 650;
    color: var(--muted);
    margin-bottom: 6px;
}

select,
input[type="text"] {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font: inherit;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.btn {
    appearance: none;
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--teal);
    color: #fff;
}

.btn-primary:hover { background: var(--teal-dark); }

.btn-secondary {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-secondary:hover { background: var(--bg); }

.btn-danger {
    background: var(--red);
    color: #fff;
}

.mapping-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.mapping-table th,
.mapping-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.mapping-table th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-required {
    background: var(--red-soft);
    color: var(--red);
}

.badge-primary {
    background: var(--teal-soft);
    color: var(--teal-dark);
}

.section-title {
    margin: 28px 0 12px;
    font-family: var(--display);
    font-size: 1.15rem;
}

.options-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    background: #f8fbf9;
    margin-top: 10px;
}

.option-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.option-card:has(input:checked),
.option-card.selected {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.option-card label {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    cursor: pointer;
    margin: 0;
}

.option-card strong {
    display: block;
    margin-bottom: 4px;
}

.option-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.checkbox-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    background: var(--amber-soft);
    border: 1px solid #fde68a;
}

.checkbox-line input { margin-top: 3px; }

.checkbox-line .hint {
    color: var(--amber);
    font-size: 0.9rem;
    margin-top: 4px;
}

.destination-box {
    margin-bottom: 8px;
}

.radio-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.radio-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0;
    cursor: pointer;
}

.radio-line input {
    margin-top: 3px;
}

textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font: inherit;
    color: var(--ink);
    background: #fff;
    resize: vertical;
    min-height: 120px;
}

textarea:focus {
    outline: 2px solid rgba(15, 118, 110, 0.25);
    border-color: var(--teal);
}

.preview-table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-top: 12px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

.preview-table th,
.preview-table td {
    padding: 9px 11px;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
    white-space: nowrap;
}

.preview-table th {
    background: #eef5f2;
    position: sticky;
    top: 0;
    text-align: left;
}

.zip-assign-box {
    margin: 16px 0 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fbf9;
}

.zip-assign-box .section-title {
    margin-top: 0;
}

.zip-assign-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1.4fr) minmax(220px, 1fr);
    gap: 14px 18px;
    align-items: start;
}

.zip-assign-grid textarea {
    width: 100%;
    min-height: 84px;
    resize: vertical;
    font-family: inherit;
}

.zip-bulk-stack {
    flex-direction: column;
    align-items: stretch;
}

.zip-bulk-stack select,
.zip-bulk-stack .btn {
    width: 100%;
}

#zip-group-status {
    margin: 10px 0 0;
    min-height: 1.2em;
}

#zip-group-status.is-success { color: var(--green); }
#zip-group-status.is-warning { color: var(--amber); }
#zip-group-status.is-error { color: var(--red); }

.zip-table tbody tr.is-just-assigned td {
    background: var(--teal-soft);
}

.zip-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
    margin: 8px 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

@media (max-width: 720px) {
    .zip-assign-grid {
        grid-template-columns: 1fr;
    }
}

.zip-search {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
    flex: 1;
}

.zip-search span,
.zip-bulk label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.zip-toolbar-actions {
    display: flex;
    gap: 8px;
}

.zip-bulk {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.zip-bulk select {
    min-width: 220px;
}

.zip-table {
    min-width: 720px;
}

.zip-table .col-check {
    width: 72px;
    text-align: center;
}

.zip-table tbody tr.is-hidden {
    display: none;
}

.zip-table tbody tr.is-unchecked {
    opacity: 0.55;
}

.zip-table select {
    width: 100%;
    min-width: 220px;
}

.zip-cell-wrap {
    white-space: normal;
    max-width: 560px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.stat {
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #f8fbf9;
}

.stat .value {
    font-family: var(--display);
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat .label {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.3;
}

.stat.success .value { color: var(--green); }
.stat.warning .value { color: var(--amber); }
.stat.danger .value { color: var(--red); }
.stat.info .value { color: var(--teal); }

.details {
    margin-top: 20px;
}

.details pre {
    background: #1a2e28;
    color: #d7e6e0;
    padding: 14px;
    border-radius: 10px;
    overflow: auto;
    max-height: 220px;
    font-size: 0.85rem;
}

.detail-section {
    margin-top: 28px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.section-head .section-title {
    margin: 0;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.92rem;
}

.table-meta {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.92rem;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    font-weight: 650;
    font-size: 0.9rem;
}

.page-btn:hover {
    background: var(--bg);
}

.page-btn.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.page-status {
    color: var(--muted);
    font-size: 0.9rem;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 0.94rem;
}

.meta-row strong { color: var(--ink); }

.hidden { display: none !important; }

@media (max-width: 640px) {
    .page { padding: 24px 14px 48px; }
    .panel { padding: 20px 16px; }
    .mapping-table th:nth-child(3),
    .mapping-table td:nth-child(3) { display: none; }
}
