:root { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; color: #172533; background: #f5f8fb; font-synthesis: none; }
* { box-sizing: border-box; }
.hidden { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 244px; background: #ffffff; border-right: 1px solid #e7edf4; flex-shrink: 0; display: flex; flex-direction: column; position: sticky; height: 100vh; top: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 29px 21px; letter-spacing: -0.4px; }
.brand b { display: block; font-size: 18px; }
.brand small { display: block; color: #8a9bad; font-size: 11px; margin-top: 2px; letter-spacing: .5px; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: linear-gradient(135deg,#5ebdff,#267cce); box-shadow: 0 5px 14px #278dd03b; font-weight: 800; color: white; }
.brand-mark.big { width: 48px; height: 48px; font-size: 23px; margin-bottom: 10px; }
.sidebar nav { overflow: auto; padding: 0 12px; flex: 1; }
.nav-group { margin: 10px 11px 9px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.15px; color: #99a8b7; font-weight: 800; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 11px; border: 0; background: none; border-radius: 10px; text-align: left; color: #647586; font-size: 13px; margin-bottom: 4px; }
.nav-item .nav-icon { width: 17px; font-size: 16px; text-align: center; color: #8fa4b8; }
.nav-item:hover { background: #f4f9fd; color: #2e6c9e; }
.nav-item.active { background: #eaf5ff; color: #1475bd; font-weight: 700; }
.nav-item.active .nav-icon { color: #168ad9; }
.nav-item .soon { margin-left: auto; font-size: 9px; color: #9eaebc; }
.sidebar-bottom { border-top: 1px solid #edf1f5; color: #92a2b2; font-size: 11px; padding: 20px 22px; display: flex; gap: 10px; align-items: center; }
.live-dot { background: #48bd9a; width: 7px; height: 7px; border-radius: 50%; }
.main-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 104px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e9edf2; padding: 20px 37px; background: #ffffffc9; backdrop-filter: blur(14px); }
.topbar h1 { font-size: 23px; letter-spacing: -.7px; margin: 5px 0 0; }
.eyebrow { color: #95a7b9; font-size: 11px; letter-spacing: .65px; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.pill { color: #3e8aaf; background: #e7f7fd; border-radius: 20px; padding: 7px 12px; font-size: 11px; font-weight: 700; }
.icon-button { width: 36px; height: 36px; background: white; border: 1px solid #dfebf4; border-radius: 10px; color: #71849a; font-size: 17px; }
.content { padding: 32px 37px 56px; max-width: 1480px; width: 100%; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-heading h2 { font-size: 19px; margin: 0; letter-spacing: -.4px; }
.subtext, .hint { color: #8292a2; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 16px; margin-bottom: 22px; }
.card, .table-wrap { border: 1px solid #e4ecf4; background: white; border-radius: 15px; box-shadow: 0 3px 20px #23405b05; }
.card { padding: 22px 24px; }
.stat-label { color: #8698ab; font-size: 12px; }
.stat-value { font-weight: 750; font-size: 30px; margin: 12px 0 7px; letter-spacing: -1px; }
.stat-meta { color: #779bb4; font-size: 12px; }
.card h3 { font-size: 15px; margin: 0 0 13px; }
.card p { color: #708295; font-size: 13px; line-height: 1.65; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.primary { border: 0; color: white; font-weight: 600; background: #268bd5; border-radius: 9px; padding: 10px 16px; box-shadow: 0 3px 9px #288ad526; }
.primary:hover { background: #1479c9; }
.secondary { border: 1px solid #dce8f3; color: #2878ad; background: white; font-weight: 600; border-radius: 9px; padding: 9px 15px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
th { font-size: 11px; text-align: left; color: #91a2b3; font-weight: 600; background: #fbfdff; padding: 17px 18px; border-bottom: 1px solid #e7eef5; }
td { padding: 17px 18px; border-bottom: 1px solid #eef2f6; color: #506378; }
tr:last-child td { border-bottom: 0; }
.row-title { font-weight: 600; color: #22384b; }
.status { display: inline-block; color: #2c84bc; background: #eaf6ff; padding: 5px 9px; font-size: 11px; border-radius: 20px; }
.empty { color: #92a1ae; text-align: center; padding: 55px 25px; }
.empty .emoji { font-size: 27px; margin-bottom: 8px; }
.empty h3 { margin: 9px 0; color: #4d657c; font-size: 15px; }
.empty p { font-size: 13px; line-height: 1.6; }
.warning { padding: 12px 15px; border-radius: 10px; color: #86652c; background: #fffaee; font-size: 12px; margin-bottom: 16px; }
.footer { color: #a2b0bd; font-size: 10px; padding: 20px 37px; margin-top: auto; }
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 18px; background: #14293c75; backdrop-filter: blur(8px); z-index: 20; }
.overlay.hidden { display: none; }
.auth-box, .modal { max-width: 460px; width: 100%; padding: 29px; border: 1px solid #e4edf5; border-radius: 20px; background: white; box-shadow: 0 20px 70px #19354d30; }
.auth-box h2, .modal h2 { font-size: 20px; margin: 8px 0; }
.auth-box p { color: #74889b; font-size: 13px; line-height: 1.65; }
.auth-box form, .form-stack { display: flex; flex-direction: column; gap: 13px; margin: 24px 0 12px; }
input, select, textarea { width: 100%; padding: 11px 13px; border: 1px solid #dce7f0; background: #fbfdff; color: #183048; border-radius: 9px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: #64acdf; box-shadow: 0 0 0 3px #218ad412; }
label { display: block; color: #5c7288; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.error { color: #c24343; }
.small-note { font-size: 11px !important; }
.modal-heading { display: flex; justify-content: space-between; align-items: center; }
@media(max-width: 900px) { .sidebar { width: 64px; } .brand { padding: 20px 13px; } .brand div:last-child,.nav-group,.nav-item .title,.nav-item .soon,.sidebar-bottom { display: none; } .sidebar nav { padding: 0 7px; } .nav-item { justify-content: center; padding: 11px; } .nav-item .nav-icon { width: auto; } .topbar { padding: 20px; } .content { padding: 22px 19px; } .footer { padding: 16px 19px; } }
@media(max-width: 600px) { .stats, .grid-2 { grid-template-columns: 1fr; } .topbar h1 { font-size: 20px; } .pill { display: none; } .page-heading { flex-wrap: wrap; } }
.row-actions { display: flex; gap: 7px; align-items: center; }
.secondary.action { font-size: 11px; padding: 7px 10px; white-space: nowrap; }
button:disabled { opacity: .45; cursor: not-allowed; }
.audit { padding: 13px 0; border-top: 1px solid #e4edf5; border-bottom: 1px solid #e4edf5; }
.audit summary { cursor: pointer; color: #547d9e; font-size: 12px; font-weight: 700; }
.history { margin-top: 12px; max-height: 170px; overflow: auto; }
.history-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 12px; border-bottom: 1px solid #eef2f6; padding: 8px 0; }
.history-line time { color: #8a9bad; }
.modal { max-height: min(92vh, 860px); overflow-y: auto; }

.status-config-row {display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px 0;border-bottom:1px solid #edf1f5;}
.status-config-row:last-child{border:0;}
.status-config-row b{font-size:13px;}
.status-config-row p{margin:3px 0 0;font-size:11px;}
.checkbox-line{display:flex;align-items:center;gap:10px;padding:7px 0;font-size:13px;cursor:pointer;}
.checkbox-line input{width:auto;margin:0;}

/* Read-only order overview; fits both desktop and mobile. */
.modal:has(.order-card) { max-width: 760px; }
.order-card { display: flex; flex-direction: column; gap: 17px; font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.detail-field { min-width: 0; display: flex; flex-direction: column; gap: 5px; overflow-wrap: anywhere; }
.detail-field strong { color: #2a445b; line-height: 1.5; font-size: 13px; white-space: pre-wrap; }
.detail-section { border-top: 1px solid #e7edf5; padding-top: 17px; }
.detail-section h3 { margin: 0 0 14px; font-size: 14px; color: #24435b; }
.related-repairs { display: flex; flex-direction: column; gap: 8px; }
.related-repair { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #eef2f6; }
.related-repair strong { display: block; overflow-wrap: anywhere; }
@media(max-width:600px) { .detail-grid { grid-template-columns: 1fr; } .related-repair { align-items: flex-start; } }

/* Locally assigned technicians and work rows in order overview */
.service-actions { margin: 14px 0 0; }
.related-repair.voided { opacity: .55; }
.related-repair.voided strong { text-decoration: line-through; }

/* Isolated print sheet. Only selected draft is printed, never the CRM navigation. */
.warranty-print-document {display:none;}
@media print {
  @page {size:A4; margin:17mm;}
  body.warranty-print-active > :not(.warranty-print-document) {display:none!important;}
  body.warranty-print-active > .warranty-print-document {
    display:block!important; position:static!important; color:#111!important;
    background:#fff!important; font:12pt/1.5 Arial,sans-serif; width:100%;
  }
  .warranty-print-document h1 {font-size:18pt; margin:0 0 16px;}
  .warranty-print-document p {margin:9px 0; white-space:pre-wrap; overflow-wrap:anywhere;}
  .warranty-print-document .print-warning {font-weight:bold; font-size:10pt;}
  .warranty-print-document .print-grid {display:grid; grid-template-columns:1fr 1fr; gap:4px 20px;}
  .warranty-print-document .print-signatures {margin-top:46px;}
  .warranty-print-document .print-footer {margin-top:40px; font-size:9pt;}
}

/* Customer directory: readable live search without horizontal scrolling on phones. */
.customer-search-controls { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.customer-search-controls input { flex: 1 1 240px; min-width:0; }
.customer-search-controls button { flex:0 0 auto; }
.order-card .row-actions { flex-wrap:wrap; }

/* Staff-only photo gallery, friendly to iPhone and small desktop screens. */
.photo-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:12px;}
.photo-tile {padding:9px;border:1px solid #e0ebf4;border-radius:12px;background:#f8fbff;min-width:0;}
.photo-tile img {display:block;object-fit:contain;width:100%;height:165px;border-radius:8px;background:#eaf2f8;}
.photo-caption {font-size:12px;font-weight:600;margin-top:8px;overflow-wrap:anywhere;}
@media(max-width:600px){.photo-grid{grid-template-columns:repeat(2,minmax(0,1fr));}.photo-tile img{height:130px;}}

/* Camera-based barcode scan is opt-in, responsive, and local to the form. */
.device-scanner-panel:not(.hidden){border:1px solid #c3ddf0;background:#f4faff;border-radius:12px;padding:12px;margin-top:10px;}
.device-scan-video{display:block;width:100%;max-width:470px;max-height:290px;object-fit:cover;border-radius:10px;background:#e7f0f7;margin:8px 0;}
@media(max-width:600px){.device-scan-video{max-height:220px;}}
