/* ── Login page ───────────────────────────────────────────────────────────── */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.btn-login {
    background-color: #2d3748;
    border-color: #2d3748;
    color: #fff;
    font-weight: 500;
    padding: 0.6rem;
    border-radius: 0.375rem;
}
.btn-login:hover:not(:disabled) {
    background-color: #1a202c;
    border-color: #1a202c;
    color: #fff;
}
.btn-login:disabled {
    background-color: #4a5568;
    border-color: #4a5568;
    color: #fff;
}

/* ── Brand colours ────────────────────────────────────────────────────────── */
:root {
    --bs-primary: #3D4352;
    --bs-primary-rgb: 61, 67, 82;
}
.bg-primary        { background-color: #3D4352 !important; }
.btn-primary       { background-color: #3D4352; border-color: #3D4352; }
.btn-primary:hover { background-color: #2d3240; border-color: #2d3240; }
.btn-outline-primary       { color: #3D4352; border-color: #3D4352; }
.btn-outline-primary:hover { background-color: #3D4352; border-color: #3D4352; color: #fff; }
.text-primary  { color: #3D4352 !important; }
.border-primary { border-color: #3D4352 !important; }

/* ── Base ─────────────────────────────────────────────────────────────────── */
html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    padding-top: env(safe-area-inset-top);
    overflow: hidden;
    height: 100dvh;
    height: 100vh;
}

@supports (height: 100dvh) {
    body { height: 100dvh; }
}

#app { height: 100%; }

/* ── App shell ────────────────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

/* ── Bottom nav ───────────────────────────────────────────────────────────── */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 1040; display: flex;
    background: #fff; border-top: 1px solid #dee2e6;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
.bottom-nav-tab {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 0.5rem 0;
    text-decoration: none; color: #6c757d;
    font-size: 0.7rem; gap: 2px; transition: color 0.2s;
}
.bottom-nav-tab i { font-size: 1.2rem; margin-bottom: 0.15rem; }
.bottom-nav-tab.active {
    color: #3D4352; font-weight: 600;
    border-top: 2px solid #3D4352;
}
.bottom-nav-tab:hover { color: #3D4352; text-decoration: none; }

/* ── Sync status bar ──────────────────────────────────────────────────────── */
.sync-status-bar {
    position: fixed;
    bottom: calc(4.4rem + env(safe-area-inset-bottom));
    left: 0.5rem; right: 0.5rem;
    z-index: 1050;
    padding: 0.3rem 1rem;
    font-size: 0.75rem; text-align: center;
    border-radius: 0.5rem;
    transition: background-color 0.3s;
    cursor: pointer; user-select: none;
}
.sync-status-bar.online          { background: #198754; color: #fff; }
.sync-status-bar.offline         { background: #6c757d; color: #fff; }
.sync-status-bar.offline-pending { background: #dc3545; color: #fff; }
.sync-status-bar.online-pending  { background: #ffc107; color: #212529; }
.sync-status-bar.syncing         { background: #0d6efd; color: #fff; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.bg-orange { background-color: #fd7e14 !important; color: #fff; }

/* ── Visit cards ──────────────────────────────────────────────────────────── */
.visit-card {
    border-left: 4px solid #3D4352;
    transition: transform 0.2s;
}
.visit-card:active { transform: scale(0.98); }
.visit-card.inspection { border-left-color: #3D4352; }
.visit-card.change     { border-left-color: #FFA726; }
.visit-card.other      { border-left-color: #4ECDC4; }

/* ── Form sections ────────────────────────────────────────────────────────── */
.field-section {
    background: #fff; border: 1px solid #dee2e6;
    border-radius: 0.5rem; padding: 1rem; margin-bottom: 1rem;
}
.field-section-title {
    font-weight: 700; font-size: 1rem; margin-bottom: 12px;
    color: #3D4352; border-bottom: 2px solid #3D4352; padding-bottom: 6px;
}
.field-hint { font-size: 0.78rem; color: #dc3545; margin-top: 3px; }

/* YesNo toggle */
.yn-btn { min-width: 64px; }

/* Security code */
.security-code-input {
    font-size: 1.4rem; letter-spacing: 0.5rem; text-align: center;
    font-weight: 700; border: 2px solid #dc3545; background: #fff8f8;
}

/* ── Photo slots ──────────────────────────────────────────────────────────── */
.photo-slot {
    border: 2px dashed #dee2e6; border-radius: 0.5rem;
    min-height: 120px; display: flex; align-items: center;
    justify-content: center; flex-direction: column;
    cursor: pointer; transition: border-color 0.2s;
    overflow: hidden; position: relative; padding: 1rem;
}
.photo-slot:hover, .photo-slot:active { border-color: #3D4352; }
.photo-slot.has-photo { border-style: solid; border-color: #198754; padding: 0.25rem; }
.photo-slot img { max-width: 100%; max-height: 200px; border-radius: 0.25rem; }
.photo-slot .remove-btn {
    position: absolute; top: 6px; right: 6px;
    background: rgba(0,0,0,0.5); border: none; border-radius: 50%;
    width: 28px; height: 28px; color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ── Update banner ────────────────────────────────────────────────────────── */
.update-banner {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1060;
    display: flex; align-items: center; justify-content: center;
    min-height: 56px; padding: 0.5rem 1rem;
    font-size: 0.85rem; text-align: center;
    background-color: #198754; color: white;
    cursor: pointer; font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

/* ── Blazor error UI ──────────────────────────────────────────────────────── */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem;
    position: fixed; width: 100%; z-index: 2000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
