:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --green: #16a34a;
  --green-bg: #ecfdf3;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --violet: #7c3aed;
  --violet-bg: #f5f3ff;
  --teal: #0d9488;
  --teal-bg: #f0fdfa;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
}

#app { max-width: 1120px; margin: 0 auto; padding: 24px 16px 80px; }

/* ---------- Header ---------- */
header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-inner { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #8b5cf6); display: flex; align-items: center; justify-content: center; color: #fff; }
.brand-logo svg { width: 22px; height: 22px; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.02em; display: block; line-height: 1.1; }
.brand-tag { font-size: 11px; color: var(--muted); display: block; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-link { background: none; border: none; color: var(--muted); font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: all .15s; }
.nav-link:hover { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Landing ---------- */
.hero { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #9333ea 100%); color: #fff; border-radius: 20px; padding: 56px 40px; margin-top: 12px; }
.hero h1 { font-size: 38px; line-height: 1.15; margin: 0 0 14px; letter-spacing: -.03em; }
.hero p { max-width: 620px; font-size: 16px; opacity: .92; margin: 0 0 24px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-outline-light { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .5); color: #fff; }
.btn-outline-light:hover { background: rgba(255, 255, 255, .26); }

.how { margin-top: 40px; }
.how h2, .roles h2 { text-align: center; font-size: 26px; letter-spacing: -.02em; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 20px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.step h3 { margin: 0 0 6px; font-size: 16px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }

.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.role-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; cursor: pointer; }
.role-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.role-card h3 { margin: 0 0 8px; }
.role-card p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

/* ---------- Common ---------- */
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb16 { margin-bottom: 16px; }
.link { color: var(--brand); text-decoration: none; }
.link:hover { text-decoration: underline; }
.ok { color: var(--green); font-weight: 600; }
.right { text-align: right; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.section-title { font-weight: 700; font-size: 17px; margin: 26px 0 12px; letter-spacing: -.01em; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; background: var(--card); border: 1px solid var(--line); padding: 6px; border-radius: 12px; width: fit-content; }
.tab { border: none; background: none; padding: 9px 18px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.tab.active { background: var(--brand); color: #fff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 10px; padding: 10px 18px; font-size: 14px; font-weight: 700; cursor: pointer; transition: all .15s; font-family: inherit; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row-sm { display: flex; gap: 10px; }
.btn-link { background: none; border: none; color: var(--brand); font-weight: 600; font-size: 13px; cursor: pointer; padding: 0; font-family: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { background: none; border: none; color: var(--red); font-weight: 600; font-size: 13px; cursor: pointer; padding: 0; font-family: inherit; }
.btn-link-danger:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
.form-card { max-width: 780px; }
.field { margin-bottom: 14px; }
.lbl { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.req { color: var(--red); }
.input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
textarea.input { resize: vertical; }
.check-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; transition: all .15s; background: #fff; }
.check-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.check-card.small { padding: 8px 10px; }
.check-card input { accent-color: var(--brand); }
.check-card span { font-weight: 600; font-size: 13.5px; display: flex; flex-direction: column; }
.check-card small { color: var(--muted); font-weight: 400; }
.radio-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; }
.radio-card input { accent-color: var(--brand); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form .input { width: auto; flex: 1; min-width: 120px; }

/* ---------- Chips & badges ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 600; color: #374151; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st-new { background: var(--blue-bg); color: var(--blue); }
.st-accepted { background: var(--violet-bg); color: var(--violet); }
.st-onway { background: var(--amber-bg); color: var(--amber); }
.st-reached { background: var(--amber-bg); color: #ea580c; }
.st-repairing { background: var(--teal-bg); color: var(--teal); }
.st-completed { background: var(--green-bg); color: var(--green); }
.st-rejected { background: var(--red-bg); color: var(--red); }

.approve-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--green-bg); color: var(--green); border-radius: 999px; padding: 5px 13px; font-size: 13px; font-weight: 700; }

/* ---------- Job cards ---------- */
.job-card { display: flex; flex-direction: column; gap: 12px; }
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.job-no { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.job-device { font-size: 16px; }
.problem { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: #374151; font-size: 14px; }
.sub-block { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.sub-title { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.tech-card { display: flex; gap: 12px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), #8b5cf6); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.tech-name { font-weight: 700; }
.tech-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.eta-line { margin-top: 6px; }
.photo-wrap { margin-top: 4px; }
.job-photo { max-width: 240px; max-height: 200px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; display: block; }
.photo-preview { margin-top: 8px; position: relative; display: inline-block; }
.photo-preview img { max-width: 200px; border-radius: 10px; border: 1px solid var(--line); }
.photo-remove { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--red); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini-table td { padding: 5px 0; }
.total-row td { border-top: 1px solid var(--line); font-weight: 800; padding-top: 8px; }

.stars { color: #f59e0b; letter-spacing: 2px; font-size: 14px; }
.stars-empty { color: #e5e7eb; }
.review-text { color: #374151; font-style: italic; font-size: 14px; margin-top: 6px; }

.rate-widget { display: flex; flex-direction: column; gap: 8px; }
.star-picker { display: flex; gap: 4px; }
.star-btn { background: none; border: none; font-size: 26px; color: #e5e7eb; cursor: pointer; padding: 0 2px; line-height: 1; transition: color .1s; }
.star-btn.active { color: #f59e0b; }
.star-btn:hover { color: #fbbf24; }

.timeline-details { margin-top: 2px; }
.timeline-details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.timeline { padding-left: 8px; margin-top: 10px; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); margin-top: 4px; flex-shrink: 0; position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--brand-soft); }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.tl-body { font-size: 14px; }
.tl-time { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 40px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-icon { font-size: 26px; margin-bottom: 8px; color: var(--muted); }
.empty-title { font-weight: 700; }
.empty-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.accent { color: var(--brand); }

/* ---------- Login ---------- */
.login-wrap { display: flex; justify-content: center; padding-top: 40px; }
.login-card { max-width: 420px; width: 100%; padding: 28px; }
.login-card h2 { margin: 0 0 4px; }
.demo-creds { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }

/* ---------- Technician head ---------- */
.tech-head { align-items: center; }
.head-actions { display: flex; align-items: center; gap: 12px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input { display: none; }
.toggle-slider { width: 42px; height: 24px; border-radius: 999px; background: #d1d5db; position: relative; transition: background .15s; }
.toggle-slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::after { left: 20px; }
.toggle-label { font-size: 13px; font-weight: 700; }

/* ---------- Earnings ---------- */
.earn-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.earn-val { font-size: 20px; font-weight: 800; }
.review-item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.review-item:last-child { border-bottom: none; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table td .chip-row { margin-top: 4px; }

/* ---------- Admin layout ---------- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.admin-side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); position: sticky; top: 70px; }
.admin-side-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav-item { text-align: left; border: none; background: none; padding: 9px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; transition: all .12s; }
.admin-nav-item:hover { background: var(--bg); color: var(--ink); }
.admin-nav-item.active { background: var(--brand-soft); color: var(--brand-dark); }
.admin-main { min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.toolbar .input { width: 200px; }

/* ---------- Charts ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 18px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar { width: 100%; max-width: 44px; background: linear-gradient(180deg, #8b5cf6, var(--brand)); border-radius: 7px 7px 2px 2px; position: relative; min-height: 4px; }
.bar-val { font-size: 11px; color: var(--muted); font-weight: 700; }
.bar-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hbar-label { width: 90px; font-size: 13px; font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; height: 14px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.hbar { height: 100%; background: linear-gradient(90deg, var(--brand), #8b5cf6); border-radius: 999px; }
.hbar-val { width: 28px; font-weight: 700; font-size: 13px; }

.comm-wrap { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; animation: fadeIn .15s ease; }
.modal { background: var(--card); border-radius: 16px; max-width: 680px; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp .18s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 20px; }
.modal-img { max-width: 100%; border-radius: 10px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.pay-modal { text-align: center; }
.pay-amount { font-size: 28px; font-weight: 800; margin-bottom: 18px; }
.pay-methods { display: flex; flex-direction: column; gap: 8px; text-align: left; margin-bottom: 14px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: slideIn .2s ease; max-width: 340px; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--brand); }
.toast-hide { opacity: 0; transform: translateX(20px); transition: all .3s; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
  .roles { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .grid2 { grid-template-columns: 1fr; }
  .earn-sum { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 28px; }
  .hero { padding: 36px 24px; }
}
@media (max-width: 560px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; }
}
