/* ==========================================================================
   IFD Services — Consolidated Frontend Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Design Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Colors */
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #eff6ff;
    --color-primary-50: #dbeafe;

    --color-success: #16a34a;
    --color-success-light: #f0fdf4;
    --color-danger: #dc2626;
    --color-danger-light: #fef2f2;
    --color-warning: #d97706;
    --color-warning-light: #fffbeb;
    --color-info: #0891b2;
    --color-info-light: #ecfeff;

    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-bg: #f8fafc;
    --color-bg-white: #fff;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", "Fira Code", monospace;

    --text-xs: 11px;
    --text-sm: 12px;
    --text-base: 13px;
    --text-md: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 22px;
    --text-3xl: 28px;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
}

/* --------------------------------------------------------------------------
   1. Reset & Base
   -------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: var(--color-text);
    font-size: var(--text-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.login-page {
    background: linear-gradient(135deg, #26547D 0%, #1e4060 50%, #26547D 100%);
    position: relative;
}

body.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   2. Layout
   -------------------------------------------------------------------------- */
.page-wrapper {
    flex: 1 0 auto;
}

.container {
    max-width: 1200px;
    margin: var(--space-5) auto;
    padding: 0 var(--space-5);
}

/* --------------------------------------------------------------------------
   3. Header & Navigation
   -------------------------------------------------------------------------- */
.header {
    background: var(--color-bg-white);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3) 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-5);
}

.header-logo img {
    max-height: 50px;
}

.header-logo h2 {
    font-size: 18px;
}

.header-nav {
    display: flex;
    flex-direction: row;
    gap: 1px;
    align-items: center;
    background: var(--color-border-light);
    padding: 3px;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.header-nav .nav-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 7px 14px;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: var(--text-base);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.header-nav .nav-item:hover {
    background-color: rgba(0,0,0,0.04);
    color: var(--color-text);
}

.header-nav .nav-item.active {
    background-color: var(--color-bg-white);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.header-nav .nav-item svg {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    opacity: 0.7;
}

.header-nav .nav-item.active svg {
    stroke: var(--color-primary);
    opacity: 1;
}

/* Header Right — User Menu */
.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    position: relative;
}

.header-right-top {
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 12px 6px 6px;
    border-radius: 50px;
    transition: all 0.2s ease;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-right-top:hover {
    background-color: var(--color-bg);
}

.header-right.menu-open .header-right-top {
    background-color: var(--color-border-light);
}

.header-right-top svg {
    width: 34px;
    height: 34px;
    padding: 7px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    color: white;
    flex-shrink: 0;
}

.header-right-top::after {
    content: '\25BC';
    font-size: 9px;
    opacity: 0.5;
    transition: transform 0.3s ease;
}

.header-right:hover .header-right-top::after,
.header-right.menu-open .header-right-top::after {
    transform: rotate(180deg);
}

.header-right-bottom {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    padding: var(--space-2) 0;
    margin-top: var(--space-2);
    animation: slideDown var(--transition-base);
}

.header-right-bottom::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

.header-right:hover .header-right-bottom,
.header-right-bottom:hover,
.header-right.menu-open .header-right-bottom {
    display: block;
}

.header-right-bottom a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    text-decoration: none;
    color: var(--color-text);
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-size: 14px;
}

.header-right-bottom a svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.header-right-bottom a:hover svg {
    opacity: 1;
}

.header-right-bottom a.logout svg {
    stroke: var(--color-danger);
}

.header-right-bottom a:hover {
    background-color: var(--color-bg);
}

.header-right-bottom a.dropdown-item.logout:hover {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
}

.header-right-bottom a + a {
    border-top: 1px solid var(--color-border-light);
}

.user-role-badge {
    background: var(--color-success-light);
    color: var(--color-success);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    margin-left: var(--space-1);
}

.user-role-badge.client {
    background: var(--color-info-light);
    color: var(--color-info);
}

.user-role-badge.installer {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.client-badge {
    background: var(--color-info-light);
    color: var(--color-info);
    padding: var(--space-1) var(--space-3);
    border-radius: 10px;
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   4. Footer
   -------------------------------------------------------------------------- */
.footer {
    flex-shrink: 0;
    background: var(--color-text);
    color: #fff;
    padding: var(--space-4) 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-5);
    text-align: center;
}

.footer-copyright {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}


/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
    padding: var(--space-2) var(--space-4);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    transition: all var(--transition-fast);
    line-height: 1.4;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

.btn-secondary {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-border-light);
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-small {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-sm);
}

.btn-login {
    width: 100%;
    padding: var(--space-3);
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast);
    margin-top: var(--space-2);
}

