:root {
    --navy: #07182d;
    --navy-2: #0d2342;
    --red: #c62835;
    --red-2: #a91f2c;
    --blue: #0d6efd;
    --green: #198754;
    --orange: #d97706;
    --gray-bg: #eef1f5;
    --line: #d7dde6;
    --text: #1f2937;
    --muted: #6b7280;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Arial, Helvetica, sans-serif; color: var(--text); }
body.app-body { background: var(--gray-bg); }
a { color: #0d6efd; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--navy);
    color: white;
}
.brand-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px; background: #c62835; color: #fff; border: 2px solid rgba(255,255,255,.55); font-size: 12px; font-weight: 900; letter-spacing: .04em; }
.brand-title { font-size: 22px; font-weight: 800; letter-spacing: .04em; }
.brand-subtitle { font-size: 12px; color: #c7d4e5; }
.user-block { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-block small { color: #c7d4e5; }
.logout-link { color: white; padding: 7px 10px; border: 1px solid #49657f; border-radius: 6px; }

.main-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 24px;
    background: #102642;
    border-bottom: 3px solid var(--red);
}
.main-nav a {
    color: #eef5ff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
}
.main-nav a.active,
.main-nav a:hover { background: var(--red); text-decoration: none; }
.page-wrap { padding: 22px 24px 34px; }

.page-title { margin: 0 0 5px; font-size: 26px; color: var(--navy); }
.page-subtitle { margin: 0 0 18px; color: var(--muted); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card, .panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
}
.card-pad, .panel { padding: 18px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat-card { padding: 18px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.stat-value { margin-top: 8px; color: var(--red); font-size: 36px; font-weight: 800; line-height: 1; }
.purpose-panel { padding: 20px; background: white; border-left: 5px solid var(--red); }
.purpose-panel h3 { margin: 0 0 8px; color: var(--navy); }
.purpose-panel p { margin: 0; color: #4b5563; line-height: 1.6; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { color: white; background: var(--blue); }
.btn-red { color: white; background: var(--red); }
.btn-red:hover { background: var(--red-2); }
.btn-green { color: white; background: var(--green); }
.btn-light { color: var(--text); background: white; border-color: var(--line); }
.btn-dark { color: white; background: var(--navy-2); }
.btn-sm { min-height: 31px; padding: 6px 9px; font-size: 12px; }

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-group { margin-bottom: 14px; }
label { display: block; margin-bottom: 6px; color: #374151; font-weight: 700; font-size: 13px; }
input, select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    color: var(--text);
    font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(13, 110, 253, .14); border-color: #60a5fa; }
.alert { padding: 12px 14px; border-radius: 7px; margin-bottom: 14px; }
.alert-error { background: #fee2e2; border: 1px solid #fecaca; color: #7f1d1d; }
.alert-success { background: #dcfce7; border: 1px solid #bbf7d0; color: #14532d; }

.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 13px; }
th { background: #f8fafc; color: #334155; text-transform: uppercase; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.thumb { width: 70px; height: 54px; object-fit: cover; border-radius: 6px; background: #e5e7eb; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; color: white; font-weight: 800; font-size: 11px; }
.badge-green { background: var(--green); }
.badge-red { background: var(--red); }
.badge-orange { background: var(--orange); }
.badge-gray { background: #6b7280; }

.map-page { height: calc(100vh - 128px); min-height: 560px; margin: -22px -24px -34px; position: relative; }
#map, #incidentMap { width: 100%; height: 100%; background: #dbeafe; }
.map-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 900;
    width: 360px;
    max-width: calc(100% - 32px);
    max-height: calc(100% - 32px);
    overflow: auto;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0,0,0,.18);
    padding: 14px;
}
.map-panel h3 { margin: 0 0 8px; color: var(--navy); }
.incident-summary { padding: 10px; border-left: 4px solid var(--red); background: #fff5f5; margin-bottom: 12px; }
.hydrant-result { padding: 10px 0; border-top: 1px solid var(--line); }
.hydrant-result:first-child { border-top: 0; }
.distance { color: var(--red); font-weight: 800; }
.popup-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.popup-actions a { padding: 5px 8px; color: white !important; background: var(--blue); border-radius: 5px; font-size: 12px; }
.popup-actions a.waze { background: var(--green); }
.popup-actions a.google { background: #4285f4; }

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    color: white;
    background: radial-gradient(circle at 15% 15%, rgba(26,102,190,.28), transparent 34%),
                radial-gradient(circle at 88% 85%, rgba(198,38,50,.21), transparent 32%),
                #061426;
}
.login-container { width: 100%; max-width: 1080px; min-height: 620px; display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; background: #0d2342; border: 1px solid #31577e; border-radius: 24px; box-shadow: 0 28px 80px rgba(0,0,0,.46); }
.login-brand { display: flex; align-items: center; padding: 52px; background: linear-gradient(145deg, rgba(4,17,33,.94), rgba(13,55,101,.91)); }
.login-mark { width: 150px; height: 150px; display: grid; place-items: center; border-radius: 24px; background: linear-gradient(145deg, #c62835, #7f1d1d); border: 4px solid rgba(255,255,255,.85); color: #fff; font-size: 38px; font-weight: 900; letter-spacing: .04em; margin-bottom: 26px; }
.login-brand h1 { margin: 0 0 12px; font-size: 40px; line-height: 1.1; }
.login-brand p { color: #bfd0e4; line-height: 1.6; }
.login-form { display: flex; align-items: center; padding: 48px; }
.login-form h2 { margin: 0 0 8px; font-size: 30px; }
.login-form .muted { color: #9fb3ca; }
.login-form label { color: #eaf2ff; }
.login-form input { color: white; background: #071a31; border-color: #315a83; }
.login-form input::placeholder { color: #7189a3; }

@media (max-width: 900px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .grid-4, .grid-2, .form-row { grid-template-columns: 1fr; }
    .login-container { grid-template-columns: 1fr; min-height: auto; }
    .login-brand { display: none; }
    .login-form { padding: 34px 24px; }
    .map-page { height: calc(100vh - 164px); }
}

@media (max-width: 560px) {
    .page-wrap { padding: 16px 12px 24px; }
    .main-nav { padding: 8px 12px; }
    .main-nav a { flex: 1 1 auto; text-align: center; }
    .stat-value { font-size: 30px; }
    .map-page { margin: -16px -12px -24px; }
    .map-panel { top: 10px; left: 10px; width: calc(100% - 20px); }
}

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

.photo-card {
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.photo-card strong {
    display: block;
    margin-bottom: 8px;
}

.photo-card img,
.photo-empty {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 7px;
}

.photo-empty {
    display: grid;
    place-items: center;
    color: #64748b;
    background: #e5e7eb;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 8px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 7px;
}

.check-grid label {
    display: flex;
    gap: 6px;
    align-items: center;
    margin: 0;
    font-weight: 600;
}

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

@media (max-width: 560px) {
    .photo-grid,
    .check-grid {
        grid-template-columns: 1fr;
    }
}

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

.form-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
}

.form-card summary {
    min-height: 52px;
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--navy);
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    font-size: 16px;
    font-weight: 900;
}

.form-card-body {
    padding: 16px;
}

.choice-row,
.status-choice-grid,
.photo-upload-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.choice-pill,
.status-choice,
.photo-upload,
.big-check {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 10px 12px;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-weight: 800;
}

.choice-pill input,
.status-choice input,
.big-check input,
.check-grid input {
    width: 18px;
    height: 18px;
}

.status-choice-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.status-choice {
    justify-content: center;
    min-height: 58px;
}

.status-operational { border-color: #16a34a; }
.status-defective { border-color: #eab308; }
.status-blocked { border-color: #dc2626; }
.status-under-repair { border-color: #2563eb; }

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

.photo-upload {
    align-items: stretch;
    flex-direction: column;
}

.photo-upload input {
    width: 100%;
}

.inline-help {
    display: inline-block;
    margin-left: 8px;
    color: #64748b;
    font-size: 13px;
}

.sticky-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px;
    background: rgba(248, 250, 252, .94);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 -6px 18px rgba(15, 23, 42, .08);
}

.touch-btn {
    min-height: 48px;
    padding: 13px 18px;
    font-size: 14px;
}

@media (max-width: 900px) {
    .status-choice-grid,
    .photo-upload-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .form-card summary {
        min-height: 50px;
        padding: 13px;
    }

    .form-card-body {
        padding: 13px;
    }

    .choice-row,
    .status-choice-grid,
    .photo-upload-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    .choice-pill,
    .status-choice,
    .photo-upload,
    .big-check {
        min-height: 50px;
    }

    .sticky-form-actions .btn {
        flex: 1 1 100%;
        text-align: center;
    }
}

/* Simplified hydrant add/inspection forms */
.clean-form {
    display: grid;
    gap: 18px;
    padding-bottom: 88px;
}

.clean-section {
    display: grid;
    gap: 12px;
}

.clean-section h2 {
    margin: 8px 0 0;
    padding: 14px 16px;
    color: #082345;
    background: #eaf4ff;
    border: 1px solid #cfe2ff;
    border-radius: 12px;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.15;
}

.clean-card {
    background: #ffffff;
    border: 1px solid #d4dde8;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

.clean-card .grid,
.clean-card.grid {
    align-items: start;
}

.clean-form .form-group {
    margin-bottom: 14px;
}

.clean-form .form-group:last-child {
    margin-bottom: 0;
}

.clean-form label,
.clean-form .apparatus-card > label,
.clean-form .photo-required-card > label {
    display: block;
    margin-bottom: 8px;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.2;
}

.clean-form input[type="text"],
.clean-form input[type="number"],
.clean-form input[type="date"],
.clean-form input[type="time"],
.clean-form input[type="file"],
.clean-form input:not([type]),
.clean-form select,
.clean-form textarea {
    width: 100%;
    min-height: 52px;
    padding: 12px 13px;
    color: #111827;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    font-size: 17px;
}

.clean-form textarea {
    min-height: 118px;
    resize: vertical;
}

.clean-form input:focus,
.clean-form select:focus,
.clean-form textarea:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .14);
}

.form-note {
    margin-top: 7px;
    color: #475569;
    font-size: 14px;
    font-weight: 700;
}

.field-error {
    margin-top: 7px;
    color: #b91c1c;
    font-size: 14px;
    font-weight: 900;
}

.segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.segmented label {
    margin: 0;
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 11px 15px;
    color: #111827;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 900;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}

.segmented input:checked + span {
    color: #0b3b7a;
    background: #eff6ff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}

.segmented.wrap span {
    min-width: 135px;
}

.status-accent-operational span { border-left: 6px solid #16a34a; }
.status-accent-defective span { border-left: 6px solid #facc15; }
.status-accent-blocked span { border-left: 6px solid #dc2626; }
.status-accent-repair span,
.status-accent-under-repair span { border-left: 6px solid #2563eb; }

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

.apparatus-card {
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #d4dde8;
    border-radius: 13px;
}

.multi-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.multi-choice-grid label {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    margin: 0;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    font-size: 16px;
    font-weight: 800;
}

.multi-choice-grid input {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
}

.nested-field {
    margin-top: 12px;
}

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

.photo-required-card {
    padding: 13px;
    background: #f8fafc;
    border: 1px solid #d4dde8;
    border-radius: 14px;
}

.photo-preview {
    min-height: 150px;
    display: grid;
    place-items: center;
    margin-bottom: 10px;
    color: #64748b;
    background: #ffffff;
    background-position: center;
    background-size: cover;
    border: 1px dashed #94a3b8;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    overflow: hidden;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    min-height: 150px;
    object-fit: cover;
    display: block;
}

.photo-input {
    display: none;
}

.photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.photo-actions .btn {
    min-height: 40px;
}

.photo-complete {
    display: none;
    align-items: center;
    justify-content: center;
    margin-top: 9px;
    padding: 6px 9px;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 900;
}

.photo-complete::before {
    content: "✓";
    margin-right: 5px;
}

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

.readonly-grid > div {
    min-height: 72px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #d4dde8;
    border-radius: 12px;
}

.readonly-grid strong {
    display: block;
    color: #475569;
    font-size: 13px;
    text-transform: uppercase;
}

.readonly-grid span {
    display: block;
    margin-top: 5px;
    color: #0f172a;
    font-size: 16px;
    font-weight: 900;
}

.sticky-form-actions {
    align-items: center;
    justify-content: flex-end;
    border-radius: 14px 14px 0 0;
}

.sticky-form-actions .touch-btn {
    min-width: 150px;
    min-height: 52px;
    font-size: 16px;
    font-weight: 900;
}

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

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

@media (max-width: 760px) {
    .clean-form {
        gap: 14px;
        padding-bottom: 126px;
    }

    .clean-section h2 {
        font-size: 22px;
        padding: 12px 13px;
    }

    .clean-card {
        padding: 13px;
    }

    .apparatus-grid,
    .photo-required-grid,
    .readonly-grid,
    .multi-choice-grid {
        grid-template-columns: 1fr;
    }

    .segmented {
        display: grid;
        grid-template-columns: 1fr;
    }

    .segmented.wrap span {
        min-width: 0;
        width: 100%;
    }

    .photo-preview,
    .photo-preview img {
        min-height: 135px;
    }

    .sticky-form-actions {
        left: 0;
        right: 0;
        margin: 0 -10px;
        border-radius: 0;
    }

    .sticky-form-actions .touch-btn {
        flex: 1 1 100%;
        min-width: 0;
    }
}

/* Modern Hydrant Profile */
.hydrant-profile {
    display: grid;
    gap: 18px;
}

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

.profile-title-block {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

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

.profile-code-row h1 {
    margin: 0;
    color: #07182d;
    font-size: 36px;
    font-weight: 900;
    line-height: 1.05;
}

.profile-title-block p {
    margin: 8px 0 0;
    color: #475569;
    font-size: 16px;
}

.profile-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.profile-status-badge,
.access-badge,
.workflow-chip,
.photo-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.profile-status-badge.status-operational,
.quick-card.status-operational .quick-icon {
    color: #ffffff;
    background: #15803d;
}

.profile-status-badge.status-defective,
.quick-card.status-defective .quick-icon {
    color: #ffffff;
    background: #f97316;
}

.profile-status-badge.status-blocked,
.quick-card.status-blocked .quick-icon {
    color: #ffffff;
    background: #dc2626;
}

.profile-status-badge.status-repair,
.quick-card.status-repair .quick-icon {
    color: #ffffff;
    background: #2563eb;
}

.profile-status-badge.status-unknown,
.quick-card.status-unknown .quick-icon {
    color: #ffffff;
    background: #64748b;
}

.profile-top-grid {
    display: grid;
    grid-template-columns: minmax(320px, .95fr) minmax(360px, 1.05fr);
    gap: 18px;
    align-items: stretch;
}

.profile-photo-card,
.profile-summary-card,
.profile-section-card,
.quick-card {
    background: #ffffff;
    border: 1px solid #d7dde6;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .07);
}

.profile-photo-card {
    position: relative;
    min-height: 430px;
    overflow: hidden;
}

.profile-photo-card img,
.profile-no-photo {
    width: 100%;
    height: 100%;
    min-height: 430px;
}

.profile-photo-card img {
    display: block;
    object-fit: cover;
}

.profile-no-photo {
    display: grid;
    place-items: center;
    color: #64748b;
    background: linear-gradient(135deg, #e2e8f0, #f8fafc);
    font-size: 18px;
    font-weight: 900;
}

.photo-overlay {
    position: absolute;
    left: 16px;
    bottom: 16px;
    max-width: calc(100% - 32px);
    padding: 12px 14px;
    color: #ffffff;
    background: rgba(2, 6, 23, .78);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.photo-overlay strong,
.photo-overlay span {
    display: block;
}

.photo-overlay strong {
    font-size: 16px;
    font-weight: 900;
}

.photo-overlay span {
    margin-top: 3px;
    color: #dbeafe;
    font-size: 13px;
}

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

.profile-summary-card h2,
.profile-section-card h2 {
    margin: 0;
    color: #07182d;
    font-size: 23px;
    font-weight: 900;
}

.summary-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.summary-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.summary-item.wide {
    grid-column: 1 / -1;
}

.summary-icon,
.quick-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    color: #ffffff;
    background: #0d6efd;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.summary-item strong,
.detail-list dt,
.audit-grid strong {
    display: block;
    color: #475569;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.summary-item p,
.detail-list dd,
.audit-grid span {
    margin: 4px 0 0;
    color: #0f172a;
    font-size: 16px;
    font-weight: 800;
    word-break: break-word;
}

.profile-nav-buttons {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.nav-unavailable {
    color: #64748b;
    font-weight: 800;
}

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

.quick-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 104px;
    padding: 15px;
}

.quick-card strong {
    display: block;
    color: #07182d;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.18;
}

.quick-card p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

.quick-card.hydrant-type .quick-icon { background: #0d6efd; }
.quick-card.inspection .quick-icon { background: #7c3aed; }
.quick-card.inspector .quick-icon { background: #0891b2; }
.quick-card.station .quick-icon { background: #0f766e; }

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

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.section-heading p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
}

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

.latest-photo-card {
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.latest-photo-preview {
    height: 190px;
    background: #e2e8f0;
}

.latest-photo-preview button {
    width: 100%;
    height: 100%;
    padding: 0;
    cursor: pointer;
    background: transparent;
    border: 0;
}

.latest-photo-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.photo-missing {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #64748b;
    font-size: 15px;
    font-weight: 900;
}

.latest-photo-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px;
}

.latest-photo-meta strong {
    color: #0f172a;
    font-size: 15px;
    font-weight: 900;
}

.photo-state.complete {
    color: #166534;
    background: #dcfce7;
}

.photo-state.missing {
    color: #7f1d1d;
    background: #fee2e2;
}

.inspection-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.detail-card {
    padding: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.detail-card h3 {
    margin: 0 0 12px;
    color: #07182d;
    font-size: 18px;
    font-weight: 900;
}

.detail-muted {
    margin: 10px 0 0;
    color: #64748b;
    font-weight: 800;
}

.detail-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.detail-list div {
    display: grid;
    grid-template-columns: minmax(140px, .8fr) minmax(0, 1.2fr);
    gap: 10px;
}

.detail-list dd {
    margin-left: 0;
}

.access-badge.access-passable {
    color: #ffffff;
    background: #15803d;
}

.access-badge.access-limited {
    color: #ffffff;
    background: #f97316;
}

.access-badge.access-blocked {
    color: #ffffff;
    background: #dc2626;
}

.access-badge.access-unknown {
    color: #ffffff;
    background: #64748b;
}

.remarks-card {
    grid-column: 1 / -1;
}

.remarks-card p,
.empty-text {
    margin: 0;
    color: #334155;
    font-size: 16px;
    line-height: 1.55;
    font-weight: 700;
}

.empty-state-box {
    padding: 18px;
    color: #475569;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    font-weight: 800;
    text-align: center;
}

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

.history-card {
    display: grid;
    grid-template-columns: minmax(190px, .9fr) minmax(180px, .8fr) minmax(260px, 1.4fr) auto;
    gap: 13px;
    align-items: center;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.history-main strong {
    display: block;
    color: #07182d;
    font-size: 16px;
    font-weight: 900;
}

.history-main span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-weight: 800;
}

.history-status {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.workflow-chip {
    color: #334155;
    background: #e2e8f0;
}

.history-detail p {
    margin: 3px 0;
    color: #334155;
    font-size: 14px;
    line-height: 1.35;
}

.history-action {
    text-align: right;
}

.history-pagination {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.history-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    padding: 7px 10px;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-weight: 900;
}

.history-pagination a.active {
    color: #ffffff;
    background: #0d6efd;
    border-color: #0d6efd;
}

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

.audit-grid div {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.profile-lightbox[hidden] {
    display: none;
}

.profile-lightbox {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 6, 23, .88);
}

.profile-lightbox figure {
    width: min(980px, 100%);
    margin: 0;
}

.profile-lightbox img {
    width: 100%;
    max-height: 82vh;
    display: block;
    object-fit: contain;
    background: #0f172a;
    border-radius: 14px;
}

.profile-lightbox figcaption {
    margin-top: 10px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
    text-align: center;
}

.lightbox-close {
    position: fixed;
    top: 16px;
    right: 18px;
    width: 42px;
    height: 42px;
    color: #ffffff;
    background: #c62835;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
}

@media (max-width: 1180px) {
    .quick-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

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

    .history-action {
        text-align: left;
    }
}

@media (max-width: 860px) {
    .profile-top-grid,
    .inspection-detail-grid {
        grid-template-columns: 1fr;
    }

    .profile-photo-card,
    .profile-photo-card img,
    .profile-no-photo {
        min-height: 330px;
    }

    .summary-two-col,
    .audit-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .profile-title-block {
        width: 100%;
        display: grid;
        gap: 12px;
    }

    .profile-code-row h1 {
        font-size: 31px;
    }

    .profile-actions,
    .profile-actions .btn,
    .profile-nav-buttons,
    .profile-nav-buttons .btn {
        width: 100%;
    }

    .profile-actions .btn,
    .profile-nav-buttons .btn {
        justify-content: center;
    }

    .quick-summary-grid,
    .latest-photo-grid,
    .history-card {
        grid-template-columns: 1fr;
    }

    .profile-photo-card,
    .profile-photo-card img,
    .profile-no-photo {
        min-height: 280px;
    }

    .latest-photo-preview {
        height: 220px;
    }

    .detail-list div {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}

/* Hydrant profile reference design tune */
.hydrant-profile {
    gap: 16px;
}

.profile-page-header {
    gap: 18px;
    padding-top: 2px;
}

.profile-title-block {
    display: grid;
    gap: 11px;
}

.profile-code-row h1 {
    font-size: 38px;
    letter-spacing: -.02em;
}

.profile-actions {
    gap: 12px;
    padding-top: 48px;
}

.profile-actions .btn {
    min-width: 145px;
    min-height: 43px;
    border-radius: 8px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, .12);
}

.profile-top-grid {
    grid-template-columns: minmax(420px, .88fr) minmax(440px, 1.05fr);
    gap: 14px;
}

.profile-photo-card,
.profile-summary-card,
.profile-section-card,
.quick-card {
    border-radius: 11px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .08);
}

.profile-photo-card,
.profile-photo-card img,
.profile-no-photo {
    min-height: 392px;
}

.photo-overlay {
    padding: 12px 15px;
    border-radius: 11px;
}

.profile-summary-card {
    padding: 20px;
}

.summary-heading {
    display: flex;
    align-items: center;
    gap: 11px;
}

.summary-heading-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    color: #ffffff;
    background: #0d6efd;
    border-radius: 50%;
    font-family: Georgia, serif;
    font-weight: 900;
}

.summary-two-col {
    column-gap: 22px;
    row-gap: 13px;
    margin-top: 20px;
}

.summary-item {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.summary-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
}

.summary-item.icon-status .summary-icon { background: #dcfce7; color: #16a34a; }
.summary-item.icon-barangay .summary-icon { background: #dbeafe; color: #2563eb; }
.summary-item.icon-address .summary-icon { background: #ede9fe; color: #6d28d9; }
.summary-item.icon-station .summary-icon { background: #fee2e2; color: #dc2626; }
.summary-item.icon-gps .summary-icon { background: #dbeafe; color: #1d4ed8; }
.summary-item.icon-type .summary-icon { background: #dbeafe; color: #2563eb; }
.summary-item.icon-outlets .summary-icon { background: #f3e8ff; color: #9333ea; }
.summary-item.icon-water .summary-icon { background: #e0f2fe; color: #0284c7; }
.summary-item.icon-inspection .summary-icon { background: #dcfce7; color: #16a34a; }
.summary-item.icon-inspector .summary-icon { background: #fef3c7; color: #f59e0b; }

.summary-item strong {
    font-size: 12px;
}

.summary-item p {
    font-size: 15px;
    font-weight: 900;
}

.summary-item small {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.profile-nav-buttons {
    margin-top: 20px;
    padding-top: 18px;
}

.profile-nav-buttons .btn {
    min-width: 132px;
    border-radius: 8px;
}

.quick-summary-grid {
    gap: 13px;
}

.quick-card {
    gap: 18px;
    min-height: 112px;
    padding: 20px;
}

.quick-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    font-size: 18px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
}

.quick-card.outlets .quick-icon { background: #9333ea; }
.quick-card.inspection .quick-icon { background: #f97316; }

.profile-section-card {
    padding: 18px 20px;
}

.latest-photo-grid {
    gap: 18px;
}

.latest-photo-card {
    border-radius: 8px;
}

.latest-photo-preview {
    height: 178px;
}

.latest-photo-meta {
    padding: 11px 12px;
}

.latest-photo-meta strong {
    font-size: 13px;
}

@media (max-width: 1180px) {
    .profile-actions {
        padding-top: 0;
    }

    .profile-top-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .profile-code-row h1 {
        font-size: 31px;
    }

    .profile-photo-card,
    .profile-photo-card img,
    .profile-no-photo {
        min-height: 280px;
    }
}
