/* LST COMS App - Global Styles */

/*
 * Brand palette straight from the LST Coms corporate colour guide:
 *   navy   PMS 2756 #16216C — wordmark colour, the app's primary
 *   lime   PMS 388  #D9E409 — the "dynamic device" arrow colour, used
 *          sparingly as an accent since it's too light for body text or
 *          large fills; big flat areas of it read as a warning colour.
 * Fonts: Fira Sans is the corporate font, Arial is the specified fallback
 * for Microsoft/Office contexts — both are in the stack below.
 */
:root {
    --primary-color: #16216c;
    --primary-dark: #0c1344;
    --accent-color: #d9e409;
    --accent-dark: #b9c300;
    --accent-contrast: #16216c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #f5f7fa;
    --border-color: #ddd;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Fira Sans', Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== GLOBAL ERROR BANNER ========== */
.app-error-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: #c0392b;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.app-error-banner .banner-text {
    flex: 1;
    line-height: 1.35;
}

.app-error-banner .banner-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.app-error-banner .banner-btn {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.app-error-banner .banner-btn:hover {
    background: rgba(255, 255, 255, 0.32);
}

/* ========== STATUS BAR ========== */
/* Fixed to the bottom so field staff can always see whether their work
   has actually reached OneDrive, and which build they are running. */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    font-size: 12px;
    background: #2c3e50;
    color: rgba(255, 255, 255, 0.92);
    border-top: 3px solid var(--text-light);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.18);
}

.status-bar.state-online    { border-top-color: var(--success-color); }
.status-bar.state-offline   { border-top-color: var(--danger-color); }
.status-bar.state-syncing   { border-top-color: var(--warning-color); }
.status-bar.state-test      { border-top-color: #9b59b6; }

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.status-centre {
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.7);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-light);
    flex-shrink: 0;
}