.btn-login:hover {
    background: var(--color-primary-dark);
}

.btn-icon {
    padding: 4px 8px;
    height: 28px;
    width: 28px;
    box-sizing: border-box;
}

/* Action icon buttons (30x30) */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    width: 30px;
    height: 30px;
}

.btn-action svg {
    flex-shrink: 0;
}

.btn-view {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.btn-view:hover {
    background: var(--color-primary);
    color: white;
}

.btn-edit {
    background: var(--color-border-light);
    color: var(--color-text-secondary);
}

.btn-edit:hover {
    background: var(--color-text-secondary);
    color: white;
}

.btn-pdf {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.btn-pdf:hover {
    background: var(--color-danger);
    color: white;
}

.btn-delete {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.btn-delete:hover {
    background: var(--color-danger);
    color: white;
}

.btn-add {
    background: var(--color-success-light);
    color: var(--color-success);
}

.btn-add:hover {
    background: var(--color-success);
    color: white;
}

.btn-send-credentials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 6px;
    background: var(--color-info-light);
    color: var(--color-info);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    width: 30px;
    height: 30px;
}

.btn-send-credentials:hover {
    background: var(--color-info);
    color: white;
}

.btn-send-credentials.disabled {
    background: var(--color-border-light);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.action-buttons {
    display: flex;
    gap: var(--space-1);
    align-items: center;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   6. Badges
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.badge-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.badge-secondary {
    background: var(--color-border-light);
    color: var(--color-text-secondary);
}

.badge-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-info {
    background: var(--color-info-light);
    color: var(--color-info);
}

.badge-acceptable {
    background: #f0fdf4;
    color: #15803d;
}

.badge-tolerable {
    background: #fefce8;
    color: #a16207;
}

.badge-moderate {
    background: #fff7ed;
    color: #c2410c;
}

.badge-substantial {
    background: #fef2f2;
    color: #dc2626;
}

/* Status badges (pill style) */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
}

.status-pending {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.status-in_progress {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.status-completed {
    background: var(--color-success-light);
    color: var(--color-success);
}

.status-badge.active {
    background: var(--color-success-light);
    color: var(--color-success);
}

.status-badge.inactive {
    background: var(--color-border-light);
    color: var(--color-text-muted);
}

/* Role badges */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.role-badge.admin {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.role-badge.manager {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.role-badge.installer {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.role-badge.inspector {
    background: var(--color-info-light);
    color: var(--color-info);
}

.job-count {
    margin-left: var(--space-2);
    padding: 3px var(--space-2);
    background: var(--color-border-light);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* --------------------------------------------------------------------------
   7. Welcome & Stats
   -------------------------------------------------------------------------- */
.welcome {
    background: var(--color-bg-white);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.welcome h1 {
    margin-bottom: var(--space-2);
    color: var(--color-text);
    font-size: var(--text-2xl);
    font-weight: 700;
}

.welcome p {
    font-size: var(--text-md);
    color: var(--color-text-secondary);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.stat-box {
    background: var(--color-bg-white);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: all var(--transition-base);
}

.stat-box:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-box h3 {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.stat-box .number {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-primary);
}

.stat-box .number.client-color {
    color: var(--color-info);
}

/* --------------------------------------------------------------------------
   8. Sections
   -------------------------------------------------------------------------- */
.inspections,
.section {
    background: var(--color-bg-white);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    overflow-x: auto;
    margin-bottom: var(--space-5);
}

.inspections h2,
.section h2 {
    margin-bottom: var(--space-5);
    color: var(--color-text);
    font-size: var(--text-xl);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   9. Page Header & Section Header
   -------------------------------------------------------------------------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
}

.page-header h1 {
    margin: 0;
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text);
}

.header-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.dashboard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
}

.dashboard-section-header h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
}

.section-header h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
}

.back-button-container {
    margin-bottom: var(--space-4);
}

/* --------------------------------------------------------------------------
   10. Search Box
   -------------------------------------------------------------------------- */
.search-box {
    background: var(--color-bg-white);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-5);
    position: relative;
}

.search-box svg {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: var(--space-2) var(--space-4) var(--space-2) 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    background: var(--color-bg);
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--color-bg-white);
}

/* --------------------------------------------------------------------------
   11. Data Tables
   -------------------------------------------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: var(--space-3) var(--space-2);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-md);
}

th {
    background: var(--color-bg);
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Unified data table wrapper */
.data-table {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--color-bg);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text);
    font-size: var(--text-base);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: var(--color-bg);
}

/* Table links */
.data-table td a:not(.btn):not(.btn-action),
.data-table-desktop td a:not(.btn):not(.btn-action),
table td a:not(.btn):not(.btn-action) {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.data-table td a:not(.btn):not(.btn-action):hover,
.data-table-desktop td a:not(.btn):not(.btn-action):hover,
table td a:not(.btn):not(.btn-action):hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   12. Mobile Data Cards
   -------------------------------------------------------------------------- */
.data-cards {
    display: none;
}

.data-card {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-3);
    overflow: hidden;
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
}

.data-card-name {
    font-weight: 700;
    font-size: var(--text-md);
    color: var(--color-text);
    text-decoration: none;
}

a.data-card-name {
    color: var(--color-primary);
    font-size: var(--text-md);
}

.data-card-body {
    padding: var(--space-3) var(--space-4);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.data-card-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.data-card-field.full-width {
    grid-column: 1 / -1;
}

.data-card-field small {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-card-field span {
    font-size: var(--text-base);
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-card-field span a {
    color: var(--color-primary);
    text-decoration: none;
}

.data-card-actions {
    display: flex;
    border-top: 1px solid var(--color-border-light);
}

.data-card-actions a,
.data-card-actions button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-3);
    border: none;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    background: var(--color-bg);
    color: var(--color-text);
    transition: background var(--transition-fast);
}

.data-card-actions a:not(:last-child),
.data-card-actions button:not(:last-child) {
    border-right: 1px solid var(--color-border-light);
}

.data-card-actions .card-btn-pdf { color: var(--color-danger); }
.data-card-actions .card-btn-pdf:hover { background: var(--color-danger-light); }
.data-card-actions .card-btn-view { color: var(--color-primary); }
.data-card-actions .card-btn-view:hover { background: var(--color-primary-light); }
.data-card-actions .card-btn-edit { color: var(--color-text-secondary); }
.data-card-actions .card-btn-edit:hover { background: var(--color-border-light); }
.data-card-actions .card-btn-delete { color: var(--color-danger); }
.data-card-actions .card-btn-delete:hover { background: var(--color-danger-light); }
.data-card-actions .card-btn-email { color: var(--color-info); }
.data-card-actions .card-btn-email:hover { background: var(--color-info-light); }
.data-card-actions .card-btn-email.disabled { color: var(--color-text-muted); cursor: not-allowed; }
.data-card-actions .card-btn-inspect { color: var(--color-success); }
.data-card-actions .card-btn-inspect:hover { background: var(--color-success-light); }

/* --------------------------------------------------------------------------
   13. Forms
   -------------------------------------------------------------------------- */
.form-container {
    background: var(--color-bg-white);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-6);
}

.form-section {
    background: var(--color-bg-white);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.form-section h2 {
    margin-top: 0;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-text);
    font-size: var(--text-xl);
}

.form-section h3 {
    margin: 0 0 var(--space-5) 0;
    color: var(--color-text);
    font-size: var(--text-xl);
    font-weight: 600;
}

/* form-section variant inside form-container (no shadow/padding, uses border dividers) */
.form-container .form-section {
    background: transparent;
    padding: 0;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    box-shadow: none;
}

.form-container .form-section:last-of-type {
    border-bottom: none;
}

.form-container .form-section h2 {
    border-bottom: none;
    padding-bottom: 0;
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-1);
    font-weight: 600;
    color: var(--color-text);
    font-size: var(--text-base);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="month"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    box-sizing: border-box;
    transition: all var(--transition-fast);
    background: var(--color-bg-white);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    transition: all var(--transition-fast);
    box-sizing: border-box;
    background: var(--color-bg-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    resize: vertical;
    font-family: inherit;
}

.form-hint {
    margin: var(--space-1) 0 0 0;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.required {
    color: var(--color-danger);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
}

.form-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
}

/* Radio & Checkbox Groups */
.radio-group {
    display: flex;
    gap: var(--space-5);
    margin-top: var(--space-2);
}

.radio-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 0;
}

.radio-group input[type="radio"] {
    margin-right: var(--space-1);
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-weight: normal !important;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   14. Photo Upload
   -------------------------------------------------------------------------- */
.photo-upload-area {
    border: 2px dashed var(--color-border);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-top: var(--space-2);
    background: var(--color-bg);
    transition: border-color var(--transition-fast);
}

.photo-upload-area:hover {
    border-color: var(--color-primary);
}

.photo-upload-area input[type="file"] {
    width: 100%;
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.existing-photos {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
}

.existing-photo {
    position: relative;
    width: 100px;
    height: 100px;
}

.existing-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
}

.remove-photo {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-danger);
    color: white;
    border: 2px solid white;
    border-radius: var(--radius-full);
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   15. Door Entry
   -------------------------------------------------------------------------- */
.door-entry {
    border: 1px solid var(--color-border);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    position: relative;
}

.door-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.door-entry-header h3 {
    margin: 0;
    color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   16. Client Select & Searchable Select
   -------------------------------------------------------------------------- */
.client-select-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.client-select-wrapper select {
    flex: 1;
}

.btn-add-client {
    padding: 10px 15px;
    white-space: nowrap;
}

.searchable-select {
    position: relative;
    flex: 1;
}

.searchable-select input[type="text"] {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    padding-right: 35px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    cursor: pointer;
    box-sizing: border-box;
    text-align: left !important;
    direction: ltr;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all var(--transition-fast);
}

.searchable-select input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.clear-client-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: none;
    line-height: 1;
}

.clear-client-btn:hover {
    color: var(--color-text);
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.searchable-select-dropdown.active {
    display: block;
}

.searchable-select-option {
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    font-size: var(--text-md);
}

.searchable-select-option:hover {
    background: var(--color-bg);
}

.searchable-select-option.selected {
    background: var(--color-primary);
    color: white;
}

.searchable-select-option.hidden {
    display: none;
}

/* --------------------------------------------------------------------------
   17. Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: var(--space-5);
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 420px;
    width: 90%;
    z-index: 9999;
    margin: auto;
    animation: slideDown var(--transition-base);
}

/* Larger modal variant (for add-job client modal etc.) */
.modal-container.modal-lg {
    max-width: 700px;
}

.modal-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--color-text);
    font-size: var(--text-lg);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.modal-body {
    padding: var(--space-5);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.modal-body p {
    margin: 0 0 var(--space-3) 0;
    line-height: 1.5;
    font-size: var(--text-md);
    color: var(--color-text-secondary);
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    padding: 0 var(--space-5);
    gap: 0;
    background: var(--color-bg);
}

.modal-tab {
    padding: var(--space-3) var(--space-4);
    border: none;
    background: none;
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
}

.modal-tab:hover {
    color: var(--color-text);
}

.modal-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.modal-tab-content {
    display: none;
}

.modal-tab-content.active {
    display: block;
}

.modal-body .client-info,
.modal-body .staff-info {
    background: var(--color-bg);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    margin: var(--space-3) 0;
    font-size: var(--text-md);
    border: 1px solid var(--color-border-light);
}

.modal-body .client-info strong,
.modal-body .staff-info strong {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--color-text);
}

.modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    background: var(--color-bg);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.btn-modal {
    padding: var(--space-2) var(--space-4);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.btn-modal-confirm {
    background: var(--color-primary);
    color: white;
}

.btn-modal-confirm:hover {
    background: var(--color-primary-dark);
}

.btn-modal-cancel {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.btn-modal-cancel:hover {
    background: var(--color-border-light);
    color: var(--color-text);
}

/* --------------------------------------------------------------------------
   18. Messages & Empty States
   -------------------------------------------------------------------------- */
.success-message {
    background: var(--color-success-light);
    color: var(--color-success);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    border: 1px solid rgba(22, 163, 74, 0.2);
    font-size: var(--text-md);
    font-weight: 500;
}

.error-message {
    background: var(--color-danger-light);
    color: var(--color-danger);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    border: 1px solid rgba(220, 38, 38, 0.2);
    font-size: var(--text-md);
    font-weight: 500;
}

.info-box {
    background: var(--color-primary-light);
    border: 1px solid rgba(37, 99, 235, 0.2);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    font-size: var(--text-md);
}

.info-box strong {
    color: var(--color-primary);
}

.empty-state {
    text-align: center;
    padding: 48px var(--space-5);
    color: var(--color-text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.4;
}

.empty-state p {
    font-size: var(--text-md);
    margin: 0;
}

.no-data {
    text-align: center;
    padding: var(--space-8);
    color: var(--color-text-muted);
    font-size: var(--text-md);
}

.no-results {
    text-align: center;
    padding: var(--space-8) var(--space-5);
    color: var(--color-text-muted);
    display: none;
    font-size: var(--text-md);
}

/* --------------------------------------------------------------------------
   19. Organisations / Client Links
   -------------------------------------------------------------------------- */
.organisations-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.client-link {
    text-decoration: none;
    transition: opacity 0.2s;
}

.client-link:hover {
    opacity: 0.8;
}

/* --------------------------------------------------------------------------
   20. Job / Client Detail Pages
   -------------------------------------------------------------------------- */
.job-header,
.client-header,
.asset-header {
    background: var(--color-bg-white);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.client-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
}

.client-action-buttons {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.actions-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-1);
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
    animation: slideDown var(--transition-fast);
}

.actions-dropdown.open .actions-dropdown-menu {
    display: block;
}

.actions-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: none;
    background: none;
    cursor: pointer;
    font-size: var(--text-base);
    color: var(--color-text);
    text-align: left;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.actions-dropdown-item:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.actions-dropdown-item + .actions-dropdown-item {
    border-top: 1px solid var(--color-border-light);
}

.job-header h1,
.client-header h1,
.asset-header h1 {
    margin: 0;
    color: var(--color-text);
    font-size: var(--text-2xl);
    font-weight: 700;
}

.job-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
}

.job-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.job-action-buttons {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.job-info,
.client-info,
.asset-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border-light);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.info-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: var(--text-md);
    color: var(--color-text);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   21. Checklist Table (Inspections)
   -------------------------------------------------------------------------- */
.checklist-table-wrapper {
    overflow-x: auto;
}

.checklist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.checklist-table th,
.checklist-table td {
    border: 1px solid #ddd;
    padding: 10px 12px;
    text-align: left;
}

.checklist-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 13px;
}

.checklist-table input[type="text"],
.checklist-table select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 13px;
}

.checklist-table input[type="text"]:focus,
.checklist-table select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,0.1);
}

