:root {
    color-scheme: light;
    --page: #f7f7f2;
    --surface: #fff;
    --subtle: #f2f6f3;
    --text: #172522;
    --muted: #52655d;
    --border: #dce5df;
    --control-border: #b9c9c0;
    --accent: #175d46;
    --accent-hover: #104934;
    --accent-soft: #e8f4ed;
    --focus: #267b60;
    --warning: #785710;
    --warning-soft: #fff3ce;
    --danger: #9a342b;
    --danger-soft: #fff1ee;
    --radius: 14px;
    --shell: 1120px;

    background: var(--page);
    color: var(--text);
    font-family: Inter, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
}

h1, h2, h3, p, ul, ol, dl {
    margin-block-start: 0;
}

h1, h2, h3 {
    line-height: 1.17;
    letter-spacing: -.025em;
    text-wrap: balance;
}

h1 {
    margin-block-end: .45em;
    font-size: clamp(1.8rem, 4vw, 2.55rem);
    font-weight: 760;
}

h2 {
    margin-block-end: .35em;
    font-size: 1.38rem;
    font-weight: 740;
}

h3 {
    margin-block-end: .4em;
    font-size: 1rem;
}

a {
    color: var(--accent);
    text-underline-offset: .18em;
}

input, select, button {
    font: inherit;
}

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

[hidden] {
    display: none !important;
}

code, pre {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

code {
    font-size: .87em;
    overflow-wrap: anywhere;
}

.app-header {
    background: var(--surface);
    border-block-end: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    max-width: var(--shell);
    min-height: 64px;
    margin-inline: auto;
    padding: 8px clamp(16px, 4vw, 32px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--text);
    font-weight: 750;
    letter-spacing: -.02em;
    text-decoration: none;
}

.brand-mark {
    position: relative;
    display: grid;
    flex: 0 0 34px;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
}

.brand-mark:empty::before {
    content: "";
    width: 17px;
    height: 12px;
    border: 1.5px solid currentColor;
    border-radius: 2px;
}

.brand-mark:empty::after {
    content: "";
    position: absolute;
    top: 10px;
    left: 12px;
    width: 10px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) skew(-7deg, -7deg);
}

.account-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 14px;
    min-width: 0;
    color: var(--muted);
    font-size: .9rem;
    overflow-wrap: anywhere;
}

.account-bar form,
.action-row form,
.item form {
    margin: 0;
}

.shell {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding: clamp(24px, 5vw, 52px) clamp(16px, 4vw, 32px) 56px;
}

.login-shell {
    display: grid;
    place-items: start center;
    width: 100%;
    padding: clamp(36px, 10vh, 108px) 16px 48px;
}

.login-card {
    width: min(100%, 440px);
    margin-inline: auto;
    padding: clamp(22px, 6vw, 36px);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    background: var(--surface);
    box-shadow: 0 16px 36px rgb(23 37 34 / 6%);
}

.login-card h1 {
    font-size: clamp(1.65rem, 5.5vw, 2.15rem);
}

.login-card > p {
    margin-block-end: 22px;
}

.stack-form {
    display: grid;
    gap: 16px;
}

.stack-form .button {
    width: 100%;
}

.field {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
    font-size: .92rem;
    font-weight: 650;
}

.field :is(input, select) {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    font-weight: 440;
}

.field :is(input, select):disabled {
    background: var(--subtle);
    color: var(--muted);
}

.field input::placeholder {
    color: var(--muted);
    opacity: .83;
}

.field :is(small, .muted) {
    font-weight: 440;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 13px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font-weight: 650;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--subtle);
}

.button.primary {
    min-height: 44px;
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.button.primary:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}

.button.danger {
    color: var(--danger);
}

.button.danger:hover {
    border-color: #dca59d;
    background: var(--danger-soft);
}

.button:disabled,
.button[aria-disabled="true"] {
    opacity: .58;
    cursor: not-allowed;
}

