:root {
    --bg: #f4efe8;
    --paper: rgba(255, 249, 241, 0.82);
    --paper-strong: #fffaf5;
    --ink: #1b1a18;
    --muted: #6c6258;
    --line: rgba(90, 68, 44, 0.14);
    --brand: #cc5f2f;
    --brand-dark: #a94a22;
    --brand-soft: rgba(204, 95, 47, 0.12);
    --teal: #0f766e;
    --danger: #b42318;
    --success: #166534;
    --shadow: 0 24px 60px rgba(48, 32, 17, 0.12);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(204, 95, 47, 0.20), transparent 28%),
        radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.17), transparent 26%),
        linear-gradient(180deg, #fdf8f1 0%, #efe3d4 100%);
}

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

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

button {
    cursor: pointer;
}

.page-auth,
.page-app {
    position: relative;
}

.auth-shell,
.install-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 100vh;
    display: grid;
    align-items: center;
    gap: 24px;
    padding: 32px 0;
}

.auth-shell {
    grid-template-columns: 1.15fr 0.85fr;
}

.install-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

.auth-hero,
.install-copy,
.auth-card,
.panel,
.hero-panel,
.sidebar,
.sidebar-card {
    backdrop-filter: blur(18px);
}

.auth-hero,
.install-copy {
    padding: 48px;
    border-radius: var(--radius-xl);
    background: linear-gradient(145deg, rgba(34, 24, 16, 0.90), rgba(67, 37, 22, 0.82));
    color: #fff7ef;
    box-shadow: var(--shadow);
}

.auth-hero h1,
.install-copy h1,
.hero-panel h1,
.panel h2,
.history-card h3,
.result-meta h3 {
    font-family: "Space Grotesk", sans-serif;
}

.eyebrow {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-hero h1,
.install-copy h1 {
    margin: 18px 0 12px;
    font-size: clamp(2.4rem, 5vw, 4.4rem);
    line-height: 0.96;
}

.auth-hero p,
.install-copy p {
    margin: 0;
    color: rgba(255, 247, 239, 0.78);
    font-size: 1.05rem;
    line-height: 1.7;
}

.hero-badges,
.install-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0;
    margin: 28px 0 0;
    list-style: none;
}

.hero-badges span,
.install-list li {
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-card {
    padding: 28px;
    border-radius: var(--radius-xl);
    background: var(--paper);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--shadow);
}

.install-form-card {
    align-self: stretch;
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 22px;
}

.auth-tabs a {
    padding: 14px 16px;
    text-align: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.62);
    color: var(--muted);
    font-weight: 700;
}

