* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: #1d1d1b;
    background:
        radial-gradient(circle at top right, rgba(207, 226, 243, 0.8), transparent 28%),
        linear-gradient(180deg, #f8f2e8 0%, #f4eee4 100%);
}

.guest-body {
    background: #f4f7f5;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.guest-topbar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(20px, calc((100vw - 1180px) / 2));
    background: #fff;
    border-bottom: 1px solid #dce6e0;
}

.guest-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #17322c;
    text-decoration: none;
}

.guest-brand span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    background: #146c54;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.guest-topbar nav {
    display: flex;
    gap: 20px;
}

.guest-topbar nav a {
    color: #275d63;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.guest-main {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 38px 0 70px;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

a {
    color: #164c5a;
}

.sidebar {
    padding: 32px 24px;
    background: #0f3d3e;
    color: #f7f0e4;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar h1,
.page-header h2,
.card h3,
.auth-card h2 {
    margin: 0;
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    opacity: 0.7;
}

.muted {
    color: rgba(29, 29, 27, 0.7);
}

.sidebar .muted,
.sidebar a,
.sidebar span {
    color: rgba(247, 240, 228, 0.8);
}

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

.portal-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 6px 0;
}

.portal-tab {
    display: grid;
    gap: 4px;
    min-width: 220px;
    padding: 14px 16px;
    border: 1px solid rgba(39, 93, 99, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.74);
    color: #164c5a;
    text-decoration: none;
}

.portal-tab.is-active {
    border-color: rgba(177, 79, 45, 0.5);
    background: rgba(177, 79, 45, 0.1);
}

.portal-tab span {
    font-size: 13px;
    color: rgba(29, 29, 27, 0.68);
}

.portal-tab strong {
    font-size: 16px;
}

.nav a,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: 160ms ease;
}

.nav a {
    background: rgba(255, 255, 255, 0.08);
}

.nav a:hover,
.button:hover {
    transform: translateY(-1px);
}

.main {
    padding: 32px;
    display: grid;
    gap: 24px;
}

.page-header,
.section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

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

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

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

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

.admin-grid {
    grid-template-columns: minmax(280px, 360px) 1fr;
}

.card {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(15, 61, 62, 0.12);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 18px 40px rgba(42, 61, 69, 0.08);
}

.narrow {
    max-width: 620px;
}

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

label {
    display: grid;
    gap: 8px;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #c9c2b6;
    background: rgba(255, 255, 255, 0.9);
    font: inherit;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 960px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid #e6dece;
    text-align: left;
    vertical-align: top;
}

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

.button {
    background: #b14f2d;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(177, 79, 45, 0.22);
}

.button.secondary {
    background: #275d63;
    box-shadow: 0 10px 24px rgba(39, 93, 99, 0.2);
}

.button.danger {
    background: #8a2d2d;
    box-shadow: none;
}

.flash {
    padding: 14px 16px;
    border-radius: 14px;
}

.flash-success {
    background: #dff3df;
    color: #144714;
}

.flash-error {
    background: #f8dddd;
    color: #6c1b1b;
}

.user-card {
    margin-top: auto;
    padding: 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 4px;
}

.stat-card strong {
    font-size: 40px;
}

.json-view {
    padding: 16px;
    border-radius: 16px;
    background: #f5efe5;
    overflow: auto;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    position: sticky;
    bottom: 16px;
    padding: 12px 0 4px;
}

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

.hero-copy,
.hero-panel {
    padding: 28px;
}

