:root {
    --bg: #fbf7f0;
    --surface: #ffffff;
    --ink: #15110d;
    --muted: #6f665c;
    --line: #e8ddcd;
    --gold: #b88a2c;
    --gold-soft: #ead9b8;
    --danger: #b42318;
    --success: #027a48;
    --shadow: 0 20px 60px rgba(21, 17, 13, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

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

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .78rem .9rem;
    background: #fff;
    color: var(--ink);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: .85rem;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: .85rem;
    text-transform: uppercase;
}

main {
    min-height: calc(100vh - 160px);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 72px;
    padding: 0 5vw;
    border-bottom: 1px solid rgba(232, 221, 205, .8);
    background: rgba(251, 247, 240, .92);
    backdrop-filter: blur(14px);
}

.brand,
.nav,
.actions,
.meta-row,
.card-tags,
.section-heading {
    display: flex;
    align-items: center;
    gap: .8rem;
}

.brand {
    font-weight: 800;
}

.brand-logo {
    width: 112px;
    max-height: 44px;
    object-fit: contain;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: #fff;
    background: var(--ink);
}

.nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: .95rem;
}

.notification-link {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--gold);
}

.inline {
    display: inline;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid var(--ink);
    border-radius: 8px;
    padding: .75rem 1rem;
    background: var(--ink);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.button.ghost {
    background: transparent;
    color: var(--ink);
}

.button.disabled {
    pointer-events: none;
    opacity: .55;
}

.button.small,
.button-small {
    min-height: 36px;
    padding: .45rem .75rem;
    font-size: .88rem;
}

.beta-pill {
    border: 1px solid var(--gold-soft);
    border-radius: 999px;
    padding: .28rem .6rem;
    color: var(--gold);
    font-weight: 800;
}

.button.full,
.full {
    width: 100%;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
    gap: clamp(2rem, 4vw, 5rem);
    align-items: center;
    min-height: calc(100vh - 96px);
    padding: 8vh 5vw 6vh;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, .64), rgba(234, 217, 184, .34)),
        radial-gradient(circle at 75% 20%, rgba(184, 138, 44, .18), transparent 30%);
}

.hero h1 {
    max-width: 960px;
    margin: 0;
    font-size: clamp(2.4rem, 6vw, 5.8rem);
    line-height: .96;
    letter-spacing: 0;
}

.hero p {
    max-width: 680px;
    color: var(--muted);
    font-size: 1.08rem;
}

.hero-panel,
.auth-card,
.install-card,
.plan-card,
.prompt-card,
.metric,
.list-item,
.locked-box,
.admin-form {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 1.4rem;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    justify-content: end;
    background: linear-gradient(160deg, #17120d, #4a3823);
    color: #fff;
}

.ad-banner {
    margin: 1rem 5vw 0;
    border: 1px solid rgba(184, 138, 44, .32);
    border-radius: 8px;
    background: #17120d;
    color: #fff;
    overflow: hidden;
}

.ad-banner a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 96px;
    padding: .9rem 1rem;
}

.ad-banner picture,
.ad-banner img {
    display: block;
}

.ad-banner picture {
    flex: 0 0 min(42%, 460px);
}

.ad-banner img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 6px;
}

.ad-banner-copy {
    display: grid;
    gap: .25rem;
    flex: 1;
}

.ad-banner-copy small {
    color: rgba(255, 255, 255, .78);
}

.hero-panel span,
.eyebrow {
    color: var(--gold);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.band {
    padding: 4rem 5vw;
}

.band h1,
.band h2,
.auth-card h1,
.install-card h1 {
    margin-top: 0;
}

.feature-grid,
.plans-grid,
.card-grid,
.metric-grid,
.profession-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.profession-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin: 1rem 0;
}

