:root {
    --bg: #f3efe7;
    --surface: rgba(255, 255, 255, 0.84);
    --surface-strong: #fffdf8;
    --text: #1c1917;
    --muted: #6b635c;
    --line: rgba(28, 25, 23, 0.09);
    --brand: #bf5a36;
    --brand-dark: #8f3d21;
    --success: #157f52;
    --danger: #b63a2b;
    --shadow: 0 20px 50px rgba(56, 42, 31, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(191, 90, 54, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(216, 181, 127, 0.22), transparent 28%),
        linear-gradient(180deg, #f8f4ed, var(--bg));
}

code,
input,
textarea,
select,
button {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    padding: 32px;
}

.auth-page,
.dashboard {
    max-width: 1240px;
    margin: 0 auto;
}

.auth-page {
    min-height: calc(100vh - 64px);
    display: grid;
    place-items: center;
}

.auth-card,
.panel,
.stat-card {
    background: var(--surface);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(100%, 480px);
    padding: 40px;
    border-radius: 28px;
}

.auth-card h1,
.topbar h1 {
    margin: 12px 0 10px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.auth-card p,
.topbar p,
.panel-head p,
.muted {
    color: var(--muted);
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(28, 25, 23, 0.06);
    color: var(--brand-dark);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.74rem;
    font-weight: 700;
}

.auth-form,
.stack-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

label span {
    display: block;
    margin-bottom: 8px;
    font-size: 0.92rem;
    font-weight: 600;
}

.field-help {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(255, 253, 248, 0.9);
    border-radius: 16px;
    padding: 14px 16px;
    color: var(--text);
}

button {
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--brand), #dd8e47);
    color: white;
    padding: 14px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
    box-shadow: 0 14px 30px rgba(191, 90, 54, 0.25);
}

button:hover {
    transform: translateY(-1px);
}

.ghost-button,
.small-button {
    background: rgba(28, 25, 23, 0.07);
    color: var(--text);
    box-shadow: none;
}

.small-button {
    padding: 10px 12px;
    border-radius: 12px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    border-radius: 24px;
    padding: 24px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 12px;
}

.stat-card strong {
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.stat-card.danger strong {
    color: var(--danger);
}

.content-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.panel {
    border-radius: 28px;
    padding: 24px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-head h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) 220px auto;
    gap: 12px;
    margin-bottom: 18px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 253, 248, 0.72);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

tbody tr:last-child td {
    border-bottom: 0;
}

code {
    display: inline-block;
    background: rgba(28, 25, 23, 0.08);
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.88rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-success {
    background: rgba(21, 127, 82, 0.12);
    color: var(--success);
}

.badge-muted {
    background: rgba(28, 25, 23, 0.08);
    color: var(--muted);
}

.inline-form {
    margin: 0;
}

.license-key-stack,
.action-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.copy-button,
.danger-button {
    min-width: 88px;
    text-align: center;
}

.link-button,
.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(28, 25, 23, 0.07);
    color: var(--text);
    text-decoration: none;
}

.danger-button {
    background: rgba(182, 58, 43, 0.12);
    color: var(--danger);
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 600;
}

.flash-success {
    background: rgba(21, 127, 82, 0.12);
    color: var(--success);
}

.flash-error {
    background: rgba(182, 58, 43, 0.12);
    color: var(--danger);
}

.empty-cell {
    text-align: center;
    color: var(--muted);
}

@media (max-width: 980px) {
    .app-shell {
        padding: 18px;
    }

    .stat-grid,
    .content-grid,
    .filter-bar {
        grid-template-columns: 1fr;
    }

    .topbar,
    .panel-head {
        flex-direction: column;
        align-items: stretch;
    }
}
