:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #172033;
  --muted: #738097;
  --line: #e5eaf1;
  --primary: #2869ff;
  --primary-soft: #edf3ff;
  --green: #148a57;
  --green-soft: #e9f7f0;
  --blue: #2869ff;
  --blue-soft: #edf3ff;
  --yellow: #9a6a00;
  --yellow-soft: #fff7db;
  --orange: #c25100;
  --orange-soft: #fff0e3;
  --red: #c63232;
  --red-soft: #ffeded;
  --grey-soft: #eff2f5;
  --shadow: 0 10px 30px rgba(25, 39, 70, .08);
  --sidebar: #10182a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { background: var(--sidebar); color: #fff; padding: 28px 18px 20px; display: flex; flex-direction: column; justify-content: space-between; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; flex-direction: column; gap: 4px; padding: 0 10px 28px; }
.logo span { font-size: 26px; font-weight: 900; letter-spacing: .5px; }
.logo small { color: #98a5bd; }
nav { display: grid; gap: 7px; }
.nav-item { border: 0; background: transparent; color: #aeb9cb; text-align: left; padding: 12px 13px; border-radius: 10px; font-weight: 650; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.09); color: #fff; }
.sidebar-bottom { display: grid; gap: 12px; }
.connection { display: flex; align-items: center; gap: 8px; color: #aeb9cb; font-size: 13px; padding: 0 8px; }
.connection span:first-child { width: 8px; height: 8px; border-radius: 50%; background: #758097; }
.connection.online span:first-child { background: #2ed68c; box-shadow: 0 0 0 4px rgba(46,214,140,.12); }
.main { padding: 30px 34px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
h1, h2, h3, p { margin-top: 0; }
.topbar h1 { margin-bottom: 4px; font-size: 27px; }
.top-actions { display: flex; gap: 10px; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 10px; padding: 10px 14px; font-weight: 700; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; }
.sidebar .btn.ghost { color: #c5cede; border-color: rgba(255,255,255,.15); }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.summary-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; box-shadow: 0 4px 15px rgba(25,39,70,.035); }
.summary-card .value { font-size: 28px; font-weight: 850; margin-bottom: 5px; }
.summary-card .label { color: var(--muted); font-size: 13px; line-height: 1.25; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 20px 14px; }
.panel-head h2 { margin-bottom: 3px; font-size: 19px; }
.panel-head p { margin-bottom: 0; font-size: 13px; }
.filters { display: flex; gap: 9px; }
.filters input, .filters select, .auth-card input, .form-grid input, .form-grid select, .form-grid textarea { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 10px 11px; outline: none; }
.filters input { width: 270px; }
input:focus, select:focus, textarea:focus { border-color: #8bb0ff; box-shadow: 0 0 0 3px rgba(40,105,255,.10); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .045em; font-weight: 750; background: #fafbfc; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 11px 14px; }
td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #f8faff; }
tbody tr[data-order] { cursor: pointer; }
.order-number { font-weight: 800; color: #1d4fc2; margin-bottom: 4px; }
.sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.status-pill { display: inline-flex; gap: 6px; align-items: center; border-radius: 999px; padding: 6px 9px; font-weight: 750; font-size: 11px; white-space: nowrap; }
.status-pill.normal { background: var(--green-soft); color: var(--green); }
.status-pill.transit { background: var(--blue-soft); color: var(--blue); }
.status-pill.warning { background: var(--yellow-soft); color: var(--yellow); }
.status-pill.overtime { background: var(--orange-soft); color: var(--orange); }
.status-pill.problem { background: var(--red-soft); color: var(--red); }
.status-pill.completed, .status-pill.inactive { background: var(--grey-soft); color: #677286; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; }
.timer.overtime { color: var(--orange); }
.empty-state { padding: 42px; text-align: center; color: var(--muted); }
.auth-overlay { position: fixed; inset: 0; z-index: 50; background: #0e1628; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(400px, 100%); background: white; padding: 30px; border-radius: 18px; box-shadow: 0 30px 70px rgba(0,0,0,.32); }
.brand-mark { color: var(--primary); font-weight: 950; font-size: 25px; margin-bottom: 18px; }
.auth-card h1 { margin-bottom: 8px; }
.auth-card p { color: var(--muted); line-height: 1.5; }
.auth-card input { width: 100%; margin: 8px 0 12px; }
.error-text { color: var(--red); font-size: 13px; padding-top: 8px; min-height: 18px; }
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(8,16,32,.35); z-index: 20; backdrop-filter: blur(2px); }
.drawer { position: fixed; z-index: 30; right: 0; top: 0; width: min(690px, 94vw); height: 100vh; background: #fff; box-shadow: -20px 0 60px rgba(25,39,70,.18); transform: translateX(102%); transition: transform .22s ease; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head, .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 21px 23px; border-bottom: 1px solid var(--line); }
.drawer-head h2, .modal-head h2 { margin: 3px 0 0; }
.eyebrow { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.icon-btn { border: 0; background: var(--grey-soft); border-radius: 9px; width: 36px; height: 36px; font-weight: 800; }
.drawer-content { padding: 22px 23px 60px; overflow-y: auto; }
.detail-hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 12px; margin-bottom: 18px; }
.detail-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.detail-card h3 { font-size: 13px; margin-bottom: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv { display: grid; grid-template-columns: 135px 1fr; gap: 7px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.tabs { display: flex; gap: 5px; border-bottom: 1px solid var(--line); margin: 18px 0 14px; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 10px 11px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--primary); border-color: var(--primary); }
.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 112px 15px 1fr; gap: 10px; min-height: 54px; }
.timeline-time { color: var(--muted); font-size: 12px; padding-top: 3px; }
.timeline-mark { position: relative; }
.timeline-mark::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.timeline-mark::after { content: ''; position: absolute; left: 2px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.timeline-body { padding-bottom: 14px; }
.timeline-title { font-weight: 750; font-size: 13px; }
.phase-grid { display: grid; gap: 10px; }
.phase-card { border: 1px solid var(--line); border-radius: 11px; padding: 13px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.phase-card.overtime { border-color: #ffc18f; background: #fffaf5; }
.phase-title { font-weight: 800; }
.phase-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.incident { border: 1px solid #ffd1d1; background: #fff7f7; border-radius: 11px; padding: 12px; margin-bottom: 9px; }
.incident.resolved { background: #f7f9fb; border-color: var(--line); }
.attachment-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.attachment { border: 1px solid var(--line); border-radius: 10px; padding: 11px; text-decoration: none; color: inherit; }
.attachment:hover { border-color: #a9c2fa; background: #f8faff; }
.modal-backdrop { display: grid; place-items: start center; padding: 5vh 18px; overflow-y: auto; }
.modal { background: white; width: min(760px, 100%); border-radius: 16px; box-shadow: 0 25px 70px rgba(0,0,0,.20); overflow: hidden; }
.form-grid { padding: 20px 23px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid textarea { resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 23px 22px; border-top: 1px solid var(--line); }
.modal .error-text { padding: 0 23px; }
@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .app-shell { grid-template-columns: 200px 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { height: auto; position: static; padding: 14px; }
  .sidebar nav { grid-template-columns: repeat(2,1fr); }
  .sidebar-bottom, .logo small { display: none; }
  .logo { padding: 3px 8px 12px; }
  .main { padding: 18px 12px 40px; }
  .topbar, .panel-head { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; flex-direction: column; }
  .filters input, .filters select { width: 100%; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.wide { grid-column: auto; }
  .detail-hero { grid-template-columns: 1fr; }
  .attachment-list { grid-template-columns: 1fr; }
}
.detail-actions { display:flex; gap:8px; flex-wrap:wrap; margin: -4px 0 12px; }
.time-summary { display:flex; justify-content:space-between; align-items:center; gap:12px; border:1px solid var(--line); background:#fafbfc; border-radius:11px; padding:12px 13px; margin-bottom:10px; }
.phase-card { grid-template-columns: 1fr minmax(260px, .9fr) 150px; align-items:center; }
.phase-main .timer { margin-top:7px; }
.tariff-editor { display:grid; grid-template-columns: repeat(3, 1fr); gap:7px; align-items:end; }
.tariff-editor label { display:grid; gap:4px; color:var(--muted); font-size:10px; font-weight:700; }
.tariff-editor input { width:100%; border:1px solid var(--line); border-radius:8px; padding:8px; min-width:0; }
.tariff-editor .btn { grid-column:1 / -1; padding:8px; }
.billing-box { text-align:right; display:grid; gap:3px; }
.billing-box span,.billing-box small { color:var(--muted); font-size:10px; }
.billing-box strong { font-size:16px; }
.doc-checklist { display:grid; gap:7px; margin-bottom:13px; }
.doc-check { border:1px solid var(--line); border-radius:9px; padding:10px 11px; display:flex; justify-content:space-between; gap:12px; font-size:12px; }
.doc-check.ok { background:var(--green-soft); border-color:#c7ead8; }
.doc-check.missing { background:var(--red-soft); border-color:#f1caca; }
@media (max-width: 900px) { .phase-card { grid-template-columns:1fr; } .billing-box { text-align:left; } }
@media (max-width: 560px) { .tariff-editor { grid-template-columns:1fr; } .time-summary { align-items:flex-start; flex-direction:column; } }
.doc-check.pending { background:#fafbfc; color:var(--muted); }
.service-login { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); font-size: 12px; }
.service-login summary { cursor: pointer; margin-bottom: 8px; font-weight: 700; }
.service-login input { margin: 5px 0 8px; }
.operator-info { padding: 0 8px; display: grid; gap: 2px; }
.operator-info strong { font-size: 13px; }
.operator-info small { color: #98a5bd; font-size: 11px; }
.compact-modal { width: min(620px, 100%); }
@media (max-width: 760px) { .top-actions { flex-wrap: wrap; } }