.checklist-table .item-label {
    background: #f8f9fa;
}

.checklist-table .item-label small {
    color: #666;
    font-size: 12px;
}

.checklist-table .costs-input {
    text-align: right;
}

.checklist-table .total-row td {
    background: #f0f7ff;
    font-weight: 600;
}

.checklist-table tfoot tr:not(.total-row) td {
    background: #fafafa;
}

.gap-input {
    width: 60px !important;
    text-align: center;
}

/* --------------------------------------------------------------------------
   22. Door Diagram (Inspection Modal)
   -------------------------------------------------------------------------- */
.door-diagram-section {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.door-diagram-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.door-diagram-wrapper {
    display: grid;
    grid-template-columns: 90px auto 90px;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.door-type-abc {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

.door-type-abc span {
    font-size: 12px;
    color: #333;
    font-weight: normal;
}

.top-row, .bottom-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
}

.horizontal-strip {
    display: flex;
}

.horizontal-strip .gap-cell,
.horizontal-strip input {
    width: 40px;
    height: 30px;
    border: 1px solid #000;
    border-right: none;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.horizontal-strip input {
    display: block;
    font-weight: normal;
    font-size: 12px;
}

.horizontal-strip .gap-cell {
    background: #f0f0f0;
}

.horizontal-strip .gap-cell:last-child,
.horizontal-strip > :last-child {
    border-right: 1px solid #000;
}

.side-grid {
    display: grid;
    grid-template-columns: repeat(3, 28px);
    grid-template-rows: repeat(3, 28px);
}

.side-grid .gap-cell,
.side-grid input {
    width: 28px;
    height: 28px;
    border: 1px solid #000;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.side-grid input {
    display: block;
    font-weight: normal;
    font-size: 11px;
}

.side-grid .gap-cell {
    background: #f0f0f0;
}

.left-grid {
    justify-self: end;
}

.right-grid {
    justify-self: start;
}

.center-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.arrows-top, .arrows-bottom {
    display: flex;
    gap: 30px;
    padding: 5px 0;
}

.arrow {
    font-size: 14px;
    color: #333;
}

.door-container {
    display: flex;
    align-items: center;
}

.arrows-left, .arrows-right {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 0 3px;
}

.door-frame {
    width: 160px;
    height: 220px;
    border: 4px solid #333;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
}

.door-inner-frame {
    position: absolute;
    inset: 6px;
    border: 2px solid #666;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.door-hinge {
    position: absolute;
    width: 10px;
    height: 18px;
    border: 1px solid #000;
    background: #fff;
}

.hinge-top-left { left: -7px; top: 25px; }
.hinge-bottom-left { left: -7px; bottom: 25px; }
.hinge-top-right { right: -7px; top: 25px; }
.hinge-bottom-right { right: -7px; bottom: 25px; }

.door-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ccc;
}

.door-center-label {
    font-size: 13px;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    padding-bottom: 6px;
    width: 100%;
    text-align: center;
}

.door-center-input {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    justify-content: center;
}

.door-center-input input {
    width: 60px;
    height: 26px;
    border: 1px solid #000;
    text-align: center;
    font-size: 12px;
    background: #fff;
}

.door-center-input .unit {
    font-size: 12px;
    min-width: 24px;
}

.door-text {
    font-size: 12px;
    color: #333;
    padding: 4px 0;
}

.door-diagram-note {
    margin-top: 10px;
    font-size: 11px;
    color: #666;
    font-style: italic;
}

.door-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 5px;
}

.door-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
}

