:root {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #171414;
    --surface-2: #201818;
    --surface-3: #291f1f;
    --field: #100f0f;
    --line: #443232;
    --line-soft: #2b2222;
    --text: #f7f1ee;
    --muted: #bdaaa5;
    --quiet: #8f7c77;
    --accent: #9b4f4f;
    --accent-2: #c77862;
    --gold: #d2a35d;
    --focus: rgba(199, 120, 98, 0.28);
    --shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(155, 79, 79, 0.18), transparent 360px),
        linear-gradient(180deg, #120f0f 0, var(--bg) 340px);
}

a {
    color: inherit;
}

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

button {
    min-height: 42px;
    border: 1px solid #b9695f;
    border-radius: 7px;
    padding: 0 18px;
    color: #fff;
    background: linear-gradient(180deg, #a95852, #884343);
    cursor: pointer;
    font-weight: 750;
}

button:hover {
    background: linear-gradient(180deg, #bd6a5e, #984b4b);
}

button:focus-visible,
input:focus,
select:focus,
textarea:focus,
a:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

button.secondary {
    border-color: var(--line);
    color: var(--text);
    background: var(--surface-3);
}

button.secondary:hover {
    border-color: #795353;
    background: #342626;
}

button.secondary[data-status="success"] {
    border-color: #4f8d68;
    color: #eafff1;
    background: #235035;
}

button.secondary[data-status="error"] {
    border-color: #b9695f;
    color: #fff2ef;
    background: #6b302f;
}

button[hidden] {
    display: none;
}

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

.page-narrow {
    width: min(920px, calc(100% - 32px));
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.primary-column {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.app-header,
.site-notice,
.search-shell,
.results-shell,
.status-panel,
.content-panel {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: rgba(23, 20, 20, 0.94);
    box-shadow: var(--shadow);
}

.site-notice {
    padding: 10px 14px;
    color: #d8c8c4;
    background: rgba(41, 31, 31, 0.76);
    font-size: 0.92rem;
    line-height: 1.35;
}

.app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    padding: 18px 20px;
    background:
        linear-gradient(90deg, rgba(155, 79, 79, 0.2), transparent 58%),
        rgba(23, 20, 20, 0.96);
    min-width: 0;
}

.summary-copy h1 {
    margin: 0;
    font-size: 2.55rem;
    line-height: 0.95;
    letter-spacing: 0;
}

.brand-link {
    display: inline-block;
    color: inherit;
    text-decoration: none;
}

.brand-link:hover h1,
.brand-link:focus-visible h1 {
    color: #fff;
}

.summary-copy p:last-child {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.35;
}

.summary-copy a,
.content-panel a {
    color: #f1c37c;
    text-underline-offset: 3px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 0.74rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.resource-links,
.link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.resource-links a,
.link-row a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 5px 9px;
    color: var(--text);
    background: rgba(32, 24, 24, 0.72);
    font-size: 0.88rem;
    text-decoration: none;
}

.resource-links a:hover,
.link-row a:hover {
    border-color: #795353;
    background: #302323;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
    line-height: 1.15;
}

h2 {
    font-size: 1.35rem;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.status-grid div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: baseline;
    min-height: 54px;
    border: 1px solid var(--line-soft);
    border-radius: 7px;
    padding: 12px 13px;
    background: rgba(32, 24, 24, 0.82);
}

.status-grid dt {
    color: var(--muted);
    font-size: 0.82rem;
}

.status-grid dd {
    margin: 0;
    font-size: 1rem;
    font-weight: 820;
    white-space: nowrap;
}

.status-panel {
    padding: 14px;
}

.search-shell {
    padding: 20px;
    min-width: 0;
}

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

.section-heading p {
    margin: 0;
    color: var(--muted);
}

.quick-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.quick-actions button {
    min-height: 38px;
    padding-inline: 14px;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 180px 220px auto;
    gap: 12px;
    align-items: end;
}

label,
fieldset {
    min-width: 0;
}

label span,
legend {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 780;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 9px 12px;
    color: var(--text);
    background: var(--field);
}

select {
    appearance: none;
    padding-right: 34px;
    background:
        linear-gradient(45deg, transparent 50%, #d8c8c4 50%) calc(100% - 17px) 52% / 6px 6px no-repeat,
        linear-gradient(135deg, #d8c8c4 50%, transparent 50%) calc(100% - 12px) 52% / 6px 6px no-repeat,
        var(--field);
}

input::placeholder {
    color: #7f6f6a;
}

fieldset {
    display: flex;
    gap: 10px;
    min-height: 42px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 10px;
    background: var(--field);
}

legend {
    padding: 0 4px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    font-size: 0.92rem;
    white-space: nowrap;
}

.check input {
    width: 16px;
    min-height: 16px;
    accent-color: var(--accent-2);
}

.content-panel {
    margin-top: 18px;
    padding: 20px;
}

.results-shell {
    padding: 18px;
    min-width: 0;
}

.results-heading {
    margin-bottom: 14px;
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.results-count {
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.share-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 5px 10px;
    color: var(--text);
    background: rgba(32, 24, 24, 0.72);
    font-size: 0.88rem;
    text-decoration: none;
    white-space: nowrap;
}

.share-link:hover {
    border-color: #795353;
    background: #302323;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #110f0f;
}

table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
}

th:nth-child(1),
td:nth-child(1) {
    width: 20%;
}

th:nth-child(2),
td:nth-child(2) {
    width: 42%;
}

th:nth-child(3),
td:nth-child(3) {
    width: 12%;
}

th:nth-child(4),
td:nth-child(4) {
    width: 10%;
}

th:nth-child(5),
td:nth-child(5) {
    width: 9%;
}

th:nth-child(6),
td:nth-child(6) {
    width: 7%;
}

th,
td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #e8d9d5;
    background: #211919;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

td {
    color: var(--muted);
    background: #141111;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.properties-cell,
.detail-list dd {
    line-height: 1.28;
}

.prop-block {
    display: grid;
    gap: 2px;
}

.prop-line {
    color: var(--muted);
}

.prop-line--flags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 1px;
}

.prop-flag {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    border: 1px solid rgba(199, 120, 98, 0.34);
    border-radius: 999px;
    padding: 1px 7px;
    color: #eadfdb;
    background: rgba(155, 79, 79, 0.18);
    font-size: 0.82rem;
    line-height: 1.25;
}

.prop-line--groups {
    display: block;
}

.prop-label,
.prop-key {
    color: #c9b7b2;
    font-weight: 560;
}

.prop-label {
    white-space: nowrap;
}

.prop-value {
    color: #eadfdb;
    font-weight: 450;
}

.prop-line--groups > .prop-label::after {
    content: ":";
}

.prop-groups {
    display: inline;
    min-width: 0;
}

.prop-groups::before {
    content: " ";
}

.prop-item {
    display: inline;
    white-space: normal;
}

.prop-item:not(:last-child)::after {
    content: "·";
    margin: 0 6px;
    color: var(--quiet);
}

.prop-line--note {
    margin-top: 2px;
    color: var(--quiet);
}

.name-cell {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: space-between;
}

.name-text {
    min-width: 0;
    color: #ddd1cd;
    font-weight: 540;
}

.result-open-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0;
    color: #e8d9d5;
    background: #201818;
    text-decoration: none;
}

.result-open-link:hover {
    border-color: #795353;
    color: #fff;
    background: #302323;
}

.result-open-link svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.status-cell {
    font-size: 0.86rem;
    white-space: nowrap;
}

.status-pill {
    display: inline-block;
    margin-bottom: 3px;
    border-radius: 999px;
    padding: 2px 7px;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 750;
    line-height: 1.2;
}

.status-pill--available {
    background: #517b48;
}

.status-pill--sold {
    background: #7b5148;
}

.status-date {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
}

.uo-color {
    font-weight: 560;
}

.uo-color--danger,
.uo-color--muted-red,
.uo-color--soft-red {
    color: #ffaaa1;
}

.uo-color--orange {
    color: #ffb06f;
}

.uo-color--gold,
.uo-color--cream {
    color: #e0c06e;
}

.uo-color--green,
.uo-color--bright-green,
.uo-color--soft-green {
    color: #9ee68d;
}

.uo-color--blue {
    color: #b9d3ff;
}

.uo-color--cyan {
    color: #98f1ea;
}

.uo-color--violet,
.uo-color--soft-violet {
    color: #d4bdff;
}

.uo-size--big {
    font-size: 1.08em;
}

.uo-size--small {
    font-size: 0.92em;
}

tbody tr {
    cursor: pointer;
}

tbody tr:nth-child(even) td {
    background: #171313;
}

tbody tr:hover td {
    color: #fff;
    background: #241a1a;
}

.empty-row td,
.message-row td {
    cursor: default;
    padding: 28px;
    text-align: center;
}

#load-more {
    margin-top: 14px;
}

dialog {
    width: min(940px, calc(100% - 28px));
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);
}

.detail-dialog {
    padding: 20px;
}

.detail-dialog header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

#close-dialog {
    min-width: 76px;
    padding-inline: 12px;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin: 18px 0;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--line-soft);
}