.state-online  .status-dot { background: var(--success-color); }
.state-offline .status-dot { background: var(--danger-color); }
.state-test    .status-dot { background: #9b59b6; }
.state-syncing .status-dot {
    background: var(--warning-color);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

.status-state {
    font-weight: 600;
}

.status-pending {
    background: var(--danger-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.status-version {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
}

.status-refresh {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.status-refresh:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
}

.status-refresh:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Keep scrollable content clear of the fixed bars (status bar + nav) */
.home-content,
.report-form,
.project-detail .content,
.feed-content,
.issues-content,
.settings-content {
    padding-bottom: 120px;
}

/* When the bottom nav is present, lift the status bar above it */
.app-container.has-bottom-nav .status-bar {
    bottom: 58px;
}

/* ========== BOTTOM NAVIGATION ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 920;
    display: flex;
    height: 58px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

.nav-item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 11px;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 0 0 3px 3px;
}

.nav-icon {
    position: relative;
    font-size: 20px;
    line-height: 1;
}

.nav-label {
    font-size: 11px;
}

.nav-badge {
    position: absolute;
    top: -6px;
    right: -12px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger-color);
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

/* ========== SHARED PAGE HEADER ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    color: var(--primary-color);
    font-size: 22px;
}

.btn-header {
    padding: 8px 16px;
    font-size: 13px;
}

.feed-container,
.issues-container,
.settings-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.feed-content,
.issues-content,
.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* ========== REPORTS FEED ========== */
.feed-controls {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.feed-controls .form-control {
    margin: 0;
}

.report-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.report-project {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

.report-type-tag {
    background: var(--light-bg);
    color: var(--text-dark);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.report-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.flag-badge {
    font-size: 13px;
}

/* ========== ISSUE LOG ========== */
.issue-form {
    padding: 16px 20px;
    background: #fbfbfd;
    border-bottom: 1px solid var(--border-color);
}

.issue-filters {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.filter-chip {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    white-space: nowrap;
}

.filter-chip.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.issues-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.issue-card {
    background: #fff;
    border-radius: 8px;
    padding: 14px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border-color);
}

.issue-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.issue-head span[class^="sev-"] {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sev-low      { color: #16a085; }
.sev-medium   { color: #f39c12; }
.sev-high     { color: #e67e22; }
.sev-critical { color: #e74c3c; }

.issue-status {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge-open        { background: #e3f2fd; color: #1565c0; }
.status-badge-in-progress { background: #fff3cd; color: #856404; }
.status-badge-resolved    { background: #d4edda; color: #1e7e34; }
.status-badge-closed      { background: #e2e3e5; color: #495057; }

.issue-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.issue-desc {
    font-size: 13px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.issue-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
}

.btn-advance {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-advance:hover {
    background: var(--primary-dark);
}

/* ========== SETTINGS ========== */
.settings-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.settings-card h2 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    margin-bottom: 12px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--light-bg);
}

.setting-row:last-of-type {
    border-bottom: none;
}

.setting-row span {
    color: var(--text-light);
}

.setting-note {
    margin-top: 10px;
    padding: 8px 10px;
    background: #f3e5f5;
    color: #6a1b9a;
    border-radius: 6px;
    font-size: 13px;
}

.txt-online  { color: var(--success-color); }
.txt-offline { color: var(--danger-color); }

.btn-danger {
    background: var(--danger-color);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.btn-danger:hover {
    background: #c0392b;
}

.page {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-logo {
    width: 100%;
    max-width: 260px;
    height: auto;
    margin-bottom: 18px;
}

.login-card .subtitle {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 30px;
}

.error-message {
    background-color: #ffe6e6;
    color: var(--danger-color);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.btn-microsoft {
    background: linear-gradient(135deg, #0078d4 0%, #106ebe 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.btn-microsoft:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 110, 190, 0.3);
}

.btn-microsoft:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-test {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-test:hover {
    background: #5a6268;
}

.login-info {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-info p {
    color: var(--text-dark);
    font-size: 14px;
    margin-bottom: 5px;
}

.login-info small {
    color: var(--text-light);
    display: block;
}

.login-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    margin-top: auto;
    padding-bottom: 20px;
}

.login-version {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* ========== HOME PAGE ========== */
.home-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.home-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 20px;
    box-shadow: var(--shadow);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.header-logo {
    height: 32px;
    width: auto;
}

.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 14px;
    color: var(--text-light);
}

.user-info {
    padding: 8px 12px;
    background: var(--light-bg);
    border-radius: 6px;
}

.sync-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-badge {
    color: var(--success-color);
    font-weight: 600;
}

.offline-badge {
    color: var(--danger-color);
    font-weight: 600;
}

.offline-count {
    background: var(--danger-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.home-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.action-bar {
    margin-bottom: 30px;
}

.projects-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.project-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.project-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.project-client {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.project-location {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.project-status span {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #d4edda;
    color: var(--success-color);
}

.status-paused {
    background: #fff3cd;
    color: #856404;
}

.status-completed {
    background: #e2e3e5;
    color: #383d41;
}

/* ========== FORMS ========== */
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.form-header h1 {
    color: var(--primary-color);
    flex: 1;
    text-align: center;
}

.report-form-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.report-form {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(54, 96, 146, 0.1);
}

.form-control:disabled {
    background-color: var(--light-bg);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Geolocation Status */
.geolocation-status {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.geo-info,
.geo-loading {
    font-size: 13px;
    color: var(--text-dark);
}

.geo-info small {
    display: block;
    color: var(--text-light);
    margin-top: 5px;
}

.geofence-warning {
    background: #fff3cd;
    color: #856404;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
}

.client-delivered-badge {
    background: #eaf6ee;
    color: #1e6b3a;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
}

.client-delivered-file {
    font-weight: 400;
    font-size: 12px;
    opacity: 0.85;
    margin-top: 4px;
    word-break: break-all;
}

/* Photo Upload */
.photo-upload-area {
    position: relative;
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: rgba(54, 96, 146, 0.05);
    cursor: pointer;
    transition: all 0.3s;
}

.photo-upload-area:hover {
    background: rgba(54, 96, 146, 0.1);
    border-color: var(--primary-dark);
}

.file-input {
    display: none;
}

.upload-label {
    cursor: pointer;
    display: block;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
}

.photo-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.photo-preview {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: var(--light-bg);
}

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

.btn-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-large:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 1px;
}

.btn-secondary {
    background: var(--light-bg);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: white;
    border-color: var(--text-dark);
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 16px;
}

.btn-back,
.btn-logout {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    transition: all 0.3s;
}

.btn-back:hover,
.btn-logout:hover {
    color: var(--primary-dark);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    padding: 20px 0;
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
    flex: 1;
}

/* Offline Notice */
.offline-notice {
    background: #fff3cd;
    color: #856404;
    padding: 12px;
    border-radius: 6px;
    margin-top: 20px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: white;
    font-size: 16px;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 16px;
}

/* Reports List */
.reports-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
}

.report-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.report-body {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.report-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-light);
}

.photo-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* Project Detail */
.project-detail {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.project-detail .header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-detail .header h1 {
    color: var(--primary-color);
    flex: 1;
    text-align: center;
    font-size: 24px;
}

.project-detail .content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.reports-section {
    margin-bottom: 30px;
}

.reports-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-dark);
}

/* ========== PROJECTS SECTION EXTRAS ========== */
.section-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-heading-row h2 {
    margin-bottom: 0;
}

.btn-add-small {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-add-small:hover {
    background: var(--primary-dark);
}

/* ========== PROJECT OVERVIEW ========== */
.overview-name-input {
    flex: 1;
    margin: 0 12px;
    text-align: center;
    font-weight: 600;
}

.project-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.btn-danger-outline {
    background: none;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 24px;
}

.btn-danger-outline:hover {
    background: #ffe6e6;
}

.site-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.site-chip {
    background: var(--light-bg);
    border-radius: 14px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-dark);
}

.report-card-clickable {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.report-card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ========== PHOTO GRID (project overview + report detail) ========== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.photo-thumb {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: var(--light-bg);
    cursor: pointer;
}

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

.photo-thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-light);
}

/* ========== PHOTO GRID: selection + toolbar ========== */
.photo-grid-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    min-height: 24px;
}

.btn-link-small {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.photo-select-count {
    font-size: 13px;
    color: var(--text-light);
    margin-left: auto;
}

.photo-thumb {
    position: relative;
}

.photo-thumb-selected img {
    outline: 3px solid var(--primary-color);
    outline-offset: -3px;
}

.photo-checkbox {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
}

.photo-checkbox.checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Sticky action bar for a multi-select batch */
.photo-action-bar {
    position: sticky;
    bottom: 12px;
    margin-top: 12px;
    background: var(--text-dark);
    color: white;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
    z-index: 30;
}

.photo-action-bar-buttons {
    display: flex;
    gap: 8px;
}

.photo-action-bar .btn-primary,
.photo-action-bar .btn-secondary {
    padding: 8px 14px;
    font-size: 13px;
}

/* ========== LIGHTBOX ========== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

.lightbox-counter {
    position: absolute;
    top: 22px;
    left: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 600;
}

.lightbox-image {
    max-width: 92vw;
    max-height: 68vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.lightbox-nav-prev { left: 10px; }
.lightbox-nav-next { right: 10px; }

.lightbox-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.lightbox-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    text-align: center;
    word-break: break-all;
}

.lightbox-actions {
    display: flex;
    gap: 10px;
}

/* Busy overlay for share/zip operations — sits above the lightbox */
.photo-busy-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.photo-busy-overlay .spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
}

/* ========== REPORT DETAIL ========== */
.report-detail-meta {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--text-dark);
    line-height: 1.6;
}

/* ========== PHOTO PICKER (review-before-upload) ========== */
.photo-review-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.photo-review-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
}

.photo-review-thumb {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: var(--light-bg);
}

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

.photo-review-name {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--text-dark);
    word-break: break-all;
}

.btn-remove-inline {
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

/* ========== SMALL BUTTON UTILITY ========== */
.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* ========== REPORT FORM: locked project banner ========== */
.locked-project-banner {
    background: var(--light-bg);
    color: var(--primary-color);
    font-weight: 600;
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.section-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: -8px;
    margin-bottom: 14px;
}

/* ========== ADD SITE FORM ========== */
.add-site-form {
    background: #fbfbfd;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
}

/* ========== ADD PHOTOS TO REPORT ========== */
.add-photos-block {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-color);
}

.empty-state-inline {
    color: var(--text-light);
    font-size: 13px;
    font-style: italic;
}

/* ========== ISSUE CARD / DETAIL ========== */
.issue-card-clickable {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.issue-card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.issue-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.issue-detail-head span[class^="sev-"] {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.issue-detail-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.issue-detail-desc {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.deck-progress-note {
    font-size: 13px;
    opacity: 0.75;
    margin-top: 2px;
}

/* ========== TEAM BOARD / TRIP LOGGING ========== */
/*
 * Colour carries the meaning here: red = still travelling (open trip),
 * green = arrived, amber = open too long and probably forgotten, grey =
 * nothing logged. Every one of these is paired with a text label too —
 * the dot alone would be unreadable for anyone colour-blind, and this
 * gets used in bright sun on a phone.
 */
.state-onsite  { color: var(--success-color); }
.state-transit { color: var(--danger-color); }
.state-stale   { color: var(--warning-color); }
.state-idle    { color: var(--text-light); }

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--light-bg);
    border-radius: var(--radius);
    padding: 3px;
}

.view-toggle button {
    background: none;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    border-radius: 6px;
    cursor: pointer;
}

.view-toggle button.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: var(--shadow);
}

.trip-stat-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.trip-stat {
    background: #fff;
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow);
}

.trip-stat-label {
    font-size: 12px;
    color: var(--text-light);
}

.trip-stat-value {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
}

.stale-alert {
    background: #fff3cd;
    color: #856404;
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.5;
}

.my-trip-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.my-trip-card.trip-open  { border-color: var(--danger-color); }
.my-trip-card.trip-stale { border-color: var(--warning-color); }

.trip-card-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--danger-color);
    margin-bottom: 8px;
}

.trip-stale .trip-card-status { color: #856404; }

.trip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.trip-card-dest {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.trip-card-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 14px;
}

.btn-arrive {
    width: 100%;
    background: var(--success-color);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.btn-arrive:hover { background: #1e8449; }

.end-day-btn { margin-bottom: 20px; }

.place-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.place-chip {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 7px 13px;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
}

.place-chip:hover {
    border-color: var(--primary-color);
    background: #fff;
}

.place-chip-dist {
    color: var(--text-light);
    font-size: 11px;
    margin-left: 5px;
}

.roster-list {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.roster-row {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.roster-row:last-child { border-bottom: none; }

.roster-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 7px;
    flex-shrink: 0;
    background: var(--text-light);
}

.roster-dot.state-onsite  { background: var(--success-color); }
.roster-dot.state-transit { background: var(--danger-color); }
.roster-dot.state-stale   { background: var(--warning-color); }

.roster-body { flex: 1; min-width: 0; }

.roster-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.roster-status {
    font-size: 13px;
    margin-top: 1px;
}

.roster-detail {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 3px;
}

/* ========== TEMPLATE CAPTURE (category-based photo tagging) ========== */
.capture-summary {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 10px;
}

.capture-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.capture-group-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--light-bg);
    border: none;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    text-align: left;
}

.capture-group-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    background: white;
    border-radius: 10px;
    padding: 2px 10px;
}

.capture-group-count.count-complete {
    color: #1e6b3a;
    background: #eaf6ee;
}

.capture-group-body {
    padding: 12px 14px 14px;
}

.slot-checklist {
    list-style: decimal;
    margin: 10px 0 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slot-checklist li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
    padding: 4px 0;
    border-bottom: 1px solid var(--light-bg);
}

.slot-checklist li.slot-done {
    color: var(--text-dark);
    font-weight: 600;
}

.slot-checklist li.slot-done .slot-checklist-label::before {
    content: '✓ ';
    color: #1e6b3a;
}

.slot-checklist-label {
    flex: 1;
}

/* ========== SITE / ZONE BLOCKS (Project Overview) ========== */
.site-block-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.site-block {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.site-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.site-zone-count {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-light);
}

.site-zones-panel {
    padding: 0 14px 14px;
    border-top: 1px solid var(--light-bg);
}

.site-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-edit-inline {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    line-height: 1;
}

.zone-row-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.zone-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zone-edit-form {
    flex: 1;
    margin: 6px 0;
}

/* ========== GROUPED PHOTO GALLERY (Project Overview) ========== */
.photo-groups {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.photo-group-heading {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.photo-zone-group {
    margin-bottom: 14px;
}

.photo-group-subheading {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 30px 20px;
    }

    .form-header {
        flex-direction: column;
        gap: 10px;
    }

    .form-header h1 {
        font-size: 20px;
    }

    .header-info {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Trip History Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-dialog {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-content {
    flex: 1;
    padding: 16px;
}

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.trip-history-row {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 12px;
}

.trip-history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.trip-history-route {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.trip-history-status {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
}

.trip-history-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.trip-history-duration {
    margin-left: 4px;
    color: var(--warning-color);
}

.trip-history-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.trip-history-closed-by {
    color: var(--text-light);
}

.btn-danger-small {
    padding: 4px 8px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-danger-small:hover {
    opacity: 0.9;
}

.trip-date-group {
    margin-bottom: 16px;
}

.trip-date-header {
    font-weight: 600;
    color: var(--primary-color);
    padding: 8px 0;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 8px;
    font-size: 14px;
}

/* Close Day Button */
.close-day-section {
    padding: 12px 16px;
    background: #f0f4ff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    margin: 16px;
}

.btn-close-day {
    width: 100%;
    padding: 14px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-close-day:hover {
    background: var(--primary-dark);
}

.close-day-hint {
    display: block;
    margin-top: 8px;
    color: var(--text-light);
    font-size: 12px;
    text-align: center;
}

/* Place Analytics */
.place-analytics-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
    background: #f0f4ff;
    border-radius: 6px;
    margin-bottom: 12px;
}

.analytics-stat {
    text-align: center;
}

.analytics-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.analytics-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

.tech-visits-group {
    margin-bottom: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
}

.tech-visits-header {
    font-weight: 600;
    color: var(--primary-color);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
    font-size: 13px;
}

.analytics-trip-row {
    display: flex;
    gap: 12px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid #f5f5f5;
}

.analytics-trip-row:last-child {
    border-bottom: none;
}

.analytics-date {
    color: var(--text-light);
    min-width: 70px;
}

.analytics-time {
    font-weight: 500;
    color: var(--text-dark);
    min-width: 45px;
}

.analytics-duration {
    color: var(--success-color);
    font-weight: 500;
}

.analytics-status-open {
    color: var(--warning-color);
    font-weight: 500;
}
}
