:root {
    --bg: #f5f1e8;
    --bg-accent: radial-gradient(circle at top left, rgba(255, 196, 122, 0.6), transparent 38%), linear-gradient(180deg, #fefcf6 0%, #f0eadf 100%);
    --panel: rgba(255, 255, 255, 0.82);
    --panel-border: rgba(52, 44, 34, 0.12);
    --text: #201911;
    --muted: #6f665b;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --secondary: #fff6e8;
    --shadow: 0 24px 80px rgba(32, 25, 17, 0.12);
}

[data-theme="dark"] {
    --bg: #101512;
    --bg-accent: radial-gradient(circle at top left, rgba(15, 118, 110, 0.35), transparent 32%), linear-gradient(180deg, #141a17 0%, #0d120f 100%);
    --panel: rgba(18, 24, 21, 0.88);
    --panel-border: rgba(230, 244, 234, 0.1);
    --text: #ecf7ef;
    --muted: #95ab9c;
    --accent: #34d399;
    --accent-strong: #10b981;
    --secondary: rgba(24, 35, 30, 0.9);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-accent);
    color: var(--text);
}

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

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

.sidebar {
    padding: 24px;
    border-right: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.brand-mark {
    display: inline-flex;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #f59e0b);
    color: #fff;
    font-weight: 700;
}

.brand small,
.muted {
    color: var(--muted);
}

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

.sidebar-nav a,
.theme-toggle {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.theme-toggle {
    margin-top: 18px;
    width: 100%;
    color: var(--text);
    cursor: pointer;
}

.full-width {
    width: 100%;
}

.main {
    padding: 32px;
}

.hero-card,
.panel,
.alert {
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.9fr);
    gap: 24px;
    padding: 32px;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 0.95;
    margin-bottom: 16px;
}

.lead {
    max-width: 640px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--muted);
}

.lead.compact,
.compact {
    font-size: 0.96rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: 600;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.button.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
}

.button.secondary {
    background: var(--secondary);
    border: 1px solid var(--panel-border);
}

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

.hero-stats article {
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--panel-border);
}

.hero-stats strong,
.checklist span {
    display: block;
    margin-bottom: 6px;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.panel {
    padding: 24px;
}

.alert {
    padding: 16px 18px;
    margin-bottom: 18px;
    border-radius: 18px;
}

.alert-error {
    border-color: rgba(220, 38, 38, 0.2);
    background: rgba(254, 226, 226, 0.88);
    color: #991b1b;
}

.alert-success {
    border-color: rgba(5, 150, 105, 0.2);
    background: rgba(209, 250, 229, 0.88);
    color: #065f46;
}

.alert-info {
    border-color: rgba(15, 118, 110, 0.2);
    background: rgba(204, 251, 241, 0.88);
    color: #115e59;
}

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

.auth-card {
    max-width: 560px;
    display: grid;
    gap: 24px;
}

.installer-shell {
    padding: 28px;
}

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

.stepper {
    display: grid;
    gap: 10px;
    min-width: min(340px, 100%);
}

.step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.45);
}

.step span,
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    font-weight: 700;
}

.step-current {
    border-color: rgba(15, 118, 110, 0.24);
}

.step-current span,
.pill-ok {
    background: rgba(16, 185, 129, 0.18);
    color: #047857;
}

.step-done span {
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
}

.step-pending span,
.pill-fail {
    background: rgba(220, 38, 38, 0.14);
    color: #b91c1c;
}

.install-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.panel.inset {
    border-radius: 22px;
}

.check-rows {
    display: grid;
    gap: 12px;
}

.check-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 16px 0;
    border-bottom: 1px solid var(--panel-border);
}

.check-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

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

.single-column {
    grid-template-columns: 1fr;
}

.form-grid label {
    display: grid;
    gap: 8px;
}

.form-grid span {
    font-weight: 600;
}

.form-grid input,
.form-grid textarea,
.form-grid select,
.search-form input,
.builder-row select,
.builder-row input,
.search-stack input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
    font: inherit;
}

.form-grid textarea {
    resize: vertical;
}

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

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

.checkbox-field {
    display: flex !important;
    align-items: center;
    gap: 12px;
}

.checkbox-field input {
    width: 18px;
    height: 18px;
}

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

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.user-card {
    display: grid;
    gap: 10px;
    margin-top: 18px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--panel-border);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.stat-card {
    padding: 20px 22px;
    border-radius: 22px;
    border: 1px solid var(--panel-border);
    background: var(--panel);
    box-shadow: var(--shadow);
}

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

.stat-card strong {
    font-size: 1.8rem;
    line-height: 1;
}

.section-head,
.search-form,
.builder-row,
.totals-card div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-head {
    justify-content: space-between;
    margin-bottom: 18px;
}

.search-form {
    min-width: min(360px, 100%);
}

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

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

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--panel-border);
    vertical-align: top;
}

.data-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.text-danger {
    color: #b91c1c;
    font-weight: 700;
}

.builder,
.split-payments,
.search-stack {
    display: grid;
    gap: 12px;
}

.builder-row {
    align-items: stretch;
}

.builder-row > * {
    flex: 1 1 0;
}

.search-results {
    display: grid;
    gap: 8px;
}

.search-result {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.72);
    cursor: pointer;
}

.search-result strong,
.search-result span {
    display: block;
}

.search-result span {
    color: var(--muted);
    margin-top: 4px;
}

.pos-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.totals-card {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.6);
}

.totals-card div {
    justify-content: space-between;
}

.top-gap {
    margin-top: 18px;
}

.checklist {
    display: grid;
    gap: 10px;
    margin: 20px 0;
}

.checklist span {
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--secondary);
    border: 1px solid var(--panel-border);
}

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

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--panel-border);
    }

    .hero-card {
        grid-template-columns: 1fr;
    }

    .installer-header,
    .form-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .form-actions {
        flex-direction: column;
    }

    .module-grid,
    .section-head,
    .search-form,
    .builder-row {
        grid-template-columns: 1fr;
        display: grid;
    }

    .pagination {
        flex-direction: column;
        align-items: stretch;
    }
}
