* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #f4f6f8;
    color: #1c2733;
}
.topbar {
    background: #14213d;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar nav a {
    color: #cdd6e3;
    text-decoration: none;
    margin-left: 16px;
    font-size: 14px;
}
.topbar nav a:hover { color: #fff; text-decoration: underline; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.container.narrow { max-width: 560px; }

h2 { margin-top: 0; }

.overview { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 20px; }

.progress-bar-outer {
    background: #e2e6ea;
    border-radius: 20px;
    height: 22px;
    overflow: hidden;
    margin: 10px 0 6px;
}
.progress-bar-outer.small { height: 12px; }
.progress-bar-inner {
    background: linear-gradient(90deg, #2e7d32, #66bb6a);
    height: 100%;
    transition: width 0.4s ease;
}

.span-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.span-card {
    border: 1px solid #e2e6ea;
    border-left: 5px solid #1976D2;
    border-radius: 6px;
    padding: 12px 14px;
    background: #fafbfc;
}
.span-card h3 { margin: 0 0 4px; font-size: 15px; }
.contractor-name { margin: 0 0 8px; font-size: 13px; color: #5a6472; }
.span-card p { margin: 4px 0 0; font-size: 13px; }

.map-section { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
#map { height: 520px; border-radius: 6px; margin-top: 12px; }

.hint { font-size: 13px; color: #6b7480; }

form label {
    display: block;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
}
form input, form select, form textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 10px;
    font-size: 14px;
    border: 1px solid #cbd2d9;
    border-radius: 5px;
    font-weight: normal;
}
.btn {
    display: inline-block;
    background: #1976D2;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #145ea8; }
.btn-approve { background: #2e7d32; margin-right: 8px; }
.btn-approve:hover { background: #205a24; }
.btn-reject { background: #c62828; }
.btn-reject:hover { background: #931c1c; }

.alert { padding: 10px 14px; border-radius: 5px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #e6f4ea; color: #1e4620; border: 1px solid #b7dfc2; }
.alert-error { background: #fdecea; color: #611a15; border: 1px solid #f5c6c0; }

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.auth-box {
    background: #fff;
    padding: 30px 34px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 380px;
}
.auth-box h1 { font-size: 20px; margin-top: 0; }

.tabs { margin-bottom: 16px; }
.tab {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e2e6ea;
    border-radius: 20px;
    margin-right: 8px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
}
.tab.active { background: #1976D2; color: #fff; border-color: #1976D2; }

.entry-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.entry-header { font-size: 14px; margin-bottom: 10px; }
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    text-transform: uppercase;
    margin-left: 8px;
}
.badge-pending { background: #fff3cd; color: #7a5b00; }
.badge-approved { background: #d4edda; color: #1e4620; }
.badge-rejected { background: #f8d7da; color: #611a15; }

.entry-body p { font-size: 14px; margin: 6px 0; }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.photo-item img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e6ea;
}
.photo-meta { font-size: 11px; color: #5a6472; margin-top: 4px; line-height: 1.5; }
.warn { color: #b45309; font-weight: 600; }

.review-form {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.review-form input[type=text] {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #cbd2d9;
    border-radius: 5px;
    font-size: 13px;
}
.review-notes { font-size: 13px; color: #5a6472; margin-top: 8px; }

.empty-state { color: #6b7480; font-style: italic; }

/* ---------- Clickable span cards ---------- */
.span-card.clickable {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.span-card.clickable:hover,
.span-card.clickable:focus {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    outline: none;
}
.view-photos-hint {
    margin-top: 8px !important;
    font-size: 12px !important;
    color: #1976D2 !important;
    font-weight: 600;
}

/* ---------- Gallery modal ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 33, 61, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 10px;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px 28px;
    position: relative;
}
.modal-box h3 { margin-top: 0; padding-right: 30px; }
.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #6b7480;
}
.modal-close:hover { color: #1c2733; }

.gallery-entry {
    border-top: 1px solid #e2e6ea;
    padding: 14px 0;
}
.gallery-entry:first-child { border-top: none; padding-top: 4px; }
.gallery-entry-header { font-size: 14px; margin-bottom: 6px; }
.gallery-entry-remarks { font-size: 13px; color: #5a6472; margin-bottom: 8px; font-style: italic; }

/* ---------- Lightbox (full-size photo viewer) ---------- */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: zoom-out;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
