:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --line: #dbe2ee;
    --text: #18212f;
    --muted: #617089;
    --accent: #194d9a;
    --accent-soft: #eaf1ff;
    --danger: #d72638;
    --success: #0d7c4a;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.container {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    background: #0f1724;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    z-index: 30;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 0;
}

.site-title {
    margin: 0;
    font-size: 24px;
}
.site-title a,
.site-header nav a {
    color: #fff;
    text-decoration: none;
}
.site-subtitle {
    margin: 4px 0 0;
    color: #bcc7d9;
    font-size: 14px;
}
.site-header nav {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}
.site-header nav a { opacity: 0.92; }
.site-header nav a:hover { opacity: 1; }
.nav-user {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    font-size: 13px;
    font-weight: 700;
}

.main-content {
    padding: 24px 0 36px;
}

.grid {
    display: grid;
    gap: 20px;
}
.two-col {
    grid-template-columns: 1.25fr 0.95fr;
}
.detail-layout {
    grid-template-columns: 1.35fr 1fr;
}
.admin-grid {
    grid-template-columns: 1fr 1fr;
}
.mobile-search-shell {
    display: grid;
    gap: 18px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 12px 28px rgba(15, 23, 36, 0.06);
}

.hero-card h2,
.card h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

.muted {
    color: var(--muted);
}
.small-title {
    margin-top: 24px;
    font-size: 16px;
}
.small-note {
    margin-bottom: 0;
}
.subsection-title {
    margin: 18px 0 10px;
    font-size: 18px;
}
.tiny-note {
    font-size: 13px;
}

.badge {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 14px;
}

.search-wrap {
    position: relative;
    margin-top: 18px;
}
.mobile-search-wrap {
    margin-top: 12px;
}

#search-input,
input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    padding: 14px 15px;
    font-size: 16px;
    outline: none;
}
#search-input {
    font-size: 20px;
    font-weight: 700;
    padding: 18px 18px;
}
input[type="file"] {
    padding: 12px;
}
#search-input:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(25, 77, 154, 0.12);
}

.results {
    position: absolute;
    inset: calc(100% + 8px) 0 auto 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    display: none;
    z-index: 15;
    box-shadow: 0 12px 32px rgba(15, 23, 36, 0.10);
}

.result-item {
    display: block;
    padding: 16px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #eef2f8;
}
.result-item:last-child { border-bottom: 0; }
.result-item:hover { background: #f8fbff; }
.result-main {
    font-weight: 700;
    margin-bottom: 4px;
}
.result-sub {
    color: var(--muted);
    font-size: 14px;
}

.chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.chips-large .chip {
    padding: 12px 16px;
}
.chip {
    border: 1px solid var(--line);
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
}

.mini-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}
.mini-list li {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 0;
    border-bottom: 1px solid #eef2f8;
}
.mini-list li:last-child { border-bottom: 0; }
.mini-list a,
.table-wrap a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}
.mini-list span {
    color: var(--muted);
    font-size: 14px;
}

.detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 16px;
    margin: 18px 0 0;
}
.detail-list dt {
    font-weight: 700;
    color: #243246;
}
.detail-list dd {
    margin: 0;
    color: var(--muted);
}

.map-card {
    overflow: hidden;
}
.map-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.map-toolbar button,
.primary-btn {
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    padding: 11px 14px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 700;
}
.full-btn {
    width: 100%;
    justify-content: center;
}
.map-toolbar button:nth-child(3) {
    background: #243246;
}

.map-shell {
    background: linear-gradient(180deg, #edf2fb 0%, #dde7f5 100%);
    border: 1px solid var(--line);
    border-radius: 16px;
    height: 630px;
    overflow: hidden;
    position: relative;
}
.admin-map-shell {
    height: 720px;
}
.map-stage {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    touch-action: none;
    cursor: grab;
}
.map-stage.dragging {
    cursor: grabbing;
}
.map-content {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    user-select: none;
}
.map-content img {
    display: block;
    width: 1200px;
    max-width: none;
    height: auto;
    pointer-events: none;
    user-select: none;
}
.marker {
    position: absolute;
    transform: translate(-50%, -100%);
    width: 22px;
    height: 22px;
    background: var(--danger);
    border-radius: 999px;
    border: 3px solid #fff;
    box-shadow: 0 8px 20px rgba(215, 38, 56, 0.35);
}
.marker::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 54px;
    height: 54px;
    transform: translate(-50%, -50%);
    border: 4px solid rgba(215, 38, 56, 0.82);
    border-radius: 999px;
    background: rgba(215, 38, 56, 0.12);
    box-shadow: 0 0 0 10px rgba(215, 38, 56, 0.08);
    animation: markerPulse 1.8s ease-out infinite;
    pointer-events: none;
}
.marker::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    width: 3px;
    height: 14px;
    transform: translateX(-50%);
    background: var(--danger);
    border-radius: 2px;
}
.marker span {
    position: absolute;
    top: -42px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 36, 0.92);
    color: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
