.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 18%, rgba(198, 60, 47, .14), transparent 34%),
        var(--paper);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
}

.auth-aside {
    padding: clamp(34px, 7vw, 96px);
    border-right: 1px solid var(--ink);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-aside > span {
    color: var(--red);
    font-size: 10px;
    letter-spacing: .2em;
}

.auth-aside h1 {
    margin: auto 0;
    font-family: var(--serif);
    font-size: clamp(58px, 8vw, 118px);
    line-height: .9;
    letter-spacing: -.07em;
    font-weight: 600;
}

.auth-aside h1 em {
    color: var(--red);
    font-style: normal;
}

.auth-aside p {
    max-width: 400px;
    color: var(--muted);
    font-size: 13px;
}

.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(30px, 6vw, 90px);
    background: rgba(255, 255, 255, .58);
}

.auth-panel-head span {
    color: var(--red);
    font-size: 10px;
    letter-spacing: .2em;
}

.auth-panel-head h2 {
    margin: 12px 0 6px;
    font-family: var(--serif);
    font-size: 42px;
    line-height: 1.1;
}

.auth-panel-head p {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 12px;
}

.auth-form,
.stack-form {
    display: grid;
    gap: 18px;
}

.auth-form .btn {
    margin-top: 8px;
}

.auth-back {
    margin-top: 28px;
    color: var(--muted);
    font-size: 11px;
    text-decoration: none;
}

.auth-back:hover {
    color: var(--red);
}

.admin-body {
    background: #efebe3;
}

.admin-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--ink);
    color: var(--white);
    padding: 30px 22px;
    display: flex;
    flex-direction: column;
}

.admin-brand {
    display: grid;
    gap: 4px;
    text-decoration: none;
    padding-bottom: 34px;
    border-bottom: 1px solid rgba(255, 255, 255, .16);
}

.admin-brand span {
    font-family: var(--serif);
    font-size: 26px;
    letter-spacing: .08em;
}

.admin-brand small {
    color: #9f9a92;
    font-size: 8px;
    letter-spacing: .18em;
}

.admin-nav {
    display: grid;
    gap: 3px;
    margin-top: 28px;
}

.admin-nav a {
    padding: 11px 12px;
    color: #bdb8af;
    text-decoration: none;
    font-size: 13px;
    border-left: 2px solid transparent;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.admin-nav a:hover,
.admin-nav a.is-active {
    color: var(--white);
    background: rgba(255, 255, 255, .055);
    border-left-color: var(--red);
}

.admin-sidebar-foot {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, .16);
    font-size: 11px;
    color: #9f9a92;
}

