:root {
    color-scheme: light;
    --bg: #eef2f5;
    --panel: #ffffff;
    --surface-soft: #f7faf9;
    --text: #17211d;
    --muted: #66736e;
    --line: #d9e1de;
    --line-strong: #bdc9c5;
    --primary: #116d63;
    --primary-dark: #0c574f;
    --primary-soft: #e6f4f1;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(26, 39, 45, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(17, 109, 99, 0.10) 0, rgba(17, 109, 99, 0) 280px),
        var(--bg);
    color: var(--text);
    font-family: Inter, Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

.app-shell {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0;
    display: grid;
    grid-template-columns: minmax(340px, 0.9fr) minmax(420px, 1.1fr);
    gap: 20px;
}

.app-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 6px 2px 2px;
}

.panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(217, 225, 222, 0.92);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.input-panel {
    align-self: start;
}

.results-panel {
    min-height: 420px;
}

.heading-row,
.table-header,
.actions,
.label-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.heading-row,
.table-header,
.label-row {
    justify-content: space-between;
}

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

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 4px;
    font-size: 1.12rem;
    line-height: 1.2;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.subheading {
    margin-bottom: 18px;
    color: var(--muted);
}

.subheading.compact {
    margin-bottom: 0;
    font-size: 0.92rem;
}

.status-pill,
#result-count,
#address-count {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 11px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill {
    border-color: rgba(17, 109, 99, 0.26);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 800;
}

.label-row label {
    margin-bottom: 0;
}

textarea {
    display: block;
    width: 100%;
    min-height: 315px;
    resize: vertical;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 15px;
    font: inherit;
    color: var(--text);
    background: var(--surface-soft);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

textarea::placeholder {
    color: #7a8782;
}

textarea:focus,
button:focus-visible {
    outline: 3px solid rgba(17, 109, 99, 0.20);
    outline-offset: 2px;
}

.actions {
    flex-wrap: wrap;
    margin-top: 16px;
}

button {
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 0 16px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

button:hover:not(:disabled) {
    border-color: #8fa09a;
    transform: translateY(-1px);
}

button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

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

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.message {
    min-height: 24px;
    margin-top: 14px;
    color: var(--muted);
    font-weight: 700;
}

.message.error {
    color: var(--danger);
}

.table-wrap {
    margin-top: 16px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

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

th,
td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #edf4f2;
    color: #394742;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

tbody tr:nth-child(even):not(.empty-row) {
    background: #fafcfc;
}

tbody tr:hover:not(.empty-row) {
    background: #f0f6f5;
}

tr:last-child td {
    border-bottom: 0;
}

.empty-row td {
    color: var(--muted);
    text-align: center;
    padding: 54px 14px;
}

.ra-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 30px;
    border: 1px solid #d3ddd9;
    border-radius: 999px;
    padding: 5px 10px;
    background: #f5f8f7;
    color: #384540;
    font-size: 0.88rem;
    font-weight: 800;
    white-space: normal;
}

.ra-major {
    border-color: #a9d7ca;
    background: #e5f6f0;
    color: #0f5f52;
}

.ra-inner,
.ra-outer {
    border-color: #c7d7ef;
    background: #eef4ff;
    color: #244a7a;
}

.ra-remote,
.ra-very-remote {
    border-color: #f0d19f;
    background: #fff6e7;
    color: #805213;
}

.ra-not-found,
.ra-unknown {
    border-color: #e7c3bd;
    background: #fff1ef;
    color: #9a3124;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
        width: min(100% - 20px, 720px);
        padding: 12px 0;
    }

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

    .panel {
        padding: 16px;
    }

    h1 {
        font-size: clamp(1.85rem, 9vw, 2.55rem);
    }

    .heading-row,
    .table-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .actions button {
        flex: 1 1 160px;
    }

    textarea {
        min-height: 260px;
    }
}
