:root {
  --bg0: #070b12;
  --bg1: #0b131e;
  --bg2: #121d2c;
  --bg3: #1a2839;
  --line: #22344a;
  --line2: #2f4a66;
  --txt: #e8f0f8;
  --mut: #8aa0b8;
  --acc: #33b1ff;
  --grn: #2fd483;
  --gold: #D4AF37;
  --red: #ff5b6b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100vh; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background:
    radial-gradient(1100px 520px at 85% -10%, rgba(51,177,255,.16), transparent 60%),
    radial-gradient(800px 460px at -10% 110%, rgba(47,212,131,.10), transparent 60%),
    linear-gradient(180deg, #0b1119 0%, #070d16 100%);
  color: var(--txt);
  background-attachment: fixed;
}
.hidden { display: none !important; }
.muted { color: var(--mut); }
.err { color: var(--red); margin-top: 8px; font-size: 14px; }

/* login */
#login-view { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-box {
  width: 100%; max-width: 360px;
  background: linear-gradient(180deg, rgba(20,30,44,.92), rgba(10,17,26,.92));
  border: 1px solid var(--line2); border-radius: 18px; padding: 28px 24px;
  box-shadow: 0 18px 50px rgba(0,0,0,.5), 0 0 0 1px rgba(51,177,255,.06), inset 0 1px 0 rgba(255,255,255,.04);
}
.login-box h1 { text-align: center; margin-bottom: 4px; }
.login-box p { text-align: center; margin-bottom: 18px; }
input, select, textarea {
  width: 100%; padding: 12px 13px; margin: 6px 0; border-radius: 10px;
  border: 1px solid var(--line2); background: rgba(8,14,22,.9); color: var(--txt);
  font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(51,177,255,.16); }
