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

:root {
  --bg: #16181c;
  --surface: #1e2126;
  --surface2: #252830;
  --border: #2d3038;
  --text: #e5e7eb;
  --text-muted: #9b9d9f;
  --accent: #ef6136;
  --accent-hover: #d4522a;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --status-pending: #6366f1;
  --status-received: #3b82f6;
  --status-diagnosed: #f59e0b;
  --status-awaiting_approval: #8b5cf6;
  --status-awaiting_parts: #ef4444;
  --status-in_progress: #14b8a6;
  --status-quality_check: #ec4899;
  --status-ready: #22c55e;
  --status-collected: #6b7280;
  --status-cancelled: #374151;
}

html { font-size: 14px; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ── */
.nav { background: #26282c; border-bottom: 1px solid var(--border); padding: 0 20px; display: flex; align-items: center; height: 52px; gap: 8px; position: sticky; top: 0; z-index: 100; }
.nav-logo { font-weight: 700; font-size: 15px; color: var(--text); margin-right: 12px; display: flex; align-items: center; gap: 8px; }
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-link { color: var(--text-muted); padding: 6px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; border: none; background: none; text-decoration: none; }
.nav-link:hover, .nav-link.active { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-user { font-size: 12px; color: var(--text-muted); }
.badge { background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; vertical-align: middle; }
.badge-blue { background: var(--status-received); }

/* ── Layout ── */
.page { padding: 20px; max-width: 1400px; margin: 0 auto; }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 700; }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.spacer { flex: 1; }

/* ── Cards / surfaces ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.card-title { font-weight: 600; font-size: 14px; margin-bottom: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: opacity 0.15s; }
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-ghost { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 5px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-icon { padding: 6px 8px; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-control { width: 100%; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 7px; padding: 9px 12px; font-size: 13px; }
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-section { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.form-section-title { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 12px; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }
.checkbox-item input { accent-color: var(--accent); width: 14px; height: 14px; }

/* ── Status badges ── */
.status-badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.status-pending_review { background: #312e81; color: #c7d2fe; }
.status-received { background: #1e3a5f; color: #93c5fd; }
.status-diagnosed { background: #451a03; color: #fcd34d; }
.status-awaiting_approval { background: #2e1065; color: #c4b5fd; }
.status-awaiting_parts { background: #450a0a; color: #fca5a5; }
.status-in_progress { background: #042f2e; color: #5eead4; }
.status-quality_check { background: #500724; color: #f9a8d4; }
.status-ready { background: #052e16; color: #86efac; }
.status-collected { background: #1f2937; color: #9ca3af; }
.status-cancelled { background: #1f2937; color: #6b7280; }

.priority-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.priority-low { background: #1f2937; color: #9ca3af; }
.priority-normal { background: #1e3a5f; color: #93c5fd; }
.priority-high { background: #451a03; color: #fcd34d; }
.priority-urgent { background: #450a0a; color: #fca5a5; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface2); }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }

/* ── Kanban ── */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.kanban-col { min-width: 220px; width: 220px; flex-shrink: 0; }
.kanban-col-header { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 10px; border-radius: 7px 7px 0 0; display: flex; justify-content: space-between; align-items: center; }
.kanban-col-body { background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 0 0 7px 7px; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.kanban-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; padding: 10px; cursor: pointer; transition: border-color 0.15s; }
.kanban-card:hover { border-color: var(--accent); }
.kanban-card-num { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 3px; }
.kanban-card-equip { font-size: 12px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-card-customer { font-size: 11px; color: var(--text-muted); }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.kanban-col-count { background: rgba(255,255,255,0.2); border-radius: 10px; padding: 1px 6px; font-size: 11px; font-weight: 700; }

/* ── Notes ── */
.note { padding: 10px 12px; border-left: 3px solid var(--border); background: var(--surface2); border-radius: 0 6px 6px 0; margin-bottom: 8px; }
.note.public { border-left-color: var(--success); }
.note-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.note-text { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ── Stats ── */
.stats-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; min-width: 100px; flex: 1; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-card.urgent { border-color: var(--danger); }

/* ── Search bar ── */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 180px; }

/* ── Misc ── */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-icon { font-size: 40px; margin-bottom: 10px; }
.tag { display: inline-block; background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; padding: 2px 7px; font-size: 11px; color: var(--text-muted); }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.mt-4 { margin-top: 16px; }
.error-msg { background: #450a0a; border: 1px solid var(--danger); border-radius: 7px; padding: 10px 12px; color: #fca5a5; font-size: 13px; margin-bottom: 12px; }
.success-msg { background: #052e16; border: 1px solid var(--success); border-radius: 7px; padding: 10px 12px; color: #86efac; font-size: 13px; margin-bottom: 12px; }

/* ── Status timeline ── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 12px; }
.timeline-dot { position: absolute; left: -21px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.timeline-label { font-size: 12px; font-weight: 600; }
.timeline-time { font-size: 11px; color: var(--text-muted); }

/* ── Two column layout ── */
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ── Public pages ── */
.public-header { background: #26282c; border-bottom: 1px solid var(--border); padding: 16px 20px; display: flex; align-items: center; gap: 12px; }
.public-logo { font-weight: 700; font-size: 16px; }
.public-logo span { color: var(--accent); }