.door-radio input[type="radio"] {
    display: none;
}

.radio-circle {
    width: 16px;
    height: 16px;
    border: 2px solid #666;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.door-radio input[type="radio"]:checked + .radio-circle {
    border-color: #2c3e50;
    background: #2c3e50;
}

.door-radio input[type="radio"]:checked + .radio-circle::after {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

.radio-label {
    font-weight: 600;
    color: #333;
}

/* --------------------------------------------------------------------------
   23. Inspection Modal — Professional Document Style
   -------------------------------------------------------------------------- */
.inspection-document {
    background: #fff;
    font-family: Arial, sans-serif;
    font-size: 13px;
    color: #333;
}

.inspection-header {
    position: relative;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c3e50 100%);
    color: #fff;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.inspection-header-title h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.inspection-header-title p {
    margin: 3px 0 0 0;
    font-size: 12px;
    opacity: 0.75;
    letter-spacing: 0.5px;
    font-weight: 300;
}

.inspection-header-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.inspection-header-close:hover {
    background: rgba(255,255,255,0.3);
}

.inspection-info-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    padding: 15px 20px;
    border-bottom: 2px solid #2c3e50;
    background: #f8f9fa;
}

.inspection-info-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.inspection-info-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inspection-info-field label {
    font-weight: 600;
    font-size: 12px;
    color: #2c3e50;
    white-space: nowrap;
    min-width: 100px;
}

