:root {
    --bg: #f3efe5;
    --panel: rgba(255, 252, 247, 0.92);
    --ink: #17211f;
    --muted: #5f6e69;
    --line: rgba(23, 33, 31, 0.12);
    --accent: #0f766e;
    --accent-2: #d97706;
    --danger: #b42318;
    --shadow: 0 18px 60px rgba(23, 33, 31, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(217, 119, 6, 0.12), transparent 34%),
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.18), transparent 28%),
        linear-gradient(180deg, #f7f2e7 0%, #eef5f3 100%);
}

.page-shell {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 56px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.brand {
    color: var(--ink);
    text-decoration: none;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-pill,
.badge {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.7);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
}

.flash {
    padding: 14px 16px;
    border-radius: 18px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.flash-success {
    background: #def7ec;
}

.flash-error {
    background: #fde7e9;
}

.hero {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
    align-items: stretch;
}

.hero.compact {
    grid-template-columns: 1.6fr 1.2fr;
}

.hero-copy,
.hero-card,
.panel,
.stat-card {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.hero-copy,
.hero-card,
.panel {
    border-radius: 28px;
    padding: 24px;
}

.hero-copy h1 {
    font-size: clamp(2.1rem, 5vw, 4rem);
    line-height: 0.95;
    margin: 0 0 14px;
}

.hero-text,
.muted,
.lead-card p,
.lead-meta span,
.lead-meta small,
.simple-list,
.stack-list {
    color: var(--muted);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 700;
}

.grid {
    display: grid;
    gap: 24px;
}

.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.partner-grid {
    grid-template-columns: 380px 1fr;
}

.wide {
    grid-column: 1 / -1;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    border-radius: 24px;
    padding: 18px;
}

.stat-card span {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
}

.stat-card small {
    color: var(--muted);
}

.stack,
.stack-list,
.lead-list {
    display: grid;
    gap: 12px;
}

.simple-list,
.stack-list {
    margin: 0;
    padding-left: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.full-span {
    grid-column: 1 / -1;
}

label,
fieldset {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.78);
}

textarea {
    resize: vertical;
}

button,
.button-link {
    border: 0;
    border-radius: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--accent), #155e75);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.ghost-button {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

.ghost-button.danger {
    color: var(--danger);
}

.inline-form {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.helper-card,
.detail-card,
.lead-card {
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.68);
    padding: 16px;
}

.helper-title {
    margin-top: 0;
    font-weight: 700;
}

.table-scroll {
    overflow-x: auto;
    max-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.actions-cell {
    display: flex;
    gap: 10px;
    align-items: center;
}

.lead-card {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: transform 140ms ease, border-color 140ms ease;
}

.lead-card:hover,
.lead-card.active {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.45);
}

.hero-copy,
.hero-card,
.panel,
.stat-card,
.detail-card,
.lead-card {
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

@media (hover: hover) {
    .hero-copy:hover,
    .hero-card:hover,
    .panel:hover,
    .stat-card:hover,
    .detail-card:hover,
    .lead-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 22px 64px rgba(23, 33, 31, 0.14);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-copy,
    .hero-card,
    .panel,
    .stat-card,
    .detail-card,
    .lead-card {
        transition: none;
    }

    .hero-copy:hover,
    .hero-card:hover,
    .panel:hover,
    .stat-card:hover,
    .detail-card:hover,
    .lead-card:hover,
    .lead-card.active {
        transform: none;
    }
}

.lead-meta {
    text-align: right;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.check-grid {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    display: grid;
    gap: 10px;
}

.check-option {
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 500;
}

.check-option input {
    width: auto;
}

@media (max-width: 980px) {
    .hero,
    .hero.compact,
    .two-up,
    .admin-grid,
    .partner-grid,
    .detail-grid,
    .stat-row,
    .form-grid {
        /* minmax(0, 1fr) keeps wide content such as the approvals table from
           forcing the single-column track past the viewport width. */
        grid-template-columns: minmax(0, 1fr);
    }

    .page-shell {
        width: min(100% - 20px, 1280px);
    }

    .inline-form,
    .actions-cell {
        flex-direction: column;
        align-items: stretch;
    }
}
