/* BuildPro - Construction & Renovation Management Styles */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --accent: #3b82f6;
    --accent-light: #f1f5f9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #3b82f6;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 14px;
    --radius-sm: 10px;
}

[data-theme="dark"] {
    --bg-primary: #18181b;
    --bg-secondary: #27272a;
    --bg-card: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #d4d4d8;
    --text-muted: #71717a;
    --border-color: #3f3f46;
    --accent-light: #3f3f46;
    --sidebar-bg: #09090b;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.logo-icon { font-size: 28px; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-section { margin-bottom: 24px; }

.nav-section-title {
    display: block;
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sidebar-text);
    opacity: 0.6;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--sidebar-active);
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: var(--sidebar-active);
    background: rgba(234, 88, 12, 0.3);
    border-right: 3px solid var(--accent);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.user-details { flex: 1; }
.user-name { display: block; color: #fff; font-size: 14px; font-weight: 500; }
.user-role { display: block; color: var(--sidebar-text); font-size: 12px; }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-primary);
}

.search-bar {
    flex: 1;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weather-widget {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.icon-btn:hover { border-color: var(--accent); }

.icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-secondary);
    fill: none;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pages */
.page {
    display: none;
    padding: 24px;
}

.page.active { display: block; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Buttons */
.primary-btn, .secondary-btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn {
    background: var(--accent);
    color: #fff;
    border: none;
}

.primary-btn:hover { background: #c2410c; }

.secondary-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover { border-color: var(--accent); }

/* Badges */
.bc-badge, .ai-badge, .worksafe-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.bc-badge {
    background: #fee2e2;
    color: #991b1b;
}

.ai-badge {
    background: #f3e8ff;
    color: #7c3aed;
}

.worksafe-badge {
    background: #fef3c7;
    color: #92400e;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.kpi-icon.projects { background: #fff7ed; }
.kpi-icon.revenue { background: #dcfce7; }
.kpi-icon.crew { background: #dbeafe; }
.kpi-icon.inspections { background: #fef3c7; }

.kpi-change {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.kpi-change.positive { background: #dcfce7; color: #166534; }

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 4px;
}

.kpi-label {
    font-size: 14px;
    color: var(--text-muted);
}

/* Weather Alert */
.weather-alert {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #fef3c7;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.alert-icon { font-size: 24px; }
.alert-content { flex: 1; font-size: 14px; color: #92400e; }

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.view-all {
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
}

.date-badge {
    font-size: 12px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 20px;
    color: var(--text-muted);
}

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

.project-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.project-color {
    width: 4px;
    height: 40px;
    border-radius: 2px;
}

.project-info { flex: 1; }
.project-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.project-address { font-size: 12px; color: var(--text-muted); }

.project-progress {
    width: 100px;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
}

.project-percent {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    min-width: 45px;
    text-align: right;
}

/* Schedule Timeline */
.schedule-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-item {
    display: flex;
    gap: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.schedule-time {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    min-width: 60px;
}

.schedule-content { flex: 1; }
.schedule-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.schedule-location { font-size: 12px; color: var(--text-muted); }

.schedule-crew {
    display: flex;
    gap: -8px;
}

.crew-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    font-weight: 600;
    margin-left: -8px;
}

.crew-avatar:first-child { margin-left: 0; }

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

.inspection-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.inspection-date {
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    text-align: center;
    min-width: 55px;
}

.inspection-date .day {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.inspection-date .month {
    font-size: 10px;
    color: var(--text-muted);
}

.inspection-info { flex: 1; }
.inspection-type { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.inspection-project { font-size: 12px; color: var(--text-muted); }

.inspection-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.inspection-status.scheduled { background: #dbeafe; color: #1e40af; }
.inspection-status.ready { background: #dcfce7; color: #166534; }
.inspection-status.pending { background: #fef3c7; color: #92400e; }

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

.order-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.order-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.order-info { flex: 1; }
.order-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.order-supplier { font-size: 12px; color: var(--text-muted); }

.order-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.order-status.delivered { background: #dcfce7; color: #166534; }
.order-status.transit { background: #dbeafe; color: #1e40af; }
.order-status.processing { background: #fef3c7; color: #92400e; }

/* Filters */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
}

.filters-bar select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.project-image {
    height: 120px;
    background: linear-gradient(135deg, var(--accent) 0%, #c2410c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

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

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.project-card-title {
    font-size: 16px;
    font-weight: 600;
}

.project-type-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.project-type-badge.renovation { background: #dbeafe; color: #1e40af; }
.project-type-badge.new-build { background: #dcfce7; color: #166534; }
.project-type-badge.addition { background: #fef3c7; color: #92400e; }
.project-type-badge.commercial { background: #f3e8ff; color: #7c3aed; }

.project-card-address {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.project-card-progress {
    margin-bottom: 12px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.project-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* Stats Cards */
.estimates-stats, .crew-stats, .invoice-stats, .study-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-icon { font-size: 24px; margin-bottom: 8px; display: block; }
.stat-value { font-size: 24px; font-weight: 700; font-family: var(--font-mono); display: block; }
.stat-label { font-size: 13px; color: var(--text-muted); }

.stat-card.worksafe { background: #fef3c7; border-color: #fcd34d; }

/* Table */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.data-table td { font-size: 14px; }
.data-table tbody tr:hover { background: var(--bg-secondary); }

.status-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.status-tag.sent { background: #dbeafe; color: #1e40af; }
.status-tag.viewed { background: #fef3c7; color: #92400e; }
.status-tag.accepted { background: #dcfce7; color: #166534; }
.status-tag.declined { background: #fee2e2; color: #991b1b; }
.status-tag.paid { background: #dcfce7; color: #166534; }
.status-tag.overdue { background: #fee2e2; color: #991b1b; }
.status-tag.pending { background: #fef3c7; color: #92400e; }
.status-tag.active { background: #dbeafe; color: #1e40af; }

/* Gantt Chart */
.gantt-chart {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 20px;
    overflow-x: auto;
}

.schedule-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.week-label {
    font-weight: 600;
    min-width: 100px;
    text-align: center;
}

/* Crew Grid */
.crew-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.crew-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
}

.crew-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    font-weight: 600;
}

.crew-info { flex: 1; }
.crew-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.crew-role { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }

.crew-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.crew-badge {
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 12px;
    font-size: 11px;
}

/* Suppliers */
.suppliers-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.supplier-badge {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
}

/* Materials Grid */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.material-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.material-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.material-name { font-size: 14px; font-weight: 500; }

.stock-status {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.stock-status.in-stock { background: #dcfce7; color: #166534; }
.stock-status.low { background: #fef3c7; color: #92400e; }
.stock-status.out { background: #fee2e2; color: #991b1b; }

.material-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Permits */
.permits-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.permit-stat {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.permit-stat .value {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
}

.permit-stat .label {
    font-size: 13px;
    color: var(--text-muted);
}

.permits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.permit-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.permit-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.permit-number {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
}

.permit-project { font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.permit-type { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }

.permit-dates {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* Checklist */
.inspection-checklist {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.inspection-checklist h3 { margin-bottom: 16px; }

.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.checklist-item label { flex: 1; font-size: 14px; }

.checklist-note {
    font-size: 12px;
    color: var(--text-muted);
}

/* Safety Page */
.safety-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.safety-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.safety-card.safe {
    background: #dcfce7;
    border-color: #86efac;
}

.safety-card .big-number {
    font-size: 48px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.safety-card.safe .big-number { color: #166534; }

.safety-card .label {
    font-size: 13px;
    color: var(--text-muted);
}

.safety-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.training-list, .ppe-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.training-item, .ppe-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.training-name, .ppe-name { flex: 1; font-size: 14px; }

.training-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.training-status.valid { background: #dcfce7; color: #166534; }
.training-status.expiring { background: #fef3c7; color: #92400e; }
.training-status.expired { background: #fee2e2; color: #991b1b; }

.safety-forms { margin-bottom: 24px; }
.safety-forms h3 { margin-bottom: 16px; }

.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.form-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.form-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.form-icon { font-size: 32px; margin-bottom: 8px; display: block; }
.form-name { font-size: 14px; font-weight: 500; }

/* Warranty */
.warranty-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.warranty-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.warranty-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.warranty-years {
    font-size: 48px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
}

.warranty-label {
    font-size: 14px;
    color: var(--text-muted);
}

.warranty-card h4 {
    font-size: 16px;
    margin-bottom: 8px;
}

.warranty-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.warranty-projects { margin-bottom: 24px; }
.warranty-projects h3 { margin-bottom: 16px; }

/* Costing */
.costing-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.cost-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.cost-card .label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.cost-card .value {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.cost-card.positive .value { color: var(--success); }

.cost-breakdown {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.cost-breakdown h3 { margin-bottom: 20px; }

.breakdown-chart {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.breakdown-label {
    min-width: 120px;
    font-size: 14px;
}

.breakdown-bar {
    flex: 1;
    height: 24px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}

.breakdown-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}

.breakdown-fill.budget { background: var(--accent); }
.breakdown-fill.actual { background: #10b981; }

/* Calculator */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.calc-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.calc-card h3 { margin-bottom: 20px; }

.calc-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
}

.calc-result {
    padding: 16px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.calc-result h4 { margin-bottom: 8px; }
.calc-result p { margin: 4px 0; color: var(--text-secondary); }
.calc-result strong { color: var(--accent); font-family: var(--font-mono); }

/* AI Estimator */
.ai-estimator {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.estimator-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.estimator-form h3 { margin-bottom: 20px; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.checkbox-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.checkbox-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.estimate-result {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.result-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    min-height: 300px;
}

.result-placeholder span { font-size: 48px; margin-bottom: 12px; }

.estimate-output h3 { margin-bottom: 20px; }

.total-estimate {
    text-align: center;
    padding: 24px;
    background: var(--accent-light);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.total-label { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.total-value { font-size: 48px; font-weight: 700; font-family: var(--font-mono); color: var(--accent); }

.estimate-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.estimate-line {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.estimate-line span:last-child {
    font-family: var(--font-mono);
    font-weight: 500;
}

.estimate-line.total {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* Reports */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.report-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.report-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.report-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.report-info h4 { font-size: 14px; margin-bottom: 4px; }
.report-info p { font-size: 13px; color: var(--text-muted); }

/* Payment Timeline */
.payment-schedule {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.payment-schedule h3 { margin-bottom: 20px; }

.payment-timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.payment-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.payment-milestone {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.payment-milestone.completed {
    background: var(--accent);
    color: #fff;
}

.payment-info { flex: 1; }
.payment-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.payment-desc { font-size: 13px; color: var(--text-muted); }

.payment-amount {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.payment-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.payment-status.paid { background: #dcfce7; color: #166534; }
.payment-status.due { background: #fef3c7; color: #92400e; }
.payment-status.upcoming { background: #f1f5f9; color: #64748b; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 200;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 480px;
}

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

.modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.modal-close svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
}

.modal-body { padding: 20px; }
.modal-body .form-group { margin-bottom: 16px; }

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--success);
    animation: toastIn 0.3s ease;
}

.toast.error { border-left-color: var(--danger); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid, .dashboard-row { grid-template-columns: 1fr; }
    .ai-estimator { grid-template-columns: 1fr; }
    .safety-sections { grid-template-columns: 1fr; }
    .warranty-info { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .page { padding: 16px; }
    .kpi-grid, .permits-overview, .costing-overview, .safety-stats { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 99;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Equipment Grid */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.equipment-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.equipment-icon { font-size: 32px; margin-bottom: 12px; display: block; }
.equipment-name { font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.equipment-status { font-size: 13px; color: var(--text-muted); }