.inspection-info-field input,
.inspection-info-field select {
    flex: 1;
    border: none;
    border-bottom: 1px solid #2c3e50;
    background: transparent;
    padding: 5px 0;
    font-size: 13px;
    outline: none;
}

.inspection-info-field input:focus,
.inspection-info-field select:focus {
    border-bottom-color: #e74c3c;
}

.inspection-main-content {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 0;
    border-bottom: 2px solid #2c3e50;
}

.installation-info {
    border-right: 2px solid #2c3e50;
    padding: 0;
    min-width: 0;
}

.installation-info h3 {
    background: #2c3e50;
    color: #fff;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
}

.installation-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.installation-table td {
    padding: 5px 6px;
    border-bottom: 1px solid #ddd;
    border-right: 1px solid #ddd;
    font-size: 10px;
    vertical-align: top;
    line-height: 1.25;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.installation-table td:last-child {
    border-right: none;
}

.installation-table td:first-child {
    background: #f8f9fa;
    font-weight: 600;
    width: 24%;
    color: #2c3e50;
}

.installation-table td:nth-child(2) {
    width: 38%;
    background: #fff3e0;
}

.installation-table td:nth-child(3) {
    width: 38%;
    background: #e8f5e9;
}

.installation-table tr:last-child td {
    border-bottom: none;
}

.installation-table tr.table-header td {
    border-bottom: 2px solid #2c3e50;
    padding: 4px 6px;
}

.inspection-checklist {
    padding: 0;
}

.inspection-checklist h3 {
    background: #2c3e50;
    color: #fff;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Desktop checklist table */
.checklist-desktop {
    font-size: 11px;
}

.checklist-desktop th {
    background: #f8f9fa;
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    border: 1px solid #ddd;
}

.checklist-desktop th:first-child {
    text-align: left;
    width: 30%;
}

.checklist-desktop .item-row td {
    padding: 4px 6px;
    border: 1px solid #ddd;
    font-size: 10px;
    vertical-align: top;
}

.checklist-desktop .item-row td:first-child {
    background: #f8f9fa;
    font-weight: 500;
    color: #2c3e50;
    line-height: 1.3;
}

.checklist-desktop .sub {
    font-size: 9px;
    color: #888;
    font-weight: 400;
}

.issue-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid #ccc;
    padding: 3px 4px;
    font-size: 11px;
    background: transparent;
    outline: none;
    box-sizing: border-box;
}

.issue-input:focus {
    border-bottom-color: #e74c3c;
}

textarea.checklist-textarea {
    resize: vertical;
    min-height: 40px;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 8px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea.checklist-textarea:focus {
    border-color: #1e3a5f;
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
    background: #fff;
}

/* Mobile checklist cards */
.checklist-mobile {
    display: none;
    padding: 10px;
}

.checklist-card {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 10px;
}

.checklist-card-title {
    font-weight: 600;
    font-size: 12px;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.3;
}

.checklist-card-title .sub {
    font-size: 10px;
    color: #888;
    font-weight: 400;
}

.checklist-card-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.checklist-card-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checklist-card-field label {
    font-size: 9px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
}

.checklist-card-field input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 6px;
    font-size: 12px;
    background: #fff;
}

.checklist-total-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #e8f4fd;
    border-color: #b6d4e8;
}

