:root {
    --bg: #0b141a;
    --bg-soft: #10232f;
    --bg-elevated: #162b38;
    --panel: rgba(16, 35, 47, 0.92);
    --panel-strong: rgba(21, 39, 52, 0.98);
    --panel-border: rgba(170, 180, 190, 0.16);
    --surface: rgba(14, 25, 32, 0.9);
    --surface-soft: rgba(48, 52, 59, 0.52);
    --text: #f5f7fa;
    --text-muted: #aab4be;
    --text-soft: #7d8b96;
    --ink: #081015;
    --accent: #c89b4e;
    --accent-strong: #e0b66d;
    --secondary: #466a84;
    --success: #6e8b74;
    --warning: #c89b4e;
    --danger: #b16b63;
    --shadow-lg: 0 26px 70px rgba(2, 8, 12, 0.48);
    --shadow-md: 0 18px 38px rgba(2, 8, 12, 0.28);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: 'Inter', 'Poppins', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(200, 155, 78, 0.14), transparent 24%),
        radial-gradient(circle at top right, rgba(70, 106, 132, 0.18), transparent 24%),
        linear-gradient(180deg, #101c23 0%, #0b141a 45%, #081015 100%);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

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

.app-body {
    min-height: 100vh;
}

.app-shell {
    width: min(1680px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 22px;
}

.topbar h1,
.hero-card h1 {
    margin: 10px 0 0;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: clamp(2rem, 3vw, 3.35rem);
    letter-spacing: -0.04em;
}

.topbar-nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar-nav a,
.hero-link {
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.topbar-nav a:hover,
.hero-link:hover {
    transform: translateY(-1px);
    border-color: rgba(200, 155, 78, 0.35);
    background: rgba(255, 255, 255, 0.06);
}

.eyebrow {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(200, 155, 78, 0.12);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid rgba(200, 155, 78, 0.18);
}

.admin-panel,
.sim-panel,
.hero-card,
.module-card {
    position: relative;
    background:
        linear-gradient(180deg, rgba(23, 41, 54, 0.96), rgba(11, 20, 26, 0.92));
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.admin-panel::before,
.sim-panel::before,
.hero-card::before,
.module-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(200, 155, 78, 0.12), transparent 30%, rgba(70, 106, 132, 0.1));
    opacity: 0.6;
}

.panel-heading h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.panel-heading p,
.hero-card p,
.module-card p,
.filter-statusline {
    margin: 0;
    color: var(--text-muted);
}

.stack-form,
.form-grid,
.form-inline {
    display: grid;
    gap: 12px;
}

.form-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.form-inline {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    align-items: center;
}

input,
select,
textarea,
button {
    width: 100%;
    border: 1px solid rgba(170, 180, 190, 0.16);
    border-radius: 14px;
    padding: 14px 16px;
    background: rgba(7, 14, 18, 0.68);
    color: var(--text);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-soft);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(200, 155, 78, 0.48);
    box-shadow: 0 0 0 4px rgba(200, 155, 78, 0.12);
    background: rgba(10, 18, 24, 0.82);
}

textarea {
    resize: vertical;
}

button {
    cursor: pointer;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: var(--ink);
    border: none;
    box-shadow: var(--shadow-md);
}

button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.ghost-button {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border: 1px solid rgba(170, 180, 190, 0.16);
    box-shadow: none;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

.checkline input {
    width: 20px;
    height: 20px;
    margin: 0;
}

.table-shell,
.data-list,
.state-editor-list {
    display: grid;
    gap: 12px;
}

.data-row,
.table-row,
.state-card {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, rgba(20, 37, 49, 0.98), rgba(10, 18, 24, 0.96));
    border: 1px solid rgba(170, 180, 190, 0.12);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.feedback-line {
    min-height: 24px;
    color: #cdb07a;
}

.feedback-line[data-state="success"] {
    color: #b9cdbd;
}

.feedback-line[data-state="error"] {
    color: #ddb0aa;
}

.minor-text {
    color: var(--text-muted);
    font-size: 0.92rem;
}

@media (max-width: 900px) {
    .app-shell {
        width: min(100vw - 20px, 1680px);
        padding-top: 16px;
    }

    .topbar {
        flex-direction: column;
    }
}