.admin-sidebar-foot button {
    margin-top: 7px;
    border: 0;
    background: transparent;
    color: var(--white);
    padding: 0;
    cursor: pointer;
    font-size: 11px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.admin-main {
    min-width: 0;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 34px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 9px;
    letter-spacing: .16em;
    background: rgba(244, 241, 235, .75);
}

.admin-topbar a {
    color: var(--ink);
    text-decoration: none;
}

.admin-content {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 34px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.page-head.compact {
    align-items: flex-start;
}

.page-head h1 {
    margin: 8px 0 4px;
    font-family: var(--serif);
    font-size: clamp(36px, 4vw, 58px);
    line-height: 1;
    font-weight: 600;
    letter-spacing: -.055em;
}

.page-head p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

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

.head-actions form {
    margin: 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    min-height: 160px;
    padding: 20px;
    background: var(--white);
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
}

.stat-card span {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .12em;
}

.stat-card strong {
    margin: auto 0 4px;
    font-family: var(--serif);
    font-size: 58px;
    line-height: 1;
    font-weight: 600;
}

.stat-card small {
    color: var(--muted);
    font-size: 10px;
}

.stat-card.accent {
    background: var(--ink);
    color: var(--white);
    border-color: var(--ink);
}

.stat-card.accent span,
.stat-card.accent small {
    color: #aaa49b;
}

.stat-card.warning strong {
    color: var(--red);
}

.panel {
    background: rgba(255, 255, 255, .75);
    border: 1px solid var(--line);
    padding: 22px;
    margin-bottom: 18px;
}

.panel.narrow-panel {
    max-width: 620px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 600;
}

.panel-head a {
    color: var(--muted);
    font-size: 11px;
    text-decoration: none;
}

.panel-head a:hover {
    color: var(--red);
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.admin-table th {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--ink);
    color: var(--muted);
    font-size: 9px;
    letter-spacing: .12em;
    font-weight: 500;
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

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

.admin-table code {
    color: var(--red-deep);
    font-size: 10px;
    word-break: break-word;
}

.empty-row {
    text-align: center !important;
    color: var(--muted);
    padding: 42px 10px !important;
}

.name-link {
    font-family: var(--serif);
    font-size: 17px;
    text-decoration: none;
}

.name-link:hover,
.table-action:hover {
    color: var(--red);
}

.table-action {
    border: 0;
    background: transparent;
    color: var(--ink);
    padding: 0;
    cursor: pointer;
    font-size: 11px;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    padding: 3px 7px;
    border: 1px solid;
    font-size: 9px;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-ok {
    color: var(--green);
    border-color: rgba(47, 107, 79, .38);
    background: rgba(47, 107, 79, .06);
}

.badge-warning {
    color: #a86a1f;
    border-color: rgba(168, 106, 31, .4);
    background: rgba(168, 106, 31, .07);
}

.badge-pending {
    color: var(--red);
    border-color: rgba(198, 60, 47, .38);
    background: rgba(198, 60, 47, .06);
}

.badge-muted {
    color: var(--muted);
    border-color: var(--line);
    background: var(--paper);
}

.list-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 260px;
    flex: 1;
    border: 1px solid var(--line);
    background: var(--paper);
    padding: 0 11px;
}

.search-field span {
    color: var(--red);
    font-size: 20px;
}

.search-field input {
    width: 100%;
    height: 42px;
    border: 0;
    background: transparent;
    outline: 0;
}

.list-toolbar select,
.field input {
    height: 44px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    padding: 0 12px;
    outline: 0;
}

.list-toolbar select:focus,
.field input:focus {
    border-color: var(--red);
    background: var(--white);
}

.field {
    display: grid;
    gap: 7px;
}

.field > span {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .08em;
}

.field > span small {
    opacity: .68;
}

.link-copy-box {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.link-copy-box input {
    min-width: 0;
    flex: 1;
    height: 44px;
    border: 1px solid var(--line);
    background: var(--paper);
    padding: 0 12px;
    font-size: 11px;
    color: var(--muted);
}

.inline-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 11px;
}

.inline-actions form {
    margin: 0;
}

.text-danger {
    border: 0;
    background: transparent;
    color: var(--red);
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-size: 11px;
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
}

.danger-panel {
    border-color: rgba(198, 60, 47, .28);
}

.danger-panel p {
    margin-top: 0;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.account-card {
    border: 1px solid var(--line);
    background: var(--white);
    padding: 16px;
}

.account-card.is-hidden {
    opacity: .56;
    background: var(--paper);
}

.account-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.platform-pill {
    color: var(--red);
    font-size: 9px;
    letter-spacing: .12em;
}

.account-qr {
    display: block;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 1;
    object-fit: contain;
    margin: 14px auto;
    border: 1px solid var(--line);
    padding: 8px;
    background: #fff;
}

.account-card h3 {
    margin: 0 0 6px;
    font-family: var(--serif);
    font-size: 20px;
    word-break: break-word;
}

.account-stats {
    display: flex;
    gap: 12px;
    color: var(--muted);
    font-size: 10px;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid var(--line);
}

.account-actions form {
    margin: 0;
}

.small {
    font-size: 10px;
}

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

.nowrap {
    white-space: nowrap;
}

.summary-cell {
    max-width: 380px;
}

.empty-state {
    text-align: center;
    padding: 50px 16px;
    color: var(--muted);
}

.empty-state strong {
    color: var(--ink);
    font-family: var(--serif);
    font-size: 24px;
}

@media (max-width: 1100px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 820px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-aside {
        min-height: 42vh;
        border-right: 0;
        border-bottom: 1px solid var(--ink);
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        height: auto;
        padding: 18px;
    }

    .admin-brand {
        padding-bottom: 16px;
    }

    .admin-nav {
        display: flex;
        overflow-x: auto;
        margin-top: 14px;
    }

    .admin-nav a {
        white-space: nowrap;
        border-left: 0;
        border-bottom: 2px solid transparent;
    }

    .admin-nav a.is-active {
        border-left: 0;
        border-bottom-color: var(--red);
    }

    .admin-sidebar-foot {
        display: none;
    }

    .admin-topbar {
        padding: 12px 18px;
    }

    .admin-content {
        padding: 22px 18px 40px;
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .stat-grid,
    .account-grid {
        grid-template-columns: 1fr;
    }

    .head-actions,
    .list-toolbar {
        width: 100%;
    }

    .head-actions .btn,
    .list-toolbar .btn {
        flex: 1;
    }

    .search-field {
        min-width: 100%;
    }

    .link-copy-box {
        flex-direction: column;
    }
}

.inline-editor {
    margin-top: 12px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.inline-editor summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 10px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.inline-editor .stack-form {
    margin-top: 12px;
}

.inline-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.compact-form {
    gap: 12px;
}

.panel-subsection {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.panel-subsection h3 {
    margin: 0 0 14px;
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 600;
}