/* Inspection Additional Fields */
.inspection-additional {
    padding: 0;
}

.inspection-additional h3 {
    background: #2c3e50;
    color: #fff;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
}

.additional-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 15px;
}

.additional-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.additional-field.full-width {
    grid-column: 1 / -1;
}

.additional-field label {
    font-weight: 600;
    font-size: 12px;
    color: #2c3e50;
}

.additional-field input,
.additional-field select {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 13px;
}

.additional-field input:focus,
.additional-field select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,0.1);
}

.checkbox-row {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 5px 0;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 400;
    font-size: 13px;
    cursor: pointer;
}

.photo-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.photo-upload-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.photo-upload-item label {
    font-weight: 600;
    font-size: 11px;
    color: #666;
}

.photo-upload-item input[type="file"] {
    font-size: 12px;
    padding: 6px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    background: #fafafa;
}

/* Inspection Modal Footer */
.inspection-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 2px solid #2c3e50;
    border-radius: 0 0 8px 8px;
}

/* --------------------------------------------------------------------------
   24. Settings-specific
   -------------------------------------------------------------------------- */
.logo-upload-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#logo_preview img {
    max-width: 200px;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 4px;
}

.signature-upload-container {
    display: flex;
    gap: 10px;
}

#signature_preview img {
    max-width: 200px;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   25. Select2 Overrides
   -------------------------------------------------------------------------- */
