:root {
    --primary: #1e3a5f; --primary-hover: #16314f; --accent: #3b82f6; --success: #16a34a;
    --warning: #d97706; --danger: #dc2626; --bg: #f5f7fb; --surface: #fff;
    --surface-alt: #f8fafc; --text: #0f172a; --text-soft: #64748b; --border: #e2e8f0;
    --sidebar-width: 256px; --radius-sm: 10px; --radius-md: 12px; --radius-lg: 16px;
    --shadow-card: 0 8px 24px rgba(15, 23, 42, .055);
    font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
    color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; width: var(--sidebar-width); flex-direction: column; overflow-y: auto; color: #dce7f5; background: #112a47; }
.brand { display: flex; min-height: 82px; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; flex: 0 0 auto; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #4f8de7, #2563a9); box-shadow: 0 8px 18px rgba(0,0,0,.18); font-size: 12px; font-weight: 900; }
.brand strong, .brand small, .user-summary strong, .user-summary small { display: block; }
.brand strong { color: #fff; font-size: 17px; letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: #91a7bf; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 16px 12px 24px; }
.nav-label { margin: 20px 12px 7px; color: #7890a9; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 4px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; margin: 3px 0; padding: 9px 11px; border-radius: 10px; color: #b9c9da; font-size: 13px; font-weight: 650; transition: background .18s, color .18s; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.065); }
.nav-link.active { color: #fff; background: rgba(59,130,246,.23); box-shadow: inset 3px 0 0 #60a5fa; }
.nav-icon { display: grid; width: 25px; height: 25px; place-items: center; color: #95b2d0; font-size: 17px; }
.nav-link.active .nav-icon { color: #8fc0ff; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 15px 14px; border-top: 1px solid rgba(255,255,255,.09); background: rgba(4,17,31,.18); }
.user-summary { display: flex; min-width: 0; flex: 1; align-items: center; gap: 9px; }
.user-summary > span:last-child { min-width: 0; }
.user-summary strong { overflow: hidden; color: #fff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-summary small { color: #88a0b8; font-size: 10px; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; color: #fff; background: #294b70; font-size: 12px; font-weight: 800; }
.icon-btn, .menu-toggle { display: grid; place-items: center; border: 0; cursor: pointer; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; color: #9bb0c6; background: transparent; font-size: 18px; }
.icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar-backdrop { display: none; }

.app-main { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; min-height: 68px; align-items: center; gap: 20px; padding: 0 30px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.menu-toggle { display: none; width: 42px; height: 42px; border-radius: var(--radius-sm); color: var(--primary); background: var(--surface-alt); font-size: 20px; }
.global-search { position:relative; display: flex; width: min(430px, 42vw); align-items: center; gap: 9px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--radius-sm); color: #94a3b8; background: #f1f5f9; transition: border .18s, background .18s, box-shadow .18s; }
.global-search:focus-within { border-color: #a9c8ef; background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.global-search input { min-width:0; height:40px; min-height:40px; flex:1; padding:0; border:0; outline:0; background:transparent; box-shadow:none; }
.global-search-clear { display:grid; width:30px; height:30px; flex:0 0 auto; place-items:center; padding:0; border:0; border-radius:8px; color:#64748b; background:transparent; cursor:pointer; font-size:14px; }
.global-search-clear:hover,.global-search-clear:focus-visible { color:var(--primary); background:#e2e8f0; outline:0; }
.global-search-clear[hidden] { display:none; }
.global-search-results { position:absolute; top:calc(100% + 9px); left:0; z-index:80; display:grid; width:min(520px, calc(100vw - 32px)); max-height:390px; overflow:auto; padding:7px; border:1px solid var(--border); border-radius:14px; color:var(--text); background:#fff; box-shadow:0 18px 45px rgba(15,23,42,.16); }
.global-search-results[hidden] { display:none; }
.global-search-result { display:flex; align-items:center; gap:11px; padding:10px; border-radius:10px; color:var(--text); text-decoration:none; }
.global-search-result:hover,.global-search-result.active { background:#eff6ff; text-decoration:none; }
.global-search-result-icon { display:grid; width:36px; height:36px; flex:0 0 auto; place-items:center; border-radius:10px; color:var(--primary); background:#eaf2fb; font-size:16px; }
.global-search-result-copy { min-width:0; }
.global-search-result-copy strong,.global-search-result-copy small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.global-search-result-copy strong { font-size:13px; }
.global-search-result-copy small { margin-top:2px; color:var(--text-soft); font-size:11px; }
.global-search-empty { padding:16px 12px; color:var(--text-soft); text-align:center; font-size:12px; }
.topbar-actions { display: flex; flex: 1; align-items: center; justify-content: flex-end; gap: 16px; }
.topbar-date { color: var(--text-soft); font-size: 12px; }
.content-wrap { width: 100%; max-width: 1500px; margin: 0 auto; padding: 30px 32px 56px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-header h1 { margin-bottom: 5px; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
h1 { margin: 0 0 20px; color: var(--text); font-size: clamp(24px, 3vw, 30px); line-height: 1.2; letter-spacing: -.035em; }
h2 { margin: 0; color: var(--text); font-size: 17px; line-height: 1.35; letter-spacing: -.015em; }
h3 { margin: 0; font-size: 15px; }
p { margin-top: 0; }
.muted { color: var(--text-soft); }
.page-subtitle { margin: 0; color: var(--text-soft); font-size: 13px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title small { color: var(--text-soft); font-weight: 500; }

.row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.between { justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-card); padding: 20px; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-header p { margin: 4px 0 0; color: var(--text-soft); font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { position: relative; overflow: hidden; min-height: 136px; padding: 19px; }
.stat-card::after { content: ''; position: absolute; right: -24px; bottom: -40px; width: 95px; height: 95px; border-radius: 50%; background: var(--stat-tint, #eff6ff); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-label { margin: 0; color: var(--text-soft); font-size: 12px; font-weight: 650; }
.stat-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--stat-color, var(--primary)); background: var(--stat-tint, #eff6ff); font-weight: 850; }
.stat-icon i { display:block; font-size:16px; line-height:1; }
.stat-value { position: relative; z-index: 1; margin: 14px 0 2px; font-size: 27px; font-weight: 800; letter-spacing: -.04em; }
.stat-note { position: relative; z-index: 1; margin: 0; color: var(--text-soft); font-size: 11px; }
.dashboard-panels { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 16px; margin-bottom: 22px; }
.compact-list { display: grid; gap: 3px; }
.compact-list-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid #eef2f7; }
.compact-list-item:last-child { border-bottom: 0; }
.compact-list-item p { margin: 0; }
.list-icon { display: grid; width: 37px; height: 37px; place-items: center; flex: 0 0 auto; border-radius: 11px; color: var(--primary); background: #f1f5f9; font-weight: 800; }
.list-icon i { display:block; font-size:16px; line-height:1; }
.list-main { display: flex; min-width: 0; flex: 1; align-items: center; gap: 10px; }
.list-main strong, .list-main small { display: block; }
.list-main small { color: var(--text-soft); }

.btn { appearance: none; display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; color: #fff; background: var(--primary); font-weight: 750; line-height: 1.1; transition: background .18s, border .18s, transform .18s, box-shadow .18s; }
.btn:hover { background: var(--primary-hover); box-shadow: 0 6px 14px rgba(30,58,95,.14); }
.btn:active { transform: translateY(1px); }
.btn.secondary, .btn.btn-secondary { border-color: var(--border); color: #334155; background: #fff; box-shadow: none; }
.btn.secondary:hover, .btn.btn-secondary:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.danger, .btn.btn-danger { color: #fff; background: var(--danger); }
.btn.btn-compact { min-height: 38px; padding: 8px 12px; font-size: 12px; }
.btn.btn-ghost { min-height: 34px; padding: 6px 9px; color: var(--primary); background: transparent; font-size: 12px; }
.btn.btn-ghost:hover { background: #eff6ff; box-shadow: none; }
.btn[disabled] { opacity: .55; cursor: wait; }
.action-link { color: #2563a9; font-weight: 750; }
.action-link:hover { text-decoration: underline; }

input, select, textarea { width: 100%; border: 1px solid #d5dde8; border-radius: var(--radius-sm); padding: 10px 12px; outline: none; color: var(--text); background: #fff; transition: border .18s, box-shadow .18s; }
input, select { min-height: 42px; }
input:focus, select:focus, textarea:focus { border-color: #8eb7e9; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
input::placeholder, textarea::placeholder { color: #94a3b8; }
textarea { min-height: 110px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 17px; min-height: 17px; accent-color: var(--primary); }
label { display: block; margin-bottom: 7px; color: #334155; font-size: 12px; font-weight: 750; }
.field { margin-bottom: 16px; }
.field-help { display: block; margin-top: 7px; color: var(--text-soft); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 16px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 18px; border-top: 1px solid var(--border); }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; padding: 12px; border-radius: 12px; background: var(--surface-alt); }
.filter-bar input { max-width: 420px; }
.filter-bar select { max-width: 280px; }
.check-row { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.file-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.upload-zone { padding: 18px; border: 1px dashed #afc2d8; border-radius: 13px; background: #f8fbff; }
.upload-zone h3 { margin-bottom: 4px; }
.upload-zone p { margin-bottom: 14px; color: var(--text-soft); font-size: 12px; }
.file-selection { margin: 10px 0 0; color: var(--text-soft); font-size: 11px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 13px 12px; border-bottom: 1px solid #edf1f6; text-align: left; vertical-align: middle; font-size: 13px; }
th { color: #64748b; background: #fafbfc; font-size: 10px; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
th:first-child { border-radius: 9px 0 0 9px; }
th:last-child { border-radius: 0 9px 9px 0; }
.table-sort { display: inline-flex; align-items: center; gap: 5px; color: inherit; transition: color .15s; }
.table-sort:hover, .table-sort.active { color: var(--primary); }
.table-sort i { font-size: 11px; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: 0; }
.cell-title { display: block; color: var(--text); font-weight: 750; }
.cell-subtitle { display: block; margin-top: 2px; color: var(--text-soft); font-size: 11px; }
.table-actions { text-align: right; white-space: nowrap; }
.empty-state { padding: 34px 20px !important; color: var(--text-soft); text-align: center; }

.badge { display: inline-flex; min-height: 25px; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; color: #475569; background: #f1f5f9; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .72; }
.badge.success { color: #15803d; background: #ecfdf3; }
.badge.warning { color: #b45309; background: #fff7ed; }
.badge.danger { color: #b91c1c; background: #fef2f2; }
.badge.info { color: #1d4ed8; background: #eff6ff; }
.badge.neutral { color: #475569; background: #f1f5f9; }
.badge.status-accepted, .badge.status-inspecting { color: #1d4ed8; background: #eff6ff; }
.badge.status-awaiting_approval, .badge.status-awaiting_parts, .badge.status-awaiting_payment { color: #b45309; background: #fff7ed; }
.badge.status-in_progress { color: #6d28d9; background: #f5f3ff; }
.badge.status-completed, .badge.status-ready_for_delivery, .badge.status-delivered { color: #15803d; background: #ecfdf3; }
.badge.status-cancelled { color: #b91c1c; background: #fef2f2; }

.alert { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid; border-radius: 12px; }
.alert > span:first-child { display: grid; width: 22px; height: 22px; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; font-weight: 850; }
.alert ul { margin: 5px 0 0; padding-left: 18px; }
.alert-success, .flash { border-color: #b7e5c7; color: #166534; background: #effcf3; }
.alert-success > span:first-child { background: var(--success); }
.alert-danger, .errors { border-color: #fecaca; color: #991b1b; background: #fff5f5; }
.alert-danger > span:first-child { background: var(--danger); }
.flash, .errors { padding: 13px 15px; border-style: solid; border-width: 1px; border-radius: 12px; }

.service-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); gap: 16px; align-items: start; }
.service-sidebar { display: grid; gap: 16px; }
.stepper { display: flex; align-items: center; gap: 0; margin: 0 0 24px; }
.step { display: flex; min-width: 0; flex: 1; align-items: center; color: #94a3b8; font-size: 11px; font-weight: 750; }
.step::after { content: ''; height: 1px; flex: 1; margin: 0 10px; background: #dbe3ed; }
.step:last-child::after { display: none; }
.step-number { display: grid; width: 28px; height: 28px; place-items: center; flex: 0 0 auto; margin-right: 7px; border: 1px solid #cbd5e1; border-radius: 50%; background: #fff; }
.step.active { color: var(--primary); }
.step.active .step-number { border-color: var(--primary); color: #fff; background: var(--primary); }
.info-callout { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border-radius: 12px; color: #1e40af; background: #eff6ff; font-size: 12px; }
.info-callout strong { display: block; margin-bottom: 2px; }

.guest-body { background: #eaf0f7; }
.guest-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, rgba(59,130,246,.1), transparent 34%), linear-gradient(135deg, #f7faff 0%, #e9eff7 100%); }
.login-shell { display: grid; width: min(920px,100%); min-height: 560px; grid-template-columns: 1.08fr .92fr; overflow: hidden; border: 1px solid rgba(255,255,255,.7); border-radius: 22px; background: #fff; box-shadow: 0 25px 65px rgba(15,23,42,.13); }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; padding: 48px; color: #fff; background: linear-gradient(155deg, #102842 0%, #1e3a5f 65%, #28588d 100%); }
.login-brand::before, .login-brand::after { content: ''; position: absolute; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; }
.login-brand::before { width: 360px; height: 360px; top: -170px; right: -120px; }
.login-brand::after { width: 260px; height: 260px; top: -70px; right: -50px; }
.login-logo { position: absolute; top: 42px; left: 48px; display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 850; }
.login-brand h1 { max-width: 390px; margin: 0 0 12px; color: #fff; font-size: 36px; }
.login-brand p { max-width: 380px; margin: 0; color: #b9cadc; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 52px; }
.login-panel h2 { margin-bottom: 6px; font-size: 25px; }
.login-panel > p { margin-bottom: 28px; color: var(--text-soft); }
.login-panel .btn { width: 100%; margin-top: 4px; }
nav[role="navigation"] { margin-top: 18px; }

/* Unified 2026 interface */
.page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:24px; }
.page-heading h1 { margin:0 0 5px; font-size:34px; }
.page-heading p { margin:0; }
.form-card { padding:24px; }
.form-card h2 { display:flex; align-items:center; gap:9px; margin-bottom:20px; }
.form-wide { max-width:980px; margin-inline:auto; }
.form-section + .form-section { margin-top:24px; padding-top:24px; border-top:1px solid var(--border); }
.form-grid.two { grid-template-columns:repeat(2,minmax(0,1fr)); }
.span-2 { grid-column:span 2; }
.field small { display:block; margin-top:6px; color:var(--text-soft); font-size:11px; }
.input-icon { position:relative; }
.input-icon > i { position:absolute; z-index:2; top:50%; left:13px; color:#64748b; transform:translateY(-50%); pointer-events:none; }
.input-icon input { padding-left:39px; }
.users-layout { display:grid; grid-template-columns:minmax(280px,360px) minmax(0,1fr); gap:18px; align-items:start; }
.inline-edit { min-width:280px; padding-top:12px; }
.person-actions > summary { display:inline-flex; align-items:center; gap:7px; cursor:pointer; color:#2563a9; font-weight:750; list-style:none; }
.person-actions > summary::-webkit-details-marker { display:none; }
.person-actions > summary::after { content:'›'; margin-left:2px; transition:transform .18s; }
.person-actions[open] > summary::after { transform:rotate(90deg); }
.inline-edit-actions { display:flex; justify-content:flex-end; }
.person-delete-form { display:flex; justify-content:flex-end; margin-top:14px; padding-top:14px; border-top:1px solid #fee2e2; }
.person-delete-form .btn { min-height:38px; padding:8px 12px; }
.expense-action-column{width:190px}.expense-actions-cell{text-align:right;white-space:nowrap}.expense-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px}.expense-actions form{margin:0}.expense-edit{position:relative}.expense-edit>summary{list-style:none}.expense-edit>summary::-webkit-details-marker{display:none}.expense-edit-form{position:absolute;z-index:20;top:45px;right:0;display:grid;width:430px;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 12px;padding:16px;border:1px solid var(--border);border-radius:14px;background:#fff;box-shadow:0 18px 45px rgba(15,23,42,.18);white-space:normal;text-align:left}.expense-edit-form .field{margin-bottom:12px}.expense-edit-form .span-2{grid-column:1/-1}.expense-edit-buttons{display:flex;justify-content:flex-end;padding-top:4px}
.check-label { display:flex; align-items:center; gap:8px; font-weight:600; }
.check-label input { width:auto; }
.table-card { overflow-x:auto; padding:8px; }
.text-right { text-align:right; }
.is-muted { opacity:.55; }
.wide { width:100%; }
.danger-outline { border-color:#fecaca; color:#b91c1c; background:#fff; }
.action-stack { display:grid; gap:10px; }
.detail-grid { display:grid; grid-template-columns:minmax(0,1.3fr) minmax(300px,.7fr); gap:18px; align-items:start; }
.detail-list { margin:0; }
.detail-list>div { display:grid; grid-template-columns:140px minmax(0,1fr); gap:18px; padding:13px 0; border-bottom:1px solid #edf1f6; }
.detail-list>div:last-child { border-bottom:0; }
.detail-list dt { color:var(--text-soft); font-size:12px; font-weight:700; }
.detail-list dd { margin:0; overflow-wrap:anywhere; }
.compact-form { display:grid; grid-template-columns:1fr 1fr auto; gap:10px; align-items:end; margin-top:20px; padding-top:18px; border-top:1px solid var(--border); }
.compact-form .field { margin:0; }
.danger-zone { margin-top:22px; padding:16px; border:1px solid #fecaca; border-radius:14px; background:#fffafa; }
.danger-zone summary { color:#b91c1c; cursor:pointer; font-weight:700; }

.calendar-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:14px; padding:12px 14px; }
.icon-btn.light { border:1px solid var(--border); color:#334155; background:#fff; }
.calendar-title { margin-left:5px; font-size:15px; }
.segmented { display:flex; padding:3px; border-radius:10px; background:#f1f5f9; }
.segmented a { padding:7px 13px; border-radius:8px; color:#64748b; font-size:12px; font-weight:700; }
.segmented a.active { color:#173a61; background:#fff; box-shadow:0 1px 5px rgba(15,23,42,.08); }
.calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(145px,1fr)); gap:10px; overflow-x:auto; }
.calendar-day { min-height:340px; border:1px solid var(--border); border-radius:14px; background:#fff; }
.calendar-day>header { display:flex; align-items:center; justify-content:space-between; padding:12px 13px; border-bottom:1px solid var(--border); color:#64748b; font-size:11px; text-transform:uppercase; }
.calendar-day>header strong { display:grid; width:28px; height:28px; place-items:center; border-radius:9px; color:#0f172a; font-size:13px; }
.calendar-day.is-today { border-color:#8eb7e9; box-shadow:0 0 0 2px rgba(59,130,246,.08); }
.calendar-day.is-today>header strong { color:#fff; background:var(--accent); }
.calendar-events { display:grid; gap:8px; padding:9px; }
.appointment-card { display:grid; gap:2px; padding:9px; border-left:3px solid #3b82f6; border-radius:8px; color:#1e3a5f; background:#eff6ff; font-size:11px; }
.appointment-card time { font-weight:800; }
.appointment-card strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.appointment-card span { color:#64748b; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.appointment-card.tone-success { border-color:#16a34a; background:#ecfdf3; }
.appointment-card.tone-warning { border-color:#d97706; background:#fff7ed; }
.appointment-card.tone-danger { border-color:#dc2626; background:#fef2f2; }
.empty-slot { padding:10px; border:1px dashed #cbd5e1; border-radius:8px; color:#94a3b8; font-size:11px; text-align:center; }
.calendar-month .calendar-day { min-height:150px; }
.calendar-month .appointment-card { padding:6px 7px; }
.calendar-day.is-outside { opacity:.42; }

.finance-heading { align-items:center; }
.date-filter { display:flex; align-items:flex-end; gap:10px; padding:12px; box-shadow:none; }
.date-filter .field { width:170px; margin:0; }
.date-filter-arrow { padding-bottom:12px; color:#94a3b8; }
.metric-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.metric-card { display:flex; align-items:flex-start; gap:13px; min-height:126px; padding:20px; border:1px solid var(--border); border-radius:16px; background:#fff; box-shadow:var(--shadow-card); }
.metric-icon,.round-icon { display:grid; width:42px; height:42px; place-items:center; flex:0 0 auto; border-radius:13px; color:#2563eb; background:#eff6ff; }
.metric-icon i,.round-icon i { display:block; font-size:19px; line-height:1; }
.metric-card small,.metric-card strong,.metric-card div>span { display:block; }
.metric-card small { margin-bottom:8px; color:#64748b; font-weight:700; }
.metric-card strong { font-size:22px; letter-spacing:-.03em; }
.metric-card div>span { margin-top:5px; color:#94a3b8; font-size:10px; }
.accent-red .metric-icon { color:#dc2626; background:#fef2f2; }.accent-amber .metric-icon { color:#d97706; background:#fff7ed; }.accent-green .metric-icon { color:#16a34a; background:#ecfdf3; }
.finance-main-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(320px,.75fr); gap:18px; margin-top:18px; align-items:start; }
.card-heading,.section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.card-heading { margin-bottom:20px; }.section-heading { margin:28px 0 12px; }
.card-heading .eyebrow { margin-bottom:3px; }
.payment-row { position:relative; margin-bottom:22px; }
.progress { height:7px; margin-top:8px; overflow:hidden; border-radius:99px; background:#edf2f7; }
.progress span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#3b82f6,#60a5fa); }
.payment-row>small { position:absolute; right:0; margin-top:3px; color:#94a3b8; }
.alert-info { border-color:#bfdbfe; color:#1e40af; background:#eff6ff; }
.toast-region { position:fixed; z-index:100; right:22px; bottom:22px; display:grid; gap:8px; }
.ui-toast { display:flex; align-items:center; gap:9px; padding:12px 15px; border-radius:11px; color:#fff; background:#16314f; box-shadow:0 15px 35px rgba(15,23,42,.2); animation:toast-in .2s ease; }
.ui-toast i { flex:0 0 auto; font-size:16px; line-height:1; }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } }

/* Work order detail */
.work-order-hero { display:flex; align-items:flex-start; justify-content:space-between; gap:22px; margin-bottom:24px; }
.work-order-hero h1 { margin-bottom:6px; }
.work-order-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:9px; }
.work-order-actions form { margin:0; }
.work-order-overview { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:18px; }
.info-card { min-height:170px; }
.info-card h2 { margin-bottom:14px; }
.info-card p { margin:8px 0; }
.work-order-section { margin-top:36px; }
.work-order-section-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:14px; }
.work-order-section-heading h2 { margin:0; }
.work-order-section-heading p { margin:5px 0 0; color:var(--text-soft); font-size:12px; }
.service-photos-card,.service-items-card { padding:24px; }
.service-photo-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,240px)); gap:16px; margin-bottom:20px; }
.service-photo-card { display:flex; min-width:0; flex-direction:column; gap:10px; padding:12px; border:1px solid var(--border); border-radius:14px; background:#fbfdff; }
.service-photo-card img { display:block; width:100%; height:150px; border-radius:10px; object-fit:cover; background:#f1f5f9; }
.service-photo-card small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.service-photo-actions { display:flex; align-items:center; flex-wrap:wrap; gap:7px; margin-top:auto; }
.service-photo-actions .btn { min-height:36px; padding:7px 10px; font-size:12px; }
.danger-text { color:#b91c1c!important; }
.danger-text:hover { background:#fef2f2!important; }
.service-items-card { overflow-x:auto; }
.service-items-card table { margin:0; }
.item-entry-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; margin-top:18px; }
.item-entry-card { border-top:3px solid #5b8fca; box-shadow:0 12px 28px rgba(15,23,42,.07); }
.item-entry-card h2 { margin-bottom:16px; }
.item-entry-card>.btn { margin-top:4px; }
.account-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(360px,1fr); gap:18px; align-items:stretch; }
.account-summary-card { padding:8px 24px 18px; }
.account-row { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:13px 0; border-bottom:1px solid #e7edf4; }
.account-row span { color:#475569; }
.account-row strong { white-space:nowrap; font-size:15px; }
.account-subtotal { border-bottom-color:#cbd5e1; }
.account-tax { margin:14px 0; color:var(--text-soft); font-size:12px; }
.account-grand { margin-top:4px; padding:18px 0; border-top:2px solid var(--primary); border-bottom:2px solid var(--primary); color:var(--primary); }
.account-grand span,.account-grand strong { color:inherit; font-size:20px; font-weight:800; }
.account-paid { margin-top:4px; }
.account-balance { border-bottom:0; }
.account-balance span,.account-balance strong { font-weight:800; }
.account-balance.has-balance { color:#b91c1c; }
.account-balance.is-paid { color:#15803d; }
.account-balance span { color:inherit; }
.work-order-inline-action { margin-top:16px; }
.status-history-card { min-height:100%; }
.status-timeline { position:relative; display:grid; gap:0; margin:0; padding:0; list-style:none; }
.status-timeline::before { content:''; position:absolute; top:21px; bottom:21px; left:18px; width:2px; background:#dbe7f4; }
.status-timeline-item { position:relative; display:grid; grid-template-columns:38px minmax(0,1fr); gap:14px; padding:0 0 22px; }
.status-timeline-item:last-child { padding-bottom:0; }
.status-timeline-number { position:relative; z-index:1; display:grid; width:38px; height:38px; place-items:center; border:4px solid #fff; border-radius:50%; color:#fff; background:var(--primary); box-shadow:0 0 0 1px #bfd1e5; font-size:12px; font-weight:800; }
.status-timeline-content { padding:6px 0 0; }
.status-timeline-content strong { display:block; font-size:14px; }
.status-timeline-content time { display:flex; align-items:center; gap:6px; margin-top:4px; color:var(--text-soft); font-size:11px; }
.status-timeline-content p { margin:7px 0 0; color:#475569; font-size:12px; }

/* Flatpickr, aligned with the WebMoto palette */
.flatpickr-calendar { z-index:90!important; border:1px solid #dbe4ef; border-radius:15px; font-family:"Manrope",sans-serif; background:#fff!important; box-shadow:0 18px 45px rgba(15,23,42,.16); overflow:hidden; }
.flatpickr-months { padding:7px 5px 2px; background:#f8fafc; }
.flatpickr-current-month {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  height:34px;
  padding-top:0;
  color:#1e293b;
  font-size:14px;
  font-weight:800;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
  width:auto;
  min-width:0;
  min-height:0;
  height:32px;
  margin:0;
  padding:0 6px;
  border:0;
  border-radius:8px;
  appearance:none;
  color:inherit;
  background:transparent;
  box-shadow:none;
  font:inherit;
  line-height:32px;
  cursor:pointer;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover,
.flatpickr-current-month .flatpickr-monthDropdown-months:focus {
  border:0;
  outline:0;
  background:#eef4fb;
  box-shadow:none;
}
.flatpickr-current-month .numInputWrapper {
  width:58px;
  height:32px;
}
.flatpickr-current-month input.cur-year {
  width:100%;
  min-height:0;
  height:32px;
  padding:0 6px;
  border:0;
  border-radius:8px;
  color:inherit;
  background:transparent;
  box-shadow:none;
  font:inherit;
  line-height:32px;
}
.flatpickr-current-month input.cur-year:focus {
  border:0;
  outline:0;
  background:#eef4fb;
  box-shadow:none;
}
.flatpickr-current-month .numInputWrapper span { display:none; }
.flatpickr-weekdays { background:#f8fafc; }.flatpickr-weekday { color:#64748b!important; font-size:10px; }
.flatpickr-day { border-radius:9px; font-weight:600; }.flatpickr-day.today { border-color:#93c5fd; }.flatpickr-day.selected,.flatpickr-day.selected:hover { border-color:#2563eb; background:#2563eb; }
.flatpickr-time { border-top:1px solid #e2e8f0; }.flatpickr-time input { font-weight:750; }

@media (max-width:1180px) { .metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.finance-heading{align-items:flex-start;flex-direction:column}.date-filter{width:100%}.calendar-grid{grid-template-columns:repeat(7,minmax(135px,1fr))} }
@media (max-width:900px) { .users-layout,.detail-grid,.finance-main-grid{grid-template-columns:1fr}.page-heading{align-items:flex-start;flex-direction:column}.calendar-toolbar{align-items:stretch;flex-direction:column}.calendar-toolbar>.row{justify-content:space-between} }
@media (max-width:680px) { .page-heading h1{font-size:28px}.form-grid.two{grid-template-columns:1fr}.span-2{grid-column:auto}.metric-grid{grid-template-columns:1fr}.date-filter{align-items:stretch;flex-direction:column}.date-filter .field{width:100%}.date-filter-arrow{display:none}.calendar-grid{grid-template-columns:1fr;overflow:visible}.calendar-day{min-height:auto}.calendar-month .calendar-day{min-height:auto}.compact-form{grid-template-columns:1fr}.users-layout{gap:14px} }
@media (max-width:680px) { .expense-edit-form{position:fixed;top:90px;right:16px;left:16px;width:auto;max-height:calc(100vh - 110px);grid-template-columns:1fr;overflow:auto}.expense-edit-form .span-2{grid-column:auto} }

@media (max-width: 1180px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .dashboard-panels { grid-template-columns: 1fr; }
    .topbar-date { display: none; }
}
@media (max-width: 900px) {
    .app-shell { display: block; }
    .app-main { min-height: 100vh; }
    .sidebar { transform: translateX(-102%); box-shadow: 18px 0 45px rgba(15,23,42,.25); transition: transform .22s ease; }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 40; border: 0; background: rgba(15,23,42,.42); backdrop-filter: blur(2px); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .menu-toggle { display: grid; flex: 0 0 auto; }
    .topbar { padding: 0 16px; }
    .global-search { width: min(100%, 430px); }
    .content-wrap { padding: 24px 18px 48px; }
    .service-layout { grid-template-columns: 1fr; }
    .item-entry-grid,.account-layout { grid-template-columns:1fr; }
}
@media (max-width: 680px) {
    .topbar { gap: 10px; }
    .topbar-actions .btn { width: 42px; padding: 0; font-size: 0; }
    .topbar-actions .btn span { font-size: 19px; }
    .global-search { flex: 1; }
    .content-wrap { padding: 20px 12px 40px; }
    .page-header { align-items: stretch; flex-direction: column; margin-bottom: 18px; }
    .page-actions .btn { flex: 1; }
    .work-order-hero { flex-direction:column; }
    .work-order-actions { width:100%; justify-content:stretch; }
    .work-order-actions .btn,.work-order-actions form { flex:1; }
    .work-order-actions form .btn { width:100%; }
    .work-order-section { margin-top:28px; }
    .service-photo-grid { grid-template-columns:1fr; }
    .service-photo-card img { height:190px; }
    .account-summary-card { padding:6px 16px 14px; }
    .account-grand span,.account-grand strong { font-size:17px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { min-height: 124px; padding: 15px; }
    .stat-value { font-size: 22px; }
    .card { padding: 16px; border-radius: 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .filter-bar input, .filter-bar select, .filter-bar .btn { width: 100%; max-width: none; }
    .form-actions { position: sticky; bottom: 0; z-index: 8; margin: 10px 0 0; padding: 12px 0 0; background: rgba(255,255,255,.96); box-shadow: 0 -8px 24px rgba(15,23,42,.07); }
    .form-actions .btn { flex: 1; }
    th, td { padding: 12px 10px; }
    .step { font-size: 0; }
    .step-number { margin-right: 0; }
    .login-shell { grid-template-columns: 1fr; min-height: auto; }
    .login-brand { min-height: 220px; padding: 34px 28px; }
    .login-brand h1 { font-size: 27px; }
    .login-logo { top: 26px; left: 28px; }
    .login-panel { padding: 34px 26px; }
}
@media (max-width: 420px) {
    .stat-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 112px; }
    .file-actions { flex-direction: column; }
    .file-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