.hero-copy {
    border-radius: 28px;
    background:
        linear-gradient(135deg, rgba(15, 61, 62, 0.92), rgba(39, 93, 99, 0.88)),
        linear-gradient(180deg, #f8f2e8 0%, #f4eee4 100%);
    color: #f7f0e4;
    box-shadow: 0 26px 54px rgba(15, 61, 62, 0.22);
}

.hero-copy .hero-text,
.hero-copy .eyebrow {
    color: rgba(247, 240, 228, 0.85);
}

.hero-copy h2 {
    margin: 0 0 12px;
    font-size: clamp(36px, 5vw, 58px);
    line-height: 1.03;
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.hero-panel {
    display: grid;
    gap: 16px;
}

.mini-stat {
    padding: 18px;
    border-radius: 18px;
    background: rgba(245, 239, 229, 0.8);
    border: 1px solid rgba(15, 61, 62, 0.12);
}

.mini-stat span,
.stat-card span {
    display: block;
    font-size: 14px;
    color: rgba(29, 29, 27, 0.7);
}

.mini-stat strong {
    display: block;
    margin-top: 6px;
    font-size: 22px;
}

.feature-card h3 {
    margin-bottom: 10px;
}

.portal-intro {
    display: grid;
    gap: 16px;
}


.module-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.module-card {
    display: grid;
    gap: 16px;
}

.module-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.module-head p {
    margin: 6px 0 0;
}

.module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.module-body[hidden] {
    display: none;
}

.module-toggle {
    min-width: 108px;
}

.section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.section-nav a,
.chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(39, 93, 99, 0.1);
    border: 1px solid rgba(39, 93, 99, 0.16);
    color: #164c5a;
    font-size: 13px;
    text-decoration: none;
}

.survey-form .card {
    scroll-margin-top: 24px;
}

.survey-form .card.is-active {
    border-color: rgba(177, 79, 45, 0.45);
    box-shadow: 0 20px 44px rgba(177, 79, 45, 0.1);
}

.repeater .section-title p {
    margin: 6px 0 0;
}

.dashboard-hero {
    padding: 4px 0 8px;
}

.vap-public-hero {
    min-height: 65vh;
    display: grid;
    grid-template-columns: 1.5fr .6fr;
    align-items: center;
    gap: 50px;
}

.vap-public-hero h2 {
    max-width: 850px;
    margin: 10px 0 22px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(44px, 6vw, 76px);
    line-height: 1.03;
}

.vap-public-hero p:not(.eyebrow) {
    max-width: 680px;
    color: rgba(29, 29, 27, .66);
    font-size: 19px;
}

.vap-public-panel {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px 18px;
    align-items: center;
    padding: 38px;
    background: #0c4c3b;
    color: white;
    box-shadow: 0 12px 34px rgba(24,55,46,.12);
}

.vap-public-panel strong {
    color: #aee4ce;
    font-size: 42px;
}

.vap-public-panel span { font-size: 16px; }

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

.visual-card {
    min-height: 190px;
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    padding: 22px;
    background: #fff;
    border: 1px solid rgba(15, 61, 62, .12);
    box-shadow: 0 16px 38px rgba(42, 61, 69, .08);
}

.visual-card h3 { margin: 0 0 8px; font-size: 19px; }
.visual-card p { margin: 0; color: rgba(29, 29, 27, .65); font-size: 14px; }

.radial-graphic {
    width: 78px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(#b14f2d var(--value), #edf1ef 0);
    position: relative;
}

.radial-graphic.modules { background: conic-gradient(#275d63 var(--value), #edf1ef 0); }

.radial-graphic::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: #fff;
}

.radial-graphic span { position: relative; z-index: 1; font-size: 24px; color: #0f3d3e; }

.people-graphic {
    width: 84px;
    min-height: 94px;
    display: grid;
    grid-template-columns: repeat(3, 20px);
    align-content: center;
    justify-content: center;
    gap: 8px;
}

.people-graphic span {
    width: 20px;
    height: 20px;
    border-radius: 50% 50% 42% 42%;
    background: #275d63;
    box-shadow: inset 0 -8px 0 rgba(255,255,255,.18);
}

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

.module-node {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    padding: 15px;
    border: 1px solid rgba(39, 93, 99, .14);
    color: #164c5a;
    text-decoration: none;
}

.module-node span { font-weight: 700; }
.module-node small { color: rgba(29,29,27,.6); }
.module-node i {
    grid-row: span 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: conic-gradient(#275d63 var(--intensity), #e6ece9 0);
    box-shadow: inset 0 0 0 8px #fff;
}

@media (max-width: 1024px) {
    .shell,
    .hero,
    .admin-grid,
    .dashboard-stats,
    .visual-overview,
    .module-map,
    .vap-public-hero,
    .module-metrics-grid,
    .chart-grid,
    .two-up,
    .three-up {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 16px;
    }

    .main {
        padding: 20px;
    }

    .hero-copy {
        padding: 24px;
    }

    .vap-public-panel {
        max-width: 420px;
    }

    .form-actions {
        position: static;
    }
}

@media (max-width: 720px) {
    .page-header,
    .section-title,
    .module-head,
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

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

    .sidebar {
        padding: 20px;
    }

    .guest-topbar {
        padding: 0 16px;
    }

    .guest-topbar nav a:first-child {
        display: none;
    }
}


.detail-grid p {
    margin: 0;
}

.cell-muted {
    opacity: 0.55;
}


.mobile-tip {
    margin: 0;
}

input,
select,
textarea,
.button {
    min-height: 48px;
}

.section-nav {
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.section-nav a {
    white-space: nowrap;
}

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

    .sidebar {
        padding: 18px;
    }

    .main {
        padding: 16px;
    }

    .page-header,
    .section-title,
    .module-head,
    .hero-actions,
    .module-actions,
    .module-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions {
        position: sticky;
        bottom: 8px;
        background: linear-gradient(180deg, rgba(248,242,232,0), rgba(248,242,232,0.96) 30%);
        padding-top: 16px;
    }
}

@media (max-width: 768px) {
    .card {
        padding: 16px;
        border-radius: 16px;
    }

    .table-wrap {
        overflow: visible;
    }

    table {
        min-width: 0;
        width: 100%;
        display: block;
    }

    thead {
        display: none;
    }

    tbody {
        display: grid;
        gap: 12px;
    }

    tbody[data-rows] tr,
    .card table tbody tr {
        display: block;
        border: 1px solid #e6dece;
        border-radius: 14px;
        padding: 12px;
        background: #fffdfa;
        box-shadow: 0 10px 24px rgba(42, 61, 69, 0.06);
    }

    td {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 8px 0;
        border-bottom: 1px dashed #eadfcb;
    }

    td:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    td::before {
        content: attr(data-label);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #275d63;
    }

    td .button.danger {
        width: 100%;
    }

    .module-body {
        overflow: visible;
    }

    .chip {
        justify-content: center;
    }
}


.collector-tools {
    justify-content: flex-start;
}

.photo-block {
    display: grid;
    gap: 8px;
}

.photo-hint {
    font-size: 13px;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.photo-gallery img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #ddd2c0;
}


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

.metric-mini {
    display: grid;
    gap: 8px;
}

.metric-mini strong {
    font-size: 28px;
}


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

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

.bar-row {
    display: grid;
    gap: 6px;
}

.bar-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.bar-track {
    height: 12px;
    border-radius: 999px;
    background: rgba(39, 93, 99, 0.12);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #275d63, #b14f2d);
}


.field-hidden {
    display: none !important;
}

.geo-status {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(39, 93, 99, 0.08);
    border: 1px solid rgba(39, 93, 99, 0.16);
    width: 100%;
}

.geo-status[data-tone="success"] {
    background: rgba(33, 115, 70, 0.12);
    border-color: rgba(33, 115, 70, 0.26);
    color: #175437;
}

.geo-status[data-tone="error"] {
    background: rgba(138, 45, 45, 0.12);
    border-color: rgba(138, 45, 45, 0.24);
    color: #7d2222;
}

.chart-card .section-title {
    align-items: center;
}

.chart-card .chip {
    white-space: nowrap;
}

.bar-meta strong {
    min-width: 44px;
    text-align: right;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.inline-delete {
    display: inline;
    margin: 0;
}

.inline-delete button {
    border: 0;
    background: none;
    color: #b42318;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

body {
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav a,
    .button,
    .hero-actions .button,
    .module-actions .button,
    .module-toolbar .button,
    .form-actions .button {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
        bottom: 0;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .module-toolbar,
    .module-actions,
    .hero-actions,
    .section-title,
    .page-header,
    .module-head {
        gap: 12px;
    }

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

    .bar-track {
        height: 14px;
    }
}

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

    .main {
        padding: 14px;
    }

    .sidebar {
        padding: 16px;
    }

    .card {
        padding: 14px;
        border-radius: 14px;
    }

    .photo-gallery {
        grid-template-columns: 1fr;
    }
}