.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--single {
    height: 42px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 42px;
    padding-left: 10px;
}

.select2-container .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

.select2-container .select2-selection--multiple {
    min-height: 42px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.select2-container .select2-selection--multiple .select2-selection__rendered {
    padding: 5px 10px;
}

/* --------------------------------------------------------------------------
   26. Login Page
   -------------------------------------------------------------------------- */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.5s ease-out 1s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-6);
}

.login-logo img {
    max-width: 200px;
}

.login-title {
    text-align: center;
    font-size: var(--text-2xl);
    margin-bottom: var(--space-6);
    color: var(--color-text);
    font-weight: 700;
}

.login-container .footer-text {
    text-align: center;
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.login-container .footer-text p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.login-container .footer-text a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.login-container .footer-text a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   27. Loader Overlay
   -------------------------------------------------------------------------- */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #26547D 0%, #1a3d5c 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeOut 0.3s ease-out 1s forwards;
}

.loader-content {
    text-align: center;
    animation: pulse 1s ease-in-out;
}

.loader-logo {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.loader-slogan {
    font-size: 16px;
    font-weight: 300;
    color: rgba(255,255,255,0.9);
    margin-bottom: 30px;
    letter-spacing: 1px;
    font-style: italic;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   28. Animations
   -------------------------------------------------------------------------- */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; visibility: hidden; }
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.05); opacity: 0.8; }
}