.profession-card {
    display: grid;
    gap: .35rem;
    min-height: 132px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profession-card.active,
.profession-card:hover {
    border-color: var(--profession-accent, var(--gold));
}

.profession-icon {
    color: var(--profession-accent, var(--gold));
    font-size: 1.5rem;
}

.profession-image {
    width: 100%;
    aspect-ratio: 16 / 8;
    object-fit: cover;
    border-radius: 6px;
    background: var(--bg);
}

.profession-card em {
    color: var(--muted);
    font-size: .9rem;
    font-style: normal;
}

.profession-card small,
.rating-line {
    color: var(--muted);
}

.feature-grid article {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.plan-card,
.prompt-card,
.metric,
.list-item {
    padding: 1rem;
}

.plan-card.featured {
    border-color: var(--gold);
    box-shadow: 0 18px 50px rgba(184, 138, 44, .16);
}

.plan-badge {
    display: inline-flex;
    width: fit-content;
    border: 1px solid var(--gold-soft);
    border-radius: 999px;
    padding: .25rem .55rem;
    color: var(--gold);
    font-size: .78rem;
    font-weight: 800;
}

.price {
    font-size: 1.75rem;
    font-weight: 900;
}

.muted {
    color: var(--muted);
}

.prompt-card {
    display: flex;
    flex-direction: column;
    min-height: 230px;
}

.prompt-card p {
    color: var(--muted);
    flex: 1;
}

.card-tags {
    flex-wrap: wrap;
}

.card-tags span,
.meta-row span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .25rem .55rem;
    color: var(--muted);
    font-size: .78rem;
}

.auth-card,
.install-card {
    max-width: 520px;
    margin: 7vh auto;
    padding: 1.2rem;
}

.auth-card.wide {
    max-width: 840px;
}

.form-grid {
    display: grid;
    gap: .85rem;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.check {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.check input {
    width: auto;
}

.flash {
    width: min(1100px, 90vw);
    margin: 1rem auto 0;
    border-radius: 8px;
    padding: .8rem 1rem;
    background: #fff;
    border: 1px solid var(--line);
}

.flash.success {
    color: var(--success);
    border-color: rgba(2, 122, 72, .25);
}

.flash.error {
    color: var(--danger);
    border-color: rgba(180, 35, 24, .25);
}

.flash.warning {
    color: #92400e;
    border-color: #fed7aa;
}

.dashboard-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    padding: 4rem 5vw 2rem;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 3rem 5vw 1rem;
}

.avatar {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 900;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    justify-content: flex-end;
}

.compact {
    padding-top: 1.4rem;
    padding-bottom: 1.4rem;
}

.prompt-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    padding: 4rem 5vw;
}

.prompt-main,
.prompt-side {
    min-width: 0;
}

.prompt-box {
    white-space: pre-wrap;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    background: #17120d;
    color: #fff;
}

.prompt-side {
    position: sticky;
    top: 96px;
    align-self: start;
    display: grid;
    gap: 1rem;
}

.stack {
    display: grid;
    gap: .8rem;
}

.filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 220px 180px auto;
    gap: .8rem;
    margin-bottom: 1rem;
}

.filters.advanced {
    grid-template-columns: minmax(240px, 1fr) repeat(5, minmax(130px, 170px)) auto;
}

.empty {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 1rem;
    color: var(--muted);
}

.footer {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 2rem 5vw;
    color: var(--muted);
}

.admin-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem 5vw 4rem;
}

.admin-menu {
    position: sticky;
    top: 88px;
    align-self: start;
    display: grid;
    gap: .35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .6rem;
    background: var(--surface);
}

.admin-menu strong {
    margin: .45rem .65rem .1rem;
    color: var(--gold);
    font-size: .72rem;
    text-transform: uppercase;
}

.admin-menu a {
    border-radius: 8px;
    padding: .65rem .75rem;
}

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

.tabs-grid fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

.tabs-grid legend {
    color: var(--gold);
    font-weight: 800;
}

.prompt-editor label,
.tabs-grid label {
    display: grid;
    gap: .35rem;
    margin-bottom: .7rem;
}

.quote-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 1rem;
}

.unread {
    border-color: var(--gold);
}

.content-body {
    border-top: 1px solid var(--line);
    margin-top: 1rem;
    padding-top: 1rem;
}

.rating-form {
    display: grid;
    gap: .7rem;
    margin-top: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

.admin-menu a:hover {
    background: var(--bg);
}

.admin-content {
    min-width: 0;
}

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

.metric span {
    color: var(--muted);
}

.metric strong {
    display: block;
    font-size: 1.7rem;
}

.admin-form {
    margin-bottom: 1.4rem;
    padding: 1rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.inline-edit {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
}

.inline-edit input,
.inline-edit select {
    width: auto;
    min-width: 120px;
}

.danger {
    color: var(--danger);
}

.danger-zone {
    margin-top: 1.4rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.danger-button {
    border-color: rgba(180, 35, 24, .35);
    color: var(--danger);
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.is-deleted {
    opacity: .62;
}

.alert {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .8rem 1rem;
    background: #fff;
    white-space: pre-wrap;
}

.alert.warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #92400e;
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(280px, 1fr);
    gap: 1rem;
}

.narrow {
    width: min(760px, 90vw);
    margin: 7vh auto;
}

@media (max-width: 860px) {
    .topbar,
    .dashboard-head,
    .footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero,
    .prompt-detail,
    .admin-shell,
    .two-col,
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
        padding-top: 3rem;
    }

    .prompt-side,
    .admin-menu {
        position: static;
    }

    .filters,
    .filters.advanced,
    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .nav {
        justify-content: flex-start;
    }

    .dashboard-actions {
        justify-content: flex-start;
    }

    .ad-banner a {
        align-items: stretch;
        flex-direction: column;
    }

    .ad-banner picture {
        flex-basis: auto;
    }
}