.page-intro {
    margin-block-end: 20px;
}

.page-intro p,
.panel-header p {
    max-width: 68ch;
    margin-block-end: 0;
    color: var(--muted);
}

.section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-block-end: 24px;
}

.section-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: .92rem;
    font-weight: 650;
    text-decoration: none;
}

.section-nav a:hover {
    background: var(--accent-soft);
}

.panel {
    min-width: 0;
    margin-block-end: 18px;
    padding: clamp(16px, 3vw, 25px);
    scroll-margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 16px;
    margin-block-end: 16px;
}

.panel-header :is(h2, p) {
    margin-block-end: 0;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-block-end: 16px;
}

.inline-form .field {
    flex: 1 1 176px;
}

.inline-form .button {
    min-height: 44px;
}

.item-list,
.check-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 18px;
    min-width: 0;
    padding-block: 12px;
    border-block-start: 1px solid var(--border);
}

.item:last-child {
    padding-block-end: 0;
}

.item-content {
    display: grid;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.item-content :is(p, h3) {
    margin-block-end: 0;
}

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

.empty {
    margin-block: 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--subtle);
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--subtle);
    color: var(--muted);
    font-size: .8rem;
    font-weight: 690;
    line-height: 1.45;
    white-space: nowrap;
}

.badge.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.badge.pending {
    background: var(--warning-soft);
    color: var(--warning);
}

.domains {
    display: grid;
    gap: 9px;
}

.domain {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.domain-summary {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    min-height: 46px;
    padding: 9px 12px;
    list-style: none;
    font-weight: 690;
    overflow-wrap: anywhere;
    cursor: pointer;
}

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

.domain-summary::before {
    content: "";
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    margin: 0 5px 0 2px;
    border: solid var(--accent);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(-45deg);
}

.domain[open] .domain-summary::before {
    transform: rotate(45deg);
}

.domain-summary .badge {
    margin-inline-start: auto;
}

.domain-body {
    padding: 0 12px 12px;
}

.domain-body > :last-child {
    margin-block-end: 0;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.dns-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
    text-align: left;
}

.dns-table :is(th, td) {
    padding: 8px 10px;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.dns-table th {
    background: var(--subtle);
    color: var(--muted);
    font-weight: 700;
}

.dns-table td {
    border-block-start: 1px solid var(--border);
}

.dns-table :is(th, td):first-child {
    width: 1%;
    white-space: nowrap;
}

.dns-table td:nth-child(2) {
    width: 26%;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-block-start: 12px;
}

.notice,
.secret {
    margin-block-end: 14px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--subtle);
    color: var(--text);
    overflow-wrap: anywhere;
}

.notice:empty {
    display: none;
}

.notice.error {
    border-color: #ecc7c0;
    background: var(--danger-soft);
    color: var(--danger);
}

.notice.success,
.secret {
    border-color: #bcd9ca;
    background: var(--accent-soft);
    color: var(--accent);
}

.secret code,
.secret pre {
    display: block;
    margin-block: 6px 0;
    padding: 8px 10px;
    border: 1px solid #bcd9ca;
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: all;
}

.check-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: .9rem;
}

.htmx-indicator {
    display: none;
    color: var(--muted);
    font-size: .88rem;
}

.htmx-request.htmx-indicator,
.htmx-request .htmx-indicator {
    display: inline-block;
}

@media (max-width: 700px) {
    .inline-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .inline-form .button {
        width: 100%;
    }

    .item {
        align-items: start;
    }
}

@media (max-width: 460px) {
    .header-inner {
        gap: 8px;
    }

    .account-bar {
        gap: 4px 8px;
    }

    .item {
        flex-wrap: wrap;
    }

    .item-content {
        flex-basis: 100%;
    }

    .domain-summary {
        flex-wrap: wrap;
    }

    .dns-table :is(th, td) {
        padding: 6px;
    }

    .dns-table td:nth-child(2) {
        width: 33%;
    }
}
