/* МОНТАЖ ПОРТАЛ — mobile-first, бордо акцент (#8E2433) */
:root {
  --bordo: #8E2433;
  --bordo-dark: #731C29;
  --bordo-light: #F7EBED;
  --bg: #F6F4F2;
  --panel: #FFFFFF;
  --border: #E5DFDA;
  --text: #241B1D;
  --muted: #7A6E70;
  --green: #16A34A;
  --red: #DC2626;
  --amber: #CA8A04;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; -webkit-font-smoothing: antialiased; }

.top { position: sticky; top: 0; z-index: 20; background: var(--bordo); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); }
.top-logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.top-user { display: flex; align-items: center; gap: 12px; font-size: 13px; opacity: .95; }
.top-out { color: #fff; text-decoration: none; font-size: 18px; padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,.14); }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 14px calc(30px + env(safe-area-inset-bottom)); }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.flash-success { background: #E8F7EE; color: #14652F; border: 1px solid #BFE8CD; }
.flash-error { background: #FDECEC; color: #9B1C1C; border: 1px solid #F5C6C6; }

.sec-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 18px 0 8px; }
.sec-title:first-child { margin-top: 0; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
a.card { display: block; text-decoration: none; color: var(--text); }
a.card:active { background: var(--bordo-light); }

.job-row { display: flex; align-items: center; gap: 12px; }
.job-time { font-weight: 800; font-size: 16px; color: var(--bordo); min-width: 52px; }
.job-main { flex: 1; min-width: 0; }
.job-client { font-weight: 700; font-size: 15px; }
.job-addr { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-date { font-size: 12px; color: var(--muted); margin-top: 2px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.type-chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.t-montaj { background: var(--bordo-light); color: var(--bordo); }
.t-dostavka { background: #EAF3FB; color: #1D4E7A; }
.t-napomnyane { background: #FEF6E0; color: #8A6202; }
.t-ogled { background: #F0EAFB; color: #5B21B6; }
.b-planned { background: #EEF2F8; color: #40546E; }
.b-in_progress { background: #FEF6E0; color: #8A6202; }
.b-done { background: #E8F7EE; color: #14652F; }
.b-cancelled { background: #FDECEC; color: #9B1C1C; }
.b-assigned { background: #FEF6E0; color: #8A6202; }
.b-filled { background: #E8F7EE; color: #14652F; }

.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 22px 10px; }

/* Детайл */
.detail-title { font-size: 20px; font-weight: 800; margin: 4px 0 2px; }
.detail-sub { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.act-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.act-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border-radius: 12px; text-decoration: none; font-weight: 700; font-size: 15px; border: none; cursor: pointer; }
.act-call { background: #E8F7EE; color: #14652F; }
.act-nav { background: #EAF3FB; color: #1D4E7A; }
.kv { margin-bottom: 8px; }
.kv .k { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.kv .v { font-size: 15px; margin-top: 2px; white-space: pre-wrap; }

.itemline { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; align-items: flex-start; }
.itemline:first-child { padding-top: 0; }
.itemline:last-child { border-bottom: none; padding-bottom: 0; }
.itemline .qty { font-weight: 800; color: var(--bordo); min-width: 36px; padding-top: 1px; }
.itemline .nm { flex: 1; min-width: 0; }
.it-title { font-weight: 700; font-size: 14.5px; }
.it-specs { font-size: 13px; color: var(--bordo); font-weight: 600; margin-top: 3px; }
.it-note { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }

/* Бутони */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 18px; border-radius: 12px; border: none; font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none; font-family: inherit; }
.btn-primary { background: var(--bordo); color: #fff; width: 100%; }
.btn-primary:active { background: var(--bordo-dark); }
.btn-secondary { background: var(--panel); color: var(--text); border: 1.5px solid var(--border); }
.btn-green { background: var(--green); color: #fff; width: 100%; }

/* Форми */
.fg { margin-bottom: 12px; }
.fg label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 5px; }
.fg input, .fg textarea, .fg select { width: 100%; padding: 13px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 16px; color: var(--text); background: #fff; outline: none; }
.fg input:focus, .fg textarea:focus { border-color: var(--bordo); box-shadow: 0 0 0 3px rgba(142,36,51,.12); }

/* Снимки */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; border: none; font-size: 13px; cursor: pointer; line-height: 1; }
.photo-add { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; padding: 14px; border: 2px dashed var(--border); border-radius: 12px; color: var(--muted); font-weight: 600; cursor: pointer; background: var(--panel); width: 100%; font-size: 15px; font-family: inherit; }
.photo-add:active { border-color: var(--bordo); color: var(--bordo); }
#photoStatus { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Редове размери (карта) */
.m-row { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.m-row-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.m-row-num { width: 26px; height: 26px; border-radius: 50%; background: var(--bordo); color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.m-room { flex: 1; }
.m-del { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--muted); font-size: 14px; }
.m-grp { margin-bottom: 10px; }
.m-grp-lbl { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.m-fields { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
.m-fields-2 { grid-template-columns: repeat(2, 1fr); }
.m-fields label { display: flex; flex-direction: column; gap: 3px; font-size: 10px; color: var(--muted); font-weight: 600; }
.m-inp { padding: 12px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 16px; color: var(--text); background: #fff; outline: none; width: 100%; }
.m-inp:focus { border-color: var(--bordo); }
.m-seg { display: flex; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.m-seg-btn { flex: 1; padding: 12px 6px; border: 0; border-right: 1px solid var(--border); background: transparent; cursor: pointer; font-family: inherit; font-size: 14px; color: var(--muted); }
.m-seg-btn:last-child { border-right: 0; }
.m-seg-btn.active { background: var(--bordo); color: #fff; font-weight: 700; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.login-box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; }
.login-logo { text-align: center; font-size: 34px; margin-bottom: 6px; }
.login-title { text-align: center; font-size: 19px; font-weight: 800; margin-bottom: 20px; }
