:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #65748b;
  --line: #d8dee8;
  --dark: #111827;
  --dark-2: #253144;
  --accent: #0f766e;
  --blue: #2563eb;
  --good: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --shadow: 0 18px 42px rgba(15, 23, 42, .08);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 282px 1fr; }
.sidebar { background: var(--dark); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; }
.brand-mark { width: 42px; height: 42px; border-radius: 8px; background: #0f766e; display: grid; place-items: center; font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand span { color: #cbd5e1; font-size: 13px; margin-top: 3px; }
.nav { display: grid; gap: 8px; }
.nav button { min-height: 43px; border: 0; border-radius: 8px; background: transparent; color: #cbd5e1; text-align: left; padding: 10px 12px; cursor: pointer; }
.nav button.active, .nav button:hover { background: var(--dark-2); color: #fff; }
.role-box { margin-top: auto; border: 1px solid #334155; border-radius: 8px; padding: 12px; }

main { padding: 28px; display: grid; align-content: start; gap: 20px; }
.page { display: grid; gap: 18px; }
.hidden { display: none !important; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 31px; line-height: 1.1; }
h2 { font-size: 19px; }
.muted { color: var(--muted); line-height: 1.5; }
.head-actions, .button-grid, .form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); border-radius: 8px; min-height: 40px; padding: 9px 12px; background: #fff; color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: #fff; border-color: #fecaca; color: var(--bad); }
.btn.danger:hover { background: #fef2f2; }
.btn.secondary:hover { border-color: #94a3b8; }

label { display: grid; gap: 7px; color: #334155; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; background: #fff; color: var(--ink); }
textarea { min-height: 96px; resize: vertical; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; }
.metrics article, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.metrics article { padding: 16px; display: grid; gap: 6px; }
.metrics span { color: var(--muted); font-size: 13px; }
.metrics strong { font-size: 29px; }
.split { display: grid; grid-template-columns: minmax(320px, 430px) 1fr; gap: 18px; }
.panel { padding: 18px; display: grid; gap: 16px; align-content: start; }
.panel-title { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.stack { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.item small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.item-actions { display: grid; justify-items: end; gap: 8px; }
.badge { border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; background: #e2e8f0; color: #334155; white-space: nowrap; }
.badge.confirmed, .badge.good { background: #dcfce7; color: var(--good); }
.badge.review, .badge.warn { background: #fef3c7; color: var(--warn); }
.badge.risk, .badge.bad { background: #fee2e2; color: var(--bad); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 700px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #475569; background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.mobile-grid { display: grid; grid-template-columns: minmax(300px, 390px) 1fr; gap: 18px; align-items: start; }
.phone { border: 10px solid #111827; border-radius: 28px; overflow: hidden; background: #f8fafc; box-shadow: 0 24px 55px rgba(15, 23, 42, .18); }
.phone-top { background: #111827; color: #fff; padding: 10px 14px 16px; display: flex; justify-content: space-between; font-size: 13px; }
.phone-body { padding: 16px; display: grid; gap: 13px; }
.proof-box { min-height: 104px; border: 1px dashed #94a3b8; border-radius: 8px; background: #f8fafc; display: grid; align-content: center; gap: 6px; padding: 14px; color: #475569; }
.proof-box strong { color: var(--ink); }
.camera { aspect-ratio: 4 / 3; border-radius: 8px; background: radial-gradient(circle at 50% 34%, #f3c7a4 0 14%, transparent 15%), radial-gradient(circle at 43% 31%, #172033 0 1.2%, transparent 1.5%), radial-gradient(circle at 57% 31%, #172033 0 1.2%, transparent 1.5%), linear-gradient(180deg, #cbd5e1, #94a3b8); display: grid; place-items: end center; padding: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.camera.done { outline: 3px solid #86efac; }
.camera span { background: rgba(15, 23, 42, .72); border-radius: 999px; padding: 6px 10px; font-size: 12px; }
.check-list { display: grid; gap: 10px; }
.check { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 11px; border: 1px solid var(--line); border-radius: 8px; }
.dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #e2e8f0; color: #475569; font-weight: 900; }
.check.done .dot { background: #dcfce7; color: var(--good); }
.notice { border-left: 4px solid var(--blue); background: #eff6ff; color: #1e3a8a; padding: 12px 14px; border-radius: 8px; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 12px; }
.form-grid.compact { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
.full-span { grid-column: 1 / -1; }
.coordinate-row { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 12px; }
.subhead { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding-top: 16px; }
.subhead h3 { margin: 0; font-size: 16px; }
.equipment-list, .stage-groups { display: grid; gap: 10px; }
.equipment-row { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(160px, .9fr) minmax(220px, 1.3fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.stage-group { display: grid; grid-template-columns: minmax(150px, .9fr) minmax(180px, 1.1fr) repeat(4, minmax(120px, .8fr)) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.team-create { border-color: #99f6e4; }
.search-card, .team-card { align-items: center; }
.search-card .btn, .team-card .btn, .site-card .btn, .equipment-row .btn, .stage-group .btn { white-space: nowrap; }
.team-card .btn, .search-card .btn, .work-type-card .btn, .warehouse-card .btn { min-height: 24px; padding: 3px 6px; border-radius: 6px; font-size: 11px; }
.site-card .btn { min-height: 24px; padding: 3px 6px; border-radius: 6px; font-size: 11px; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.compact-btn { min-height: 28px; padding: 4px 7px; border-radius: 6px; font-size: 12px; }
.schedule-filters { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.workdays { display: flex; flex-wrap: wrap; gap: 8px; }
.workdays label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.workdays input { width: auto; }
.address-field { position: relative; }
.address-suggestions { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 18px 42px rgba(15, 23, 42, .16); }
.address-suggestion { width: 100%; display: grid; gap: 3px; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 10px 12px; text-align: left; cursor: pointer; color: var(--ink); }
.address-suggestion:last-child { border-bottom: 0; }
.address-suggestion:hover, .address-suggestion:focus { background: #f8fafc; outline: none; }
.address-suggestion strong { font-size: 14px; }
.address-suggestion span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.address-status { display: block; margin-top: 6px; font-size: 12px; line-height: 1.35; }
.address-status.muted { color: var(--muted); }
.address-status.ok { color: #166534; }
.address-status.warn { color: #9a3412; }
.address-help { display: grid; gap: 4px; border-left: 4px solid var(--accent); background: #ecfdf5; border-radius: 8px; padding: 12px 14px; color: #14532d; }
.address-help span { color: #166534; line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips span { border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; background: #f8fafc; color: #475569; font-size: 12px; font-weight: 700; }
.item.rich { align-items: start; }
.map-board { position: relative; min-height: 360px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: radial-gradient(circle at 34% 38%, rgba(15,118,110,.13) 0 9%, transparent 10%), radial-gradient(circle at 66% 58%, rgba(37,99,235,.12) 0 11%, transparent 12%), linear-gradient(90deg, rgba(15,118,110,.08) 1px, transparent 1px), linear-gradient(rgba(37,99,235,.08) 1px, transparent 1px), #f8fafc; background-size: auto, auto, 42px 42px, 42px 42px; }
.yandex-map { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 360px; z-index: 1; }
.map-board .ymaps-2-1-79-map { width: 100% !important; height: 100% !important; }
.map-marker { position: absolute; transform: translate(-50%, -50%); min-width: 130px; max-width: 210px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; box-shadow: var(--shadow); font-size: 12px; }
.map-marker::before { content: ""; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; transform: translateX(-50%) rotate(45deg); background: inherit; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.map-marker strong, .map-marker span { display: block; position: relative; z-index: 1; }
.map-marker span { color: var(--muted); margin-top: 2px; line-height: 1.25; }
.map-marker.site { border-color: #99f6e4; }
.map-marker.installer { border-color: #bfdbfe; background: #eff6ff; }
.map-marker.violator { border-color: #fecaca; background: #fef2f2; }
.map-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.map-toggles label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; }
.map-toggles input { width: auto; }
.map-compass { position: absolute; top: 12px; left: 12px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: #0f766e; color: #fff; font-size: 12px; font-weight: 900; box-shadow: var(--shadow); }
.map-legend { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: #334155; font-size: 12px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.map-legend span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.site-dot { background: #0f766e; }
.installer-dot { background: #2563eb; }
.violator-dot { background: #dc2626; }
.map-empty { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; text-align: center; padding: 32px; color: var(--muted); }
.map-empty strong { color: var(--ink); font-size: 16px; }
.map-grid-label { position: absolute; z-index: 3; left: 12px; bottom: 12px; right: 12px; color: var(--muted); font-size: 12px; background: rgba(255,255,255,.86); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.mobile-card { display: grid; gap: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.mobile-card span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.policy { gap: 10px; }
.policy article { display: grid; gap: 5px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.policy span { color: var(--muted); line-height: 1.45; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; padding: 14px; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav button { text-align: center; padding: 9px 6px; font-size: 13px; }
  .role-box { display: none; }
  main { padding: 18px; }
  .page-head { display: grid; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .mobile-grid { grid-template-columns: 1fr; }
  .form-grid.compact, .coordinate-row, .equipment-row, .stage-group { grid-template-columns: 1fr; }
  .subhead { display: grid; }
}

@media (max-width: 560px) {
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics, .form-grid { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; }
  .panel-title { display: grid; }
}