@keyframes markerPulse {
    0% { transform: translate(-50%, -50%) scale(0.92); opacity: 1; }
    70% { transform: translate(-50%, -50%) scale(1.16); opacity: 0.38; }
    100% { transform: translate(-50%, -50%) scale(1.26); opacity: 0; }
}
.marker-placement {
    background: var(--success);
    box-shadow: 0 8px 20px rgba(13, 124, 74, 0.30);
}
.marker-placement::after {
    background: var(--success);
}
.hidden { display: none; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-grid label span {
    font-size: 14px;
    font-weight: 700;
    color: #243246;
}
.checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 10px !important;
    padding-top: 30px;
}
.checkbox-label input {
    width: 18px;
    height: 18px;
    margin: 0;
}
.full-width { grid-column: 1 / -1; }
.compact-form { align-items: start; }
.form-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    font-size: 14px;
    color: #243246;
    background: #f7f9fd;
}
th, td {
    padding: 12px 10px;
    border-bottom: 1px solid #eef2f8;
    vertical-align: top;
}
tbody td { color: var(--muted); }

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
.section-head-note { margin: 6px 0 0; }
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.action-row form { margin: 0; }
.action-row-wide {
    width: 100%;
}
.detail-actions-card,
.detail-report-card,
.detail-issue-card {
    grid-column: 1 / -1;
}
.secondary-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
}
.secondary-btn {
    background: #243246;
    color: #fff;
}
.danger-btn {
    background: #b91c1c;
    color: #fff;
}
.warning-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    background: #b45309;
    color: #fff;
}
.report-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.alert {
    border-radius: 14px;
    padding: 14px 16px;
    font-weight: 700;
    margin-bottom: 18px;
}
.success-alert {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.status-open {
    background: #fff7ed;
    color: #9a3412;
}
.status-closed {
    background: #ecfdf5;
    color: #166534;
}
.cell-subline {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}
.page-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
    background: linear-gradient(180deg, #0f1724 0%, #1a2740 100%);
}
.login-shell {
    width: min(100%, 430px);
}
.login-card {
    background: #fff;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.22);
    border: 1px solid rgba(255,255,255,0.12);
}
.login-card h1 { margin: 0 0 10px; }
.login-form {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}
.error-box {
    background: #fff1f2;
    color: #9f1239;
    border: 1px solid #fecdd3;
    padding: 12px 14px;
    border-radius: 12px;
    margin-top: 14px;
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 980px) {
    .two-col,
    .detail-layout,
    .admin-grid {
        grid-template-columns: 1fr;
    }
    .form-grid { grid-template-columns: 1fr; }
    .map-shell, .admin-map-shell { height: 520px; }
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .checkbox-label { padding-top: 0; }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 16px, 1240px);
    }
    .main-content { padding-top: 14px; }
    .card {
        padding: 16px;
        border-radius: 16px;
    }
    .detail-list { grid-template-columns: 1fr; }
    .site-title { font-size: 20px; }
    .site-subtitle { font-size: 13px; }
    #search-input {
        font-size: 22px;
        padding: 18px 16px;
        border-radius: 16px;
    }
    .result-item { padding: 16px 14px; }
    .map-shell, .admin-map-shell { height: 420px; }
    .map-toolbar button,
    .primary-btn,
    .secondary-btn,
    .danger-btn,
    .warning-btn { min-height: 46px; }
    .nav-user { padding: 7px 10px; }
    .detail-mobile-flow {
        gap: 16px;
    }
    .detail-actions-card .action-row,
    .report-actions {
        grid-template-columns: 1fr;
        display: grid;
    }
}
