:root {
    --ink: #17211c;
    --muted: #5d6b63;
    --line: #dbe2dc;
    --paper: #f7f8f5;
    --white: #ffffff;
    --green: #16865a;
    --yellow: #c28a12;
    --red: #be3d35;
    --blue: #235b78;
    --shadow: 0 18px 50px rgba(24, 39, 31, .10);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header, .admin-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 24px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--white);
    font-weight: 800;
}
.brand small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}
.main-nav, .admin-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    overflow-x: auto;
}
.main-nav a, .admin-nav a, .admin-link {
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--ink);
    white-space: nowrap;
    font-size: 14px;
}
.main-nav a.active, .admin-nav a.active, .main-nav a:hover, .admin-nav a:hover, .admin-link {
    background: #edf2ee;
    text-decoration: none;
}

main { min-height: calc(100vh - 150px); }
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
    gap: 36px;
    align-items: center;
    padding: 72px 7vw 56px;
    background:
        linear-gradient(90deg, rgba(247,248,245,.98), rgba(247,248,245,.78)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1400' height='800'%3E%3Crect width='1400' height='800' fill='%23e2e9e3'/%3E%3Cg fill='none' stroke='%2391a59a' stroke-width='2' opacity='.45'%3E%3Cpath d='M150 620 C250 520 320 540 410 430 S640 270 780 340 980 500 1120 390 1290 230 1360 300'/%3E%3Cpath d='M60 360 C210 300 340 330 490 240 S780 100 920 160 1060 310 1260 190'/%3E%3C/g%3E%3Cg fill='%2316865a' opacity='.72'%3E%3Ccircle cx='410' cy='430' r='10'/%3E%3Ccircle cx='920' cy='160' r='10'/%3E%3Ccircle cx='1120' cy='390' r='10'/%3E%3C/g%3E%3C/svg%3E") center/cover;
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 12px;
    color: var(--green);
    font-weight: 700;
}
.hero h1 {
    max-width: 860px;
    margin: 0;
    font-size: clamp(40px, 6vw, 76px);
    line-height: 1.02;
}
.hero p { max-width: 650px; font-size: 19px; color: var(--muted); }
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}
.quick-actions a, button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    padding: 10px 14px;
    border: 0;
    border-radius: 7px;
    background: var(--ink);
    color: var(--white);
    font-weight: 700;
    cursor: pointer;
}
.quick-actions a:nth-child(2) { background: var(--green); }
.quick-actions a:nth-child(3) { background: var(--blue); }
.quick-actions a:hover, button:hover { filter: brightness(.94); text-decoration: none; }
.hero-panel, .info-card, .login-card, .admin-form {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.hero-panel { padding: 24px; }
.score-row, .compare-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}
.dot, .map-pin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
}
.green { background: var(--green); }
.yellow { background: var(--yellow); }
.red { background: var(--red); }

.band, .page-title, .card-grid, .detail-layout, .map-layout, .text-block, .download-grid, .public-form, .admin-main {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
}
.band, .page-title { padding: 42px 0 20px; }
.page-title h1, .section-heading h2 { margin: 0; font-size: clamp(30px, 4vw, 48px); }
.page-title p, .section-heading p { color: var(--muted); max-width: 760px; }
.card-grid {
    display: grid;
    gap: 18px;
    padding: 18px 0 54px;
}
.card-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.info-card {
    padding: 20px;
    min-width: 0;
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}
.kpi-grid.compact {
    margin-top: -22px;
    margin-bottom: 26px;
}
.kpi-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: var(--shadow);
}
.kpi-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}
.kpi-card strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1.05;
    overflow-wrap: anywhere;
}
.admin-kpi {
    border-left: 5px solid var(--blue);
}
.chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
    gap: 18px;
    margin: 18px 0 30px;
}
.admin-charts {
    margin-bottom: 44px;
}
.chart-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: var(--shadow);
}
.chart-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.chart-title h3 {
    margin: 0;
}
.chart-title span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}
.bar-chart {
    display: grid;
    gap: 11px;
}
.bar-row {
    display: grid;
    grid-template-columns: minmax(130px, 180px) minmax(0, 1fr) 42px;
    align-items: center;
    gap: 10px;
}
.bar-row > span {
    color: var(--ink);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-row div {
    height: 15px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2ee;
}
.bar-row i {
    display: block;
    height: 100%;
    border-radius: inherit;
}
.bar-row strong {
    text-align: right;
}
.donut-wrap {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: center;
    gap: 18px;
}
.donut {
    position: relative;
    display: grid;
    place-items: center;
    width: 150px;
    aspect-ratio: 1;
    border-radius: 50%;
}
.donut::after {
    content: "";
    position: absolute;
    inset: 28px;
    border-radius: 50%;
    background: var(--white);
}
.donut span {
    position: relative;
    z-index: 1;
    font-size: 30px;
    font-weight: 800;
}
.legend {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-weight: 700;
}
.info-card h2, .info-card h3 { margin: 8px 0; }
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}
.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    padding: 20px 0 34px;
}
.detail-main, .detail-side {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
}
.metric-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 0;
}
.dimension-list div {
    display: grid;
    grid-template-columns: 150px 1fr 45px;
    gap: 12px;
    align-items: center;
    margin: 10px 0;
}
meter { width: 100%; height: 16px; }
.compare-row {
    color: var(--ink);
}

