:root {
    color-scheme: light;
    --background: #f4f1ea;
    --surface: #fffdf8;
    --ink: #1d2528;
    --muted: #637174;
    --line: #d8d0c2;
    --accent: #0d6b6f;
    --accent-strong: #084c4f;
    --warn: #a34b18;
    --ok: #237044;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Avenir Next, Avenir, Segoe UI, sans-serif;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(13, 107, 111, 0.12), transparent 32rem),
        radial-gradient(circle at top right, rgba(163, 75, 24, 0.13), transparent 24rem),
        var(--background);
}

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

button {
    border: 0;
    border-radius: 6px;
    padding: 0.65rem 0.9rem;
    color: #ffffff;
    background: var(--accent);
    cursor: pointer;
}

button:hover:not(:disabled) {
    background: var(--accent-strong);
}

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

button.secondary {
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--line);
}

button.secondary:hover:not(:disabled) {
    color: #ffffff;
}

input,
select,
textarea {
    min-height: 2.5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    background: #ffffff;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

.shell {
    width: min(1280px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0;
}

.toolbar,
.panel-header,
.actions,
.license-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toolbar {
    justify-content: space-between;
    margin-bottom: 1rem;
}

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

h1,
h2 {
    margin: 0;
}

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

h2 {
    font-size: 1.05rem;
}

.actions input {
    width: min(22rem, 40vw);
}

.status,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.84);
    box-shadow: 0 18px 48px rgba(29, 37, 40, 0.08);
}

.status {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    color: var(--muted);
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab {
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 253, 248, 0.84);
}

.tab:hover:not(:disabled) {
    color: #ffffff;
}

.tab.active {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}

.view {
    display: grid;
    gap: 1rem;
}

[hidden] {
    display: none !important;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
}

.hint {
    margin: 0 0 0.75rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.hint code {
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    background: rgba(13, 107, 111, 0.1);
}

.inline-status {
    margin-bottom: 1rem;
    padding: 0.6rem 0.75rem;
    border: 1px dashed var(--line);
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.85rem;
}

.site-layout {
    display: grid;
    grid-template-columns: minmax(16rem, 24rem) 1fr;
    gap: 1rem;
    align-items: start;
}

.site-list {
    display: grid;
    gap: 0.5rem;
    max-height: 28rem;
    overflow-y: auto;
}

.site-card {
    width: 100%;
    display: grid;
    gap: 0.2rem;
    justify-items: start;
    border: 1px solid var(--line);
    color: var(--ink);
    background: #ffffff;
    text-align: left;
}

.site-card.active {
    border-color: var(--accent);
    box-shadow: inset 4px 0 0 var(--accent);
}

.site-card span:not(.pill) {
    color: var(--muted);
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.config-form {
    display: grid;
    gap: 0.65rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.config-form h3 {
    margin: 0;
    font-size: 0.95rem;
}

.config-form label {
    display: grid;
    gap: 0.25rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.field-row {
    display: flex;
    gap: 0.5rem;
}

.field-row input {
    flex: 1;
    min-width: 0;
}

.path-result {
    margin: -0.25rem 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.path-result.ok {
    color: var(--ok);
}

.path-result.warn {
    color: var(--warn);
}

.config-actions {
    display: flex;
    gap: 0.5rem;
}

.content-paths {
    display: grid;
    gap: 0.5rem;
}

.content-paths h4 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ink);
}

.content-path-list {
    display: grid;
    gap: 0.75rem;
}

.content-path-row {
    display: grid;
    gap: 0.4rem;
    padding: 0.6rem;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.index-type-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.index-type {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.index-type input {
    min-height: auto;
    width: auto;
}

.muted {
    color: var(--muted);
    font-size: 0.8rem;
}

.layout {
    display: grid;
    grid-template-columns: minmax(16rem, 22rem) 1fr;
    gap: 1rem;
}

.panel {
    padding: 1rem;
}

.panel-header {
    justify-content: space-between;
    margin-bottom: 1rem;
}

.tenant-list {
    display: grid;
    gap: 0.5rem;
}

.registration-form {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.registration-form h3 {
    margin: 0;
    font-size: 0.9rem;
}

.registration-form label {
    display: grid;
    gap: 0.25rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.registration-form input,
.registration-form select,
.registration-form button {
    width: 100%;
}

.tenant-card {
    width: 100%;
    border: 1px solid var(--line);
    color: var(--ink);
    background: #ffffff;
    text-align: left;
}

.tenant-card.active {
    border-color: var(--accent);
    box-shadow: inset 4px 0 0 var(--accent);
}

.tenant-card strong,
.tenant-card span {
    display: block;
}

.tenant-card span {
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.pill {
    border-radius: 999px;
    padding: 0.3rem 0.6rem;
    color: #ffffff;
    background: var(--muted);
    font-size: 0.8rem;
}

.pill.active {
    background: var(--ok);
}

.pill.inactive,
.pill.suspended,
.pill.expired {
    background: var(--warn);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.metrics article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.85rem;
    background: #ffffff;
}

.metrics span {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.metrics strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1.8rem;
}

.license-form {
    align-items: end;
    margin-bottom: 1rem;
}

.license-form label {
    display: grid;
    gap: 0.25rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

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

th {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

td:last-child,
th:last-child {
    text-align: right;
}

.empty {
    color: var(--muted);
    padding: 1rem 0;
}

@media (max-width: 860px) {
    .toolbar,
    .actions,
    .license-form {
        align-items: stretch;
        flex-direction: column;
    }

    .actions input {
        width: 100%;
    }

    .layout,
    .metrics,
    .site-layout {
        grid-template-columns: 1fr;
    }
}