.detail-list div {
    padding: 12px;
    background: #141111;
}

.detail-list dt {
    color: var(--muted);
    font-size: 0.78rem;
}

.detail-list dd {
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

.script-block textarea {
    min-height: 300px;
    margin-top: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.45;
}

.content-panel {
    line-height: 1.7;
}

.content-panel h1 {
    font-size: 2.35rem;
    margin-bottom: 18px;
}

.content-panel h2 {
    margin-top: 28px;
}

.content-panel p {
    color: var(--muted);
}

.content-panel pre {
    overflow: auto;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 14px;
    background: var(--field);
}

.link-row {
    margin-top: 18px;
}

@media (max-width: 1180px) {
    .app-header {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .resource-links {
        justify-content: flex-start;
    }

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

    .search-form {
        grid-template-columns: minmax(320px, 1fr) 180px;
    }

    table {
        min-width: 1050px;
        table-layout: auto;
    }
}

@media (max-width: 780px) {
    .page {
        width: min(100% - 18px, 1560px);
        padding-top: 8px;
    }

    .app-header,
    .search-shell,
    .results-shell,
    .status-panel,
    .content-panel {
        padding: 14px;
    }

    .app-header,
    .primary-column,
    .search-form,
    .section-heading {
        grid-template-columns: 1fr;
    }

    .section-heading {
        display: grid;
        align-items: start;
    }

    .quick-actions {
        width: 100%;
    }

    .quick-actions button {
        flex: 1;
    }

    .status-grid,
    .detail-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .summary-copy h1 {
        font-size: 2.35rem;
    }

    fieldset {
        flex-wrap: wrap;
    }

    table {
        min-width: 980px;
    }
}
