:root {
    --bg: #f6f4ef;
    --surface: #ffffff;
    --surface-strong: #f0ede6;
    --text: #1d2328;
    --muted: #68727d;
    --line: #ded8cc;
    --brand: #116b63;
    --brand-dark: #0c4f49;
    --accent: #d05c3f;
    --danger: #b42318;
    --success: #207245;
    --shadow: 0 18px 50px rgba(32, 31, 27, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

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

img {
    display: block;
    max-width: 100%;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 64px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
    padding: 14px max(20px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid rgba(29, 35, 40, 0.08);
    background: rgba(246, 244, 239, 0.92);
    backdrop-filter: blur(16px);
}

.brand,
.nav,
.hero-actions,
.social-links,
.tabs,
.row-actions {
    display: flex;
    align-items: center;
}

.brand {
    gap: 10px;
    font-weight: 800;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-size: 13px;
}

.nav {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav a,
.tabs a {
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
}

.nav a:hover,
.tabs a:hover,
.tabs a.active {
    background: rgba(17, 107, 99, 0.1);
    color: var(--brand-dark);
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.button:hover,
button:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
}

.button.secondary {
    background: var(--surface);
    color: var(--brand-dark);
    border: 1px solid var(--line);
}

.button.danger,
button.danger {
    background: var(--danger);
}

.button.small,
button.small {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 13px;
}

.button.full {
    width: 100%;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.55fr);
    gap: 28px;
    align-items: stretch;
    min-height: 390px;
    padding: 52px;
    border-radius: 8px;
    background:
        linear-gradient(125deg, rgba(17, 107, 99, 0.92), rgba(29, 35, 40, 0.88)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='520' viewBox='0 0 900 520'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.18' stroke-width='2'%3E%3Cpath d='M0 420c120-62 219-75 330-38 115 38 238 78 385-2 81-44 143-58 185-43'/%3E%3Cpath d='M0 300c94-44 206-47 336-9 133 39 252 51 375-29 65-43 129-61 189-54'/%3E%3Cpath d='M0 178c126-35 244-18 356 51 99 61 200 68 305 19 89-42 169-52 239-32'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='0.15'%3E%3Ccircle cx='158' cy='128' r='62'/%3E%3Ccircle cx='722' cy='148' r='78'/%3E%3Ccircle cx='612' cy='392' r='46'/%3E%3C/g%3E%3C/svg%3E");
    background-size: cover;
    color: #fff;
    overflow: hidden;
}

.hero h1 {
    max-width: 760px;
    margin: 10px 0 16px;
    font-size: 46px;
    line-height: 1.08;
}

.hero p {
    max-width: 620px;
    margin: 0 0 24px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 18px;
}

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

.hero-actions .secondary {
    background: rgba(255, 255, 255, 0.92);
}

.hero-panel,
.metrics-grid,
.profile-grid,
.package-grid,
.workspace-grid {
    display: grid;
    gap: 18px;
}

.hero-panel {
    align-content: end;
}

.metric {
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
}

.metric strong {
    display: block;
    font-size: 36px;
    line-height: 1;
}

.metric span {
    display: block;
    margin-top: 7px;
    color: inherit;
    opacity: 0.82;
}

.metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 24px 0;
}

.metrics-grid .metric {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

.section {
    margin-top: 42px;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.section-head h1,
.section-head h2,
.section-head h3 {
    margin: 0;
}

.section-head p,
.muted,
.meta-line {
    color: var(--muted);
}

.profile-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-card,
.package-card,
.panel,
.auth-card,
.admin-row,
.admin-profile-card,
.empty-state {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(29, 35, 40, 0.06);
}

.profile-card {
    overflow: hidden;
}

.profile-cover {
    display: block;
    height: 148px;
    background:
        linear-gradient(135deg, rgba(17, 107, 99, 0.88), rgba(208, 92, 63, 0.8)),
        var(--surface-strong);
    background-size: cover;
    background-position: center;
}

.profile-card-body {
    position: relative;
    padding: 44px 18px 18px;
}

.profile-card-body .avatar {
    position: absolute;
    top: -36px;
    left: 18px;
}

.profile-card-title {
    display: grid;
    gap: 2px;
}

.profile-card-title a {
    font-size: 18px;
    font-weight: 800;
}

.profile-card-title span,
.admin-profile-main span {
    color: var(--muted);
    font-size: 14px;
}

.avatar {
    width: 72px;
    height: 72px;
    border: 4px solid var(--surface);
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-strong);
    box-shadow: 0 10px 22px rgba(29, 35, 40, 0.16);
}

.small-avatar {
    width: 50px;
    height: 50px;
    border-width: 2px;
}

.xl-avatar {
    width: 128px;
    height: 128px;
}

.avatar-fallback {
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    font-weight: 900;
}

.badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.badge.approved,
.flash.success {
    background: rgba(32, 114, 69, 0.12);
    color: var(--success);
}

.badge.pending {
    background: rgba(208, 92, 63, 0.13);
    color: #9b452f;
}

.badge.rejected,
.flash.danger {
    background: rgba(180, 35, 24, 0.11);
    color: var(--danger);
}

.badge.featured {
    background: rgba(208, 92, 63, 0.14);
    color: #9b3f28;
}

.package-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.package-card {
    display: grid;
    gap: 12px;
    padding: 24px;
}

.package-card h2 {
    margin: 0;
}

.package-card strong {
    font-size: 30px;
}

.auth-body,
.install-page {
    background: var(--surface-strong);
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 72px);
    width: min(940px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.auth-card {
    width: min(460px, 100%);
    padding: 28px;
}

.auth-card.wide {
    width: min(820px, 100%);
}

.auth-card h1 {
    margin: 6px 0 18px;
}

.form-grid {
    display: grid;
    gap: 14px;
}

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

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

label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-weight: 800;
    font-size: 14px;
}

input,
textarea,
select {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(17, 107, 99, 0.16);
    border-color: var(--brand);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.centered {
    text-align: center;
}

.flash-wrap {
    width: min(1180px, calc(100% - 32px));
    margin: 18px auto 0;
}

.flash-wrap.inline {
    margin-top: 0;
}

.flash {
    padding: 13px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 700;
}

.eyebrow {
    display: inline-flex;
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.dashboard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.dashboard-head h1 {
    margin: 4px 0;
}

.tabs {
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.workspace-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.7fr);
    align-items: start;
}

.panel {
    padding: 22px;
}

.panel h2 {
    margin: 0 0 16px;
}

.wide-panel {
    grid-column: span 1;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.photo-grid img,
.photo-grid figure {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    object-fit: cover;
    overflow: hidden;
}

.photo-grid.manage {
    margin-top: 18px;
}

.photo-grid figure {
    position: relative;
    margin: 0;
    background: var(--surface-strong);
}

.photo-grid figure img {
    height: 100%;
}

.photo-grid figure form {
    position: absolute;
    right: 8px;
    bottom: 8px;
}

.icon-danger {
    min-height: 32px;
    padding: 6px 9px;
    background: rgba(180, 35, 24, 0.92);
    font-size: 12px;
}

.admin-list,
.stack-list {
    display: grid;
    gap: 12px;
}

.admin-row,
.admin-profile-card,
.inline-edit {
    display: grid;
    gap: 14px;
    align-items: center;
}

.admin-row {
    grid-template-columns: auto 1fr auto;
    padding: 14px;
}

.admin-profile-card {
    padding: 18px;
}

.admin-profile-main {
    display: flex;
    align-items: center;
    gap: 13px;
}

.admin-profile-main > div {
    display: grid;
    gap: 3px;
}

.admin-controls {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 12px;
    align-items: end;
}

.inline-edit {
    grid-template-columns: auto repeat(4, minmax(120px, 1fr)) minmax(110px, auto) auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.package-edit {
    grid-template-columns: repeat(4, minmax(120px, 1fr)) repeat(3, minmax(90px, auto)) auto;
}

.social-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--surface-strong);
    overflow: hidden;
    font-weight: 900;
}

.social-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.public-profile {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.public-cover {
    min-height: 280px;
    background:
        linear-gradient(135deg, rgba(17, 107, 99, 0.86), rgba(208, 92, 63, 0.72)),
        var(--surface-strong);
    background-position: center;
    background-size: cover;
}

.public-main {
    display: flex;
    gap: 24px;
    padding: 0 32px 32px;
}

.public-main .xl-avatar {
    flex: 0 0 auto;
    margin-top: -64px;
}

.public-copy {
    min-width: 0;
    padding-top: 24px;
}

.public-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.public-title-row h1 {
    margin: 0;
    font-size: 34px;
}

.social-links {
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-weight: 800;
}

.empty-state {
    padding: 26px;
    text-align: center;
}

.narrow-page {
    width: min(680px, 100%);
    margin: 0 auto;
}

@media (max-width: 980px) {
    .hero,
    .workspace-grid,
    .metrics-grid,
    .profile-grid,
    .package-grid {
        grid-template-columns: 1fr;
    }

    .admin-controls,
    .inline-edit,
    .package-edit {
        grid-template-columns: 1fr 1fr;
    }

    .photo-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    main {
        width: min(100% - 24px, 1180px);
        padding-top: 24px;
    }

    .topbar,
    .dashboard-head,
    .section-head,
    .admin-row,
    .public-main {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar {
        position: static;
    }

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

    .hero {
        min-height: 0;
        padding: 28px;
    }

    .hero h1 {
        font-size: 34px;
    }

    .hero p {
        font-size: 16px;
    }

    .form-grid.two-cols,
    .admin-controls,
    .inline-edit,
    .package-edit {
        grid-template-columns: 1fr;
    }

    .row-actions {
        flex-wrap: wrap;
    }

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

    .public-cover {
        min-height: 210px;
    }

    .public-main {
        padding: 0 20px 24px;
        gap: 10px;
    }

    .public-title-row h1 {
        font-size: 28px;
    }
}