.auth-tabs a.active {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

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

label {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.94rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.84);
    color: var(--ink);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(204, 95, 47, 0.45);
    box-shadow: 0 0 0 4px rgba(204, 95, 47, 0.12);
    transform: translateY(-1px);
}

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-ghost,
.icon-btn {
    border: none;
    border-radius: 16px;
    padding: 14px 18px;
    font-weight: 800;
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover,
.btn-ghost:hover,
.icon-btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.btn-secondary {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.btn-danger {
    color: #fff;
    background: linear-gradient(135deg, #d24b42, #b42318);
}

.btn-ghost {
    width: 100%;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.icon-btn {
    padding: 10px 12px;
    color: var(--teal);
    background: rgba(15, 118, 110, 0.10);
}

.small-btn {
    padding: 10px 14px;
    border-radius: 14px;
}

.auth-note {
    margin: 16px 0 0;
    color: var(--muted);
    text-align: center;
}

.auth-note a {
    color: var(--brand-dark);
    font-weight: 700;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.alert.success {
    color: var(--success);
    background: rgba(22, 101, 52, 0.10);
    border-color: rgba(22, 101, 52, 0.15);
}

.alert.error {
    color: var(--danger);
    background: rgba(180, 35, 24, 0.10);
    border-color: rgba(180, 35, 24, 0.15);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.app-frame {
    display: grid;
    grid-template-columns: 290px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px;
    background: linear-gradient(180deg, rgba(34, 24, 16, 0.97), rgba(60, 32, 20, 0.93));
    color: #fff7ef;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-wrap {
    display: flex;
    gap: 14px;
    align-items: center;
}

.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--brand), #ffac5a);
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
}

.brand-name {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
}

.brand-subtitle {
    color: rgba(255, 247, 239, 0.68);
    font-size: 0.92rem;
}

.nav {
    display: grid;
    gap: 10px;
}

.nav a {
    padding: 14px 16px;
    border-radius: 16px;
    color: rgba(255, 247, 239, 0.78);
    font-weight: 700;
}

.nav a.active,
.nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
}

.sidebar-card {
    margin-top: auto;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 8px;
}

.sidebar-card span {
    color: rgba(255, 247, 239, 0.78);
}

.content {
    padding: 28px;
}

.app-shell {
    display: grid;
    gap: 24px;
}

.hero-panel {
    padding: 30px;
    border-radius: var(--radius-xl);
    background: linear-gradient(145deg, rgba(255, 250, 245, 0.88), rgba(248, 237, 224, 0.72));
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
}

.hero-panel h1 {
    margin: 10px 0 10px;
    font-size: clamp(2rem, 4vw, 3rem);
}

.hero-panel p,
.panel-head p,
.empty-state,
.history-summary,
.table-subtle,
.result-meta p {
    color: var(--muted);
}

.hero-stats {
    display: grid;
    gap: 14px;
    min-width: 220px;
}

.stat-card {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 1.8rem;
    font-family: "Space Grotesk", sans-serif;
}

.dashboard-grid,
.admin-grid {
    display: grid;
    gap: 24px;
}

.dashboard-grid {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
}

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

.panel {
    padding: 24px;
    border-radius: var(--radius-xl);
    background: var(--paper);
    border: 1px solid rgba(255, 255, 255, 0.62);
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
}

.panel-head h2 {
    margin: 0 0 6px;
    font-size: 1.6rem;
}

.result-panel {
    overflow: hidden;
}

.empty-state {
    padding: 28px;
    border-radius: 22px;
    border: 1px dashed rgba(90, 68, 44, 0.25);
    background: rgba(255, 255, 255, 0.4);
}

.empty-panel {
    text-align: center;
}

.hidden {
    display: none;
}

.result-stack {
    display: grid;
    gap: 18px;
}

.result-meta,
.history-card-head,
.copy-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.result-meta h3,
.history-card h3 {
    margin: 0 0 6px;
    font-size: 1.2rem;
}

.copy-grid {
    display: grid;
    gap: 16px;
}

.copy-group {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid var(--line);
}

.copy-head h4 {
    margin: 0 0 14px;
    font-size: 1.05rem;
}

.copy-list {
    display: grid;
    gap: 12px;
}

.copy-item {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(90, 68, 44, 0.08);
}

.copy-item p {
    margin: 0;
    line-height: 1.6;
}

.history-list {
    display: grid;
    gap: 16px;
}

.history-card {
    padding: 18px 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid var(--line);
}

.history-actions {
    display: flex;
    gap: 10px;
}

.history-summary {
    margin: 14px 0 0;
}

.pill {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 0.84rem;
    font-weight: 800;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(90, 68, 44, 0.12);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.88rem;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    min-width: 220px;
    max-width: 320px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(27, 26, 24, 0.92);
    color: #fff;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1100px) {
    .auth-shell,
    .install-card,
    .dashboard-grid,
    .app-frame {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
}

@media (max-width: 760px) {
    .auth-shell,
    .install-shell {
        width: min(100% - 20px, 1180px);
        padding: 20px 0;
    }

    .auth-hero,
    .install-copy,
    .auth-card,
    .panel,
    .hero-panel,
    .sidebar,
    .content {
        padding: 20px;
    }

    .hero-panel,
    .panel-head,
    .result-meta,
    .history-card-head {
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .history-actions,
    .form-actions {
        width: 100%;
    }

    .history-actions button,
    .form-actions button,
    .form-actions a {
        width: 100%;
    }
}