.map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 20px;
    padding-bottom: 56px;
}
.map-canvas {
    position: sticky;
    top: 86px;
    min-height: 560px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.75), rgba(255,255,255,.25)),
        repeating-linear-gradient(45deg, #dfe8e2 0 22px, #edf3ee 22px 44px);
}
.map-pin {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.work-list {
    display: grid;
    gap: 14px;
}
.table-wrap {
    overflow-x: auto;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 36px;
}
.table-wrap.full { grid-column: 1 / -1; }
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}
th, td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th { background: #eef3ef; }

.public-form, .admin-form, .login-card {
    display: grid;
    gap: 14px;
    padding: 22px;
    margin-bottom: 52px;
}
label { display: grid; gap: 6px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #cbd6ce;
    border-radius: 7px;
    font: inherit;
    background: #fff;
}
textarea { resize: vertical; min-height: 92px; }
.check {
    display: flex;
    align-items: center;
    gap: 8px;
}
.check input { width: auto; }
.download-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding-bottom: 54px;
}
.download-grid a {
    padding: 22px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 700;
}
.text-block {
    max-width: 880px;
    padding: 12px 0 60px;
}
.notice {
    width: min(1180px, calc(100% - 36px));
    margin: 18px auto;
    padding: 12px 14px;
    border-radius: 7px;
    border: 1px solid var(--line);
}
.notice.success { background: #e7f5ec; color: #0f6641; }
.notice.error { background: #fbe9e7; color: #9b271f; }
.site-footer {
    display: flex;
    gap: 12px;
    padding: 28px 7vw;
    background: var(--ink);
    color: var(--white);
}

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
}
.login-card {
    width: min(420px, calc(100% - 32px));
}
.admin-main {
    padding: 26px 0 60px;
}
.admin-grid {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.admin-form.wide {
    width: min(900px, 100%);
    margin: 0 auto 60px;
}
.form-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.form-title-row h1 {
    margin: 0;
}
.small-action {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 7px;
    background: #edf2ee;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}
.small-action:hover {
    text-decoration: none;
    background: #dfe8e2;
}
.form-help {
    margin: 0;
    color: var(--muted);
}
fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}
legend { font-weight: 800; }

@media (max-width: 920px) {
    .site-header, .admin-header {
        position: static;
        align-items: flex-start;
        flex-direction: column;
    }
    .brand { min-width: 0; }
    .hero, .detail-layout, .map-layout, .admin-grid {
        grid-template-columns: 1fr;
    }
    .card-grid.two, .card-grid.three, .card-grid.four, .download-grid, .kpi-grid, .chart-grid {
        grid-template-columns: 1fr;
    }
    .map-canvas {
        position: relative;
        top: auto;
        min-height: 380px;
    }
}

@media (max-width: 560px) {
    .hero { padding: 46px 18px 36px; }
    .hero h1 { font-size: 38px; }
    .dimension-list div { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 1fr; }
    .bar-row strong { text-align: left; }
    .donut-wrap { grid-template-columns: 1fr; }
    .site-footer { flex-direction: column; }
}