/* --------------------------------------------------------------------------
   29. Responsive — 768px
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    /* Header */
    .header-content {
        padding: 0 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-logo h2 {
        font-size: 16px;
    }

    .header-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 1px;
        padding: 3px;
    }

    .header-nav .nav-item {
        padding: 6px 10px;
        font-size: 12px;
        gap: 4px;
    }

    .header-nav .nav-item svg {
        width: 14px;
        height: 14px;
    }

    .header-right {
        align-items: center;
    }

    .header-right-top {
        font-size: 13px;
        text-align: center;
    }

    .header-right-bottom {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Container */
    .container {
        margin: var(--space-4) auto;
        padding: 0 var(--space-3);
    }

    /* Welcome */
    .welcome {
        padding: var(--space-4);
    }

    .welcome h1 {
        font-size: var(--text-xl);
    }

    /* Stats */
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: var(--space-3);
    }

    .stat-box {
        padding: var(--space-4);
    }

    .stat-box .number {
        font-size: var(--text-2xl);
    }

    /* Sections */
    .inspections, .section {
        padding: var(--space-4);
    }

    .inspections h2, .section h2 {
        font-size: var(--text-xl);
    }

    /* Tables */
    table {
        font-size: 13px;
    }

    th, td {
        padding: 8px 6px;
    }

    /* Page Header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
        text-align: center;
    }

    .dashboard-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dashboard-section-header a {
        width: 100%;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Desktop tables hide, mobile cards show */
    .data-table-desktop {
        display: none;
    }

    .data-cards {
        display: block;
    }

    /* Data table overflow */
    .data-table {
        overflow-x: auto;
    }

    .data-table table {
        min-width: 800px;
    }

    /* Forms */
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .client-select-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .form-group input {
        font-size: 16px;
    }

    /* Modal — full screen on mobile */
    .modal-overlay {
        padding: 0;
    }

    .modal-container {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .modal-header {
        border-radius: 0;
    }

    .modal-footer {
        border-radius: 0;
    }

    .inspection-header {
        border-radius: 0;
    }

    .inspection-footer {
        border-radius: 0;
    }

    /* Inspection Modal */
    .inspection-main-content {
        grid-template-columns: 1fr;
    }

    .installation-info {
        border-right: none;
        border-bottom: 2px solid #2c3e50;
    }

    .installation-table-wrap {
        overflow-x: auto;
    }

    .installation-table {
        min-width: 600px;
        table-layout: auto;
    }

    .inspection-info-fields {
        grid-template-columns: 1fr;
    }

    .inspection-info-row {
        grid-template-columns: 1fr;
    }

    .checklist-desktop {
        display: none;
    }

    .checklist-mobile {
        display: block;
    }

    .additional-fields-grid {
        grid-template-columns: 1fr;
    }

    .photo-upload-grid {
        grid-template-columns: 1fr;
    }

    .inspection-footer {
        flex-wrap: wrap;
    }

    .inspection-footer .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        text-align: center;
    }

    /* Client Detail */
    .client-header-top {
        flex-direction: column;
    }

    .client-action-buttons {
        width: 100%;
    }

    .client-action-buttons .btn {
        flex: 1;
        justify-content: center;
        text-align: center;
    }

    .client-info {
        grid-template-columns: 1fr 1fr;
    }

    /* Job Detail */
    .job-header-top {
        flex-direction: column;
    }

    .job-action-buttons {
        width: 100%;
    }

    .job-action-buttons .btn {
        flex: 1;
        justify-content: center;
        text-align: center;
    }

    /* Footer */
    .footer {
        padding: 20px 0;
        margin-top: 30px;
    }

    .footer-content {
        padding: 0 15px;
    }
}

/* --------------------------------------------------------------------------
   30. Responsive — 480px
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .header-logo img {
        max-height: 40px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .welcome h1 {
        font-size: 18px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 6px 4px;
    }

    /* Loader */
    .loader-logo {
        font-size: 24px;
        letter-spacing: 1px;
        padding: 0 20px;
    }

    .loader-slogan {
        font-size: 13px;
        padding: 0 20px;
    }

    .loader-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }

    /* Client Detail */
    .client-info {
        grid-template-columns: 1fr;
    }

    .client-action-buttons {
        flex-direction: column;
    }

    /* Login */
    .login-container {
        margin: 50px auto 20px;
        padding: 30px 20px;
    }
}