textarea { resize: vertical; }
button {
  padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line2);
  background: linear-gradient(180deg, var(--bg3), #141f2f); color: var(--txt);
  font-size: 15px; cursor: pointer; margin: 4px;
  transition: transform .08s, box-shadow .15s, filter .15s;
}
button:hover { filter: brightness(1.18); box-shadow: 0 4px 14px rgba(0,0,0,.4); }
button:active { transform: scale(.97); }
button.primary { background: linear-gradient(180deg, #2e97e8, #1f7fd4); border-color: #3aa8ff; color: #fff; }
button.green { background: linear-gradient(180deg, #2fae6a, #239a58); border-color: #38c77e; color: #fff; }
button:disabled { opacity: .5; cursor: default; filter: none; transform: none; box-shadow: none; }
#btn-login { width: 100%; margin-top: 8px; }

/* header */
header {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
  background: rgba(9,14,22,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
header h1 { font-size: 18px; }
.hdr-right { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.logo-img { height: 34px; width: auto; display: block; filter: drop-shadow(0 0 6px rgba(212,175,55,.35)); }
.logo-img-big { height: 64px; width: auto; }
.logo-big { text-align: center; margin-bottom: 8px; }
.brand-block { display: flex; align-items: center; gap: 10px; }
h1.brand { text-align: center; margin-bottom: 2px; font-size: 21px; color: var(--gold); text-shadow: 0 0 10px rgba(212,175,55,.45); }

/* tabs */
.tabs { display: flex; gap: 6px; padding: 12px 16px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab {
  white-space: nowrap; padding: 8px 14px; font-size: 13px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--mut);
}
.tab.active {
  background: linear-gradient(180deg, #2e97e8, #1f7fd4); border-color: #3aa8ff; color: #fff; font-weight: 600;
  box-shadow: 0 4px 16px rgba(51,177,255,.25);
}

/* list */
.list { padding: 12px 16px; max-width: 760px; margin: 0 auto; }
.card {
  background: linear-gradient(180deg, rgba(22,32,46,.85), rgba(12,19,29,.85));
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.03);
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.card:hover { border-color: var(--line2); transform: translateY(-1px); box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.card .title { font-weight: 600; font-size: 15px; }
.card .sub { color: var(--mut); font-size: 13px; margin-top: 3px; }
.card .right { text-align: right; flex-shrink: 0; }
.chip { font-size: 11px; padding: 3px 9px; border-radius: 12px; white-space: nowrap; border: 1px solid transparent; }
.chip-назначен { background: rgba(212,167,35,.18); color: #e8c14c; border-color: rgba(212,167,35,.4); }
.chip-выехал { background: rgba(51,177,255,.16); color: #66c8ff; border-color: rgba(51,177,255,.35); }
.chip-на_месте { background: rgba(150,120,255,.18); color: #b3a0ff; border-color: rgba(150,120,255,.4); }
.chip-готово { background: rgba(47,212,131,.15); color: #5fe6a6; border-color: rgba(47,212,131,.4); }
.chip-ext { background: rgba(140,60,210,.2); border-color: rgba(160,80,240,.45); color: #d4b3ff; font-weight: bold; }
.time { font-size: 12px; color: #8ea2b8; margin-top: 4px; }
.no-orders { color: var(--mut); text-align: center; padding: 40px 0; }

/* modal */
#modal { position: fixed; inset: 0; background: rgba(4,8,13,.72); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-box {
  background: linear-gradient(180deg, rgba(20,30,44,.97), rgba(10,17,26,.97));
  border: 1px solid var(--line2); border-radius: 16px; padding: 20px; width: 100%; max-width: 460px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.04);
}
.modal-box.wide { max-width: 780px; }
.modal-box h2 { font-size: 17px; margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* order detail */
.detail-row { display: flex; gap: 8px; margin: 6px 0; font-size: 14px; }
.detail-row b { width: 110px; color: #9db4cc; flex-shrink: 0; }
.detail-row span { overflow-wrap: anywhere; }
.statusflow { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.flowstep { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; font-size: 12px; }
.flowstep.done { border-color: rgba(47,212,131,.5); background: rgba(47,212,131,.08); }
.flowstep.now { border-color: var(--acc); background: rgba(51,177,255,.12); box-shadow: 0 0 12px rgba(51,177,255,.15); }
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photos img { width: 100px; height: 75px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.rep-card { flex-direction: column; align-items: stretch; }
.rep-card .photos img { width: 130px; height: 95px; cursor: zoom-in; }
.report-tools { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.report-tools .btn-sm { margin: 0; }
.list-field { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.btn-status { font-size: 16px; padding: 14px; width: 100%; }
.btn-sm { padding: 7px 9px; font-size: 12px; margin: 2px 0; width: 100%; white-space: nowrap; }
.btn-danger { background: #571b1b; border-color: #7a2828; }
.btn-sm.tg { background: linear-gradient(180deg, #1d3d66, #16304f); border-color: #2a5a9c; width: auto; padding: 7px 14px; }
.btn-sm.tg:disabled { opacity: .6; }
.btn-sm.tg.mark { background: linear-gradient(180deg, #1f6b43, #1a5938); border-color: #2f9e63; }
.btn-sm.tg.mark:disabled { background: #14361f; }
.btn-sm.cop { background: linear-gradient(180deg, #3a2d5e, #2d2349); border-color: #5a47a0; width: auto; padding: 7px 14px; }
label.chk { display: flex; align-items: center; gap: 8px; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg1); cursor: pointer; }
label.chk input { width: auto; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font-size: 13px; padding: 8px 11px; }
.chips button.sel { background: linear-gradient(180deg, #2fae6a, #239a58); border-color: #38c77e; color: #fff; }

#btn-voice { width: 46px; font-size: 18px; padding: 11px 0; flex-shrink: 0; margin-left: 6px; }
#btn-voice.rec { background: var(--red); border-color: #ff8090; animation: pulse 1.1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,91,107,.55); } 70% { box-shadow: 0 0 0 12px rgba(255,91,107,0); } 100% { box-shadow: 0 0 0 0 rgba(255,91,107,0); } }

/* notification badge */
#notif-badge {
  display: none; position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: linear-gradient(180deg, #c0392b, #a02a1f); color: #fff; padding: 7px 16px;
  border-radius: 20px; font-size: 13px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(160,42,31,.4), 0 2px 8px rgba(0,0,0,.5);
}
#notif-badge.show { display: block; animation: pulse 1.4s infinite; }

/* worker order prompt */
.brg-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.brg-chip {
  padding: 8px 12px; font-size: 13px; border-radius: 20px; background: var(--bg2); border: 1px solid var(--line2);
  color: var(--txt); cursor: pointer; line-height: 1.1;
}
.brg-chip.sel { background: linear-gradient(180deg, #1c5f86, #174c6b); border-color: var(--acc); color: #fff; }
.worker-status { margin-top: 12px; display: flex; gap: 8px; }
.worker-status button { flex: 1; font-size: 14px; padding: 12px; }

/* materials search widget */
#mat-search-box { position: relative; margin-bottom: 6px; }
#mat-search { font-size: 15px; }
.mat-sug {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 12; max-height: 260px; overflow-y: auto;
  background: #0c1522; border: 1px solid var(--line2); border-radius: 10px; margin-top: 2px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
}
.mat-sug button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  text-align: left; margin: 0; border: none; border-bottom: 1px solid var(--line);
  background: transparent; border-radius: 0; padding: 11px 12px; font-size: 14px;
}
.mat-sug button:last-child { border-bottom: none; }
.mat-sug button:active, .mat-sug button:focus { background: var(--bg3); }
.mat-sug small { color: var(--mut); font-size: 11px; white-space: nowrap; }
.mat-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.mat-row {
  display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px;
}
.mat-row .mat-name { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.mat-qty { display: flex; align-items: center; gap: 3px; }
.mat-qty button { width: 34px; height: 34px; padding: 0; margin: 0; font-size: 17px; border-radius: 8px; flex-shrink: 0; }
.mat-qty .m-n {
  width: 72px; height: 36px; padding: 6px; margin: 0; text-align: center;
  font-size: 15px; border-radius: 8px; border: 1px solid var(--line2); background: #081018;
}
.mat-qty .m-n:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(51,177,255,.15); }
.mat-row .m-del { width: 34px; height: 34px; padding: 0; margin: 0; font-size: 14px; border-radius: 8px; }
button.bell-on { border-color: var(--acc); color: var(--acc); }
.card.flash { outline: 2px solid var(--acc); outline-offset: 3px; animation: flash 1s ease-in-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px rgba(51,177,255,.45); } 100% { box-shadow: none; } }
.pushdiag { font-size: 11px; color: var(--muted3, #889); margin-right: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }


.price-top { margin-bottom: 8px; }
.price-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.price-tabs button { font-size: 12px; padding: 7px 11px; border-radius: 20px; background: var(--bg2); border: 1px solid var(--line); color: var(--mut); }
.price-tabs button.active { border-color: var(--acc); color: var(--acc); background: rgba(51,177,255,.1); }
.price-search { width: 100%; margin-bottom: 8px; }
.price-note { font-size: 12px; color: var(--mut); background: var(--bg2); border: 1px solid var(--line); padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; white-space: pre-line; }
.price-view { max-height: 58vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.price-cat { margin: 14px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--acc); font-weight: 700; }
.price-row { display: flex; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.price-name { flex: 1; min-width: 0; }
.price-name b { font-size: 13px; font-weight: 600; }
.price-name small { display: block; color: var(--mut); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.price-val { font-weight: 700; color: var(--acc); white-space: nowrap; font-size: 13px; }

.regl-head { margin-bottom: 8px; }
.regl-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; line-height: 1.35; }
.regl-meta { font-size: 12px; color: var(--mut); margin-bottom: 8px; }
.regl-view { max-height: 58vh; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 4px; }
.regl-sec { margin-bottom: 14px; }
.regl-sec-t { font-size: 14px; font-weight: 700; color: var(--acc); margin: 10px 0 6px; }
.regl-sub { font-size: 12.5px; font-weight: 600; margin: 8px 0 4px; }
.regl-item { font-size: 13px; line-height: 1.45; padding: 4px 0 4px 2px; border-bottom: 1px solid var(--line); }
.regl-item.ind { padding-left: 14px; color: #c6d2e0; }
.regl-empty { color: var(--mut); padding: 10px 0; }

.regl-item.warn, .regl-sub.warn { color: #ffb35c; border-left: 3px solid #ff8a3d; padding-left: 8px; }
