:root {
  --navy: #1f3a5f; --navy-2: #2b4c78; --bg: #eef1f5; --card: #fff; --line: #d8dee6; --muted: #6b7684;
  --text: #17202b; --new: #1565c0; --work: #e65100; --done: #2e7d32; --noshow: #d50000;
  --off: #c62828; --off-bg: #eceff1; --green: #2e7d32; --radius: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.35 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg);
  -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* ---------- кнопки и поля */
.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; min-height: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: #f4f6f9; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { color: var(--noshow); border-color: #f1c4c4; }
.btn.red { color: var(--noshow); font-weight: 600; }
.btn.small { padding: 4px 10px; min-height: 32px; font-size: 14px; }
.btn.icon { padding: 6px 10px; min-width: 38px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=tel], input[type=search],
input:not([type]), select, textarea {
  border: 1px solid #c4ccd6; border-radius: 8px; padding: 7px 10px; min-height: 38px; background: #fff; width: 100%; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0ea; outline-offset: 0; border-color: #6d9fd6; }
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 8px 14px; min-height: 38px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--navy); color: #fff; font-weight: 600; }

/* ---------- шапка и вкладки */
.top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px;
  height: 52px; position: sticky; top: 0; z-index: 20; }
.top .logo { font-weight: 700; font-size: 17px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { background: none; border: 0; color: #c9d6e6; padding: 8px 14px; border-radius: 8px; }
.tabs button.on { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.top .user { font-size: 14px; color: #c9d6e6; white-space: nowrap; }
.top .user button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 7px; padding: 4px 10px; margin-left: 8px; }
.bottom-nav { display: none; }
main { padding: 14px 16px 90px; max-width: 1400px; margin: 0 auto; }

/* ---------- панель планировщика */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .grow { flex: 1; }
.toolbar select { width: auto; }
.toolbar input[type=date] { width: auto; }
.toolbar input[type=search] { width: 220px; }
.head2 { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin: 14px 0 8px; flex-wrap: wrap; }
.head2 h2 { margin: 0; font-size: 21px; }
.summary { color: var(--muted); font-size: 14px; }
.summary b { color: var(--text); }
.offbanner { background: var(--off-bg); color: var(--off); font-weight: 600; border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }

/* ---------- список записей */
.list { display: flex; flex-direction: column; gap: 6px; }
.dayhdr { display: flex; justify-content: space-between; align-items: center; background: #dde7f3; border-radius: 8px;
  padding: 7px 12px; font-weight: 700; margin-top: 8px; cursor: pointer; }
.dayhdr .cnt { font-weight: 400; color: var(--muted); font-size: 14px; }
.dayhdr.today { background: #fff3c4; }
.empty { color: #98a2ae; padding: 6px 12px; font-size: 14px; }
.offrow { background: var(--off-bg); color: var(--off); border-radius: 8px; padding: 6px 12px; font-weight: 600; font-size: 14px; }
.offrow small { font-weight: 400; color: #8a5a5a; }
.rec { background: var(--card); border-radius: var(--radius); border-left: 5px solid var(--new); padding: 9px 10px 9px 12px;
  display: grid; grid-template-columns: 58px 1fr auto auto auto; gap: 4px 12px; align-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.rec.st-1 { border-left-color: var(--work); }
.rec.st-2 { border-left-color: var(--done); }
.rec.noshow { border-left-color: var(--noshow); background: #fff6f6; }
.rec .t { font-weight: 700; font-size: 17px; }
.rec .main { min-width: 0; }
.rec .l1 { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.rec .car { font-weight: 700; color: var(--new); text-decoration: none; border-bottom: 1px dashed currentColor; cursor: pointer; }
.rec .plate { font-family: Consolas, monospace; background: #f1f3f6; border: 1px solid #d6dbe2; border-radius: 4px; padding: 0 5px; font-size: 14px; }
.rec .l2, .rec .l3 { color: #3c4652; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.rec .l3 { color: var(--muted); }
.rec .warn { color: var(--off); font-weight: 600; }
.rec.noshow .l1, .rec.noshow .l2, .rec.noshow .t { color: var(--noshow); }
.rec.noshow .car { color: var(--noshow); }
.rec .cost { font-weight: 700; white-space: nowrap; text-align: right; }
.badge { border: 0; border-radius: 20px; padding: 5px 12px; font-size: 13px; font-weight: 600; white-space: nowrap;
  background: #e3eefb; color: var(--new); }
.badge.st-1 { background: #fdebdc; color: var(--work); }
.badge.st-2 { background: #e2f2e3; color: var(--done); }
.badge.noshow { background: #ffe1e1; color: var(--noshow); }
.more { border: 0; background: none; font-size: 22px; line-height: 1; padding: 4px 8px; color: var(--muted); border-radius: 6px; }
.more:hover { background: #eef1f5; }

/* ---------- месяц */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #c9d3df; border: 1px solid #c9d3df; border-radius: 8px; overflow: hidden; }
.month .wd { background: #dde7f3; text-align: center; font-weight: 700; padding: 5px 0; font-size: 13px; }
.month .wd.we { color: var(--off); }
.cell { background: #fff; min-height: 104px; padding: 4px 5px; cursor: pointer; overflow: hidden; }
.cell.other { background: #f5f6f8; }
.cell.other .dn { color: #aab2bc; }
.cell.today { background: #fffbe0; }
.cell .dn { font-weight: 700; display: flex; justify-content: space-between; font-size: 14px; }
.cell .dn small { font-weight: 400; color: var(--muted); }
.cell.we .dn span { color: var(--off); }
.cell .e { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--new); }
.cell .e.st-1 { color: var(--work); } .cell .e.st-2 { color: var(--done); }
.cell .e.noshow { color: var(--noshow); font-weight: 700; }
.cell .o { font-size: 11.5px; background: var(--off-bg); color: var(--off); border-radius: 3px; padding: 0 3px; margin: 1px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .moreline { font-size: 12px; color: var(--new); text-decoration: underline; }
.cell .dots { display: none; }

/* ---------- панели, таблицы */
.panel { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-bottom: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 17px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #edf0f3; }
.tbl th { font-size: 13px; color: var(--muted); font-weight: 600; }
.tbl tr.past td { color: #a0a8b2; }
.t-Отпуск { color: var(--new); } .t-Больничный { color: var(--off); }
.hint { color: var(--muted); font-size: 13px; }
.offcard { background: #fff; border-radius: var(--radius); padding: 10px 12px; display: flex; gap: 10px; align-items: center;
  justify-content: space-between; box-shadow: 0 1px 2px rgba(0,0,0,.06); border-left: 5px solid #9aa4ae; }
.offcard .oc-d { color: var(--muted); font-size: 14px; }
.offcard .oc-btn { display: flex; gap: 6px; flex-shrink: 0; }
.offcard.past { opacity: .55; }
main { overflow-wrap: break-word; }

/* ---------- модальные окна */
.overlay { position: fixed; inset: 0; background: rgba(15,25,40,.45); z-index: 50; display: flex; align-items: flex-start;
  justify-content: center; padding: 30px 14px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal.wide { max-width: 1180px; }
.modal .mh { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #edf0f3; }
.modal .mh h3 { margin: 0; font-size: 18px; }
.modal .mh .x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); padding: 0 6px; }
.modal .mb { padding: 14px 16px; }
.modal .mf { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #edf0f3; flex-wrap: wrap; position: sticky; bottom: 0; background: #fff; border-radius: 0 0 12px 12px; }
.modal .mf .sp { flex: 1; }
.note-red { color: var(--off); font-size: 14px; margin: -4px 0 10px; }
.radios { display: flex; gap: 14px; flex-wrap: wrap; padding: 4px 0; }
.radios label { display: flex; align-items: center; gap: 6px; }

/* ---------- карточка авто */
.cardhead { background: #f3f6fa; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.cardhead .big { font-size: 20px; font-weight: 700; }
.cardhead .sub { color: #46515e; font-size: 14px; }
.cardhead a { color: var(--new); }
.cardrow { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cardrow select { width: auto; }
.chkline { display: flex; align-items: center; gap: 6px; color: var(--noshow); font-weight: 700; }
.chkline input { width: 18px; height: 18px; }
.sec { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.sec h4 { margin: 0 0 8px; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.sec h4 .sub { font-weight: 600; }
.cols { display: grid; grid-template-columns: 3fr 2fr; gap: 10px; }
.items { display: flex; flex-direction: column; gap: 5px; }
.item { display: grid; gap: 6px; align-items: center; grid-template-columns: 26px 1fr 110px 34px; }
.item.w { grid-template-columns: 40px 26px 1fr 140px 110px 34px; }
.item .n { color: var(--muted); text-align: center; font-size: 13px; }
.item input, .item select { min-height: 36px; padding: 5px 8px; }
.item .pr { text-align: right; }
.item.done input.nm { color: var(--green); font-weight: 600; }
.chk { width: 40px; height: 36px; border-radius: 8px; border: 2px solid #b8c2cc; background: #fff; font-size: 20px; color: transparent; font-weight: 700; }
.chk.on { border-color: var(--green); background: #e6f4e7; color: var(--green); }
.del { border: 0; background: none; color: #a0a8b2; font-size: 22px; border-radius: 6px; height: 36px; }
.del:hover { color: var(--noshow); background: #fff0f0; }
.additem { display: grid; gap: 6px; margin-top: 8px; grid-template-columns: 1fr 110px auto; }
.additem.w { grid-template-columns: 1fr 140px 110px auto; }
.secfoot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.progress { color: var(--green); font-size: 13.5px; font-weight: 600; }
.total { background: #e8f5e9; border-radius: 10px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.total .tb { color: #33691e; font-size: 14px; }
.total .tt { color: #1b5e20; font-size: 21px; font-weight: 800; }

/* ---------- меню */
.menu { position: fixed; z-index: 70; background: #fff; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.25); padding: 6px 0; min-width: 220px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 16px; font-size: 15px; }
.menu button:hover { background: #f1f4f8; }
.menu button.cur { font-weight: 700; }
.menu button.red { color: var(--noshow); font-weight: 600; }
.menu hr { border: 0; border-top: 1px solid #edf0f3; margin: 4px 0; }
.menu-back { position: fixed; inset: 0; z-index: 69; }

/* ---------- уведомления */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + var(--safe-b)); z-index: 90; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { background: #263445; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.25); max-width: 90vw; white-space: pre-line; }
.toast.err { background: #b71c1c; }

/* ---------- вход */
.login { max-width: 380px; margin: 9vh auto; background: #fff; border-radius: 14px; padding: 26px; box-shadow: 0 6px 30px rgba(0,0,0,.12); }
.login h1 { margin: 0 0 4px; font-size: 24px; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login .btn { width: 100%; margin-top: 6px; min-height: 44px; }
.login .err { color: var(--noshow); min-height: 20px; margin-top: 8px; white-space: pre-line; }

/* ---------- напоминание */
.remind { position: fixed; inset: 0; z-index: 100; background: #b71c1c; color: #fff; display: flex; flex-direction: column;
  align-items: center; padding: 3vh 4vw calc(3vh + var(--safe-b)); }
.remind h1 { font-size: clamp(30px, 6vw, 60px); margin: 0; text-align: center; }
.remind h2 { font-size: clamp(18px, 2.8vw, 30px); color: #ffecb3; margin: 4px 0 2vh; text-align: center; }
.remind .rl { background: #fff; color: #111; border-radius: 12px; width: 100%; max-width: 1300px; flex: 1; overflow-y: auto; }
.remind .ri { display: grid; grid-template-columns: 90px 1.3fr 1.2fr 1.5fr 1.2fr 1fr; gap: 10px; padding: 12px 18px;
  border-bottom: 1px solid #eee; font-size: clamp(16px, 1.6vw, 22px); align-items: center; }
.remind .ri.h { font-weight: 700; background: #f3f3f3; font-size: 15px; position: sticky; top: 0; }
.remind .ri a { color: #0d47a1; font-weight: 700; }
.remind .ri .nophone { color: var(--noshow); font-weight: 700; }
.remind .ok { margin-top: 2.5vh; font-size: clamp(26px, 4.5vw, 46px); font-weight: 800; padding: 12px 50px; border-radius: 14px;
  border: 4px solid #fff; background: #ffcdd2; color: #7f0000; min-width: 50%; }
.remind .ok.ready { background: #ffeb3b; color: #111; }

/* ---------- телефон */
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .top { height: 48px; padding: 0 12px; }
  .top .tabs { display: none; }
  .top .user .uname { display: none; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
    padding-bottom: var(--safe-b); }
  .bottom-nav button { flex: 1; border: 0; background: none; padding: 7px 0 8px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; }
  .bottom-nav button b { font-size: 21px; font-weight: 400; line-height: 1.1; }
  .bottom-nav button.on { color: var(--navy); font-weight: 700; }
  main { padding: 10px 10px calc(150px + var(--safe-b)); }
  .toolbar input[type=search] { width: 100%; order: 10; flex-basis: 100%; }
  .toolbar .seg { flex-basis: 100%; } .toolbar .seg button { flex: 1; }
  .toolbar .hide-m { display: none; }
  .toolbar { gap: 6px; }
  .toolbar .btn, .toolbar select { min-height: 38px; padding: 6px 9px; }
  .toolbar #mSel { flex: 1 1 auto; min-width: 0; }
  .toolbar #ySel { flex: 0 0 76px; }
  .head2 h2 { font-size: 18px; }
  .rec { grid-template-columns: 50px 1fr auto; }
  .rec .t { font-size: 16px; align-self: start; grid-column: 1; grid-row: 1 / 3; }
  .rec .main { grid-column: 2; grid-row: 1; }
  .rec .more { grid-column: 3; grid-row: 1; align-self: start; }
  .rec .badge { grid-column: 2; grid-row: 2; justify-self: start; }
  .rec .cost { grid-column: 3; grid-row: 2; }
  .fab { position: fixed; right: 16px; bottom: calc(72px + var(--safe-b)); z-index: 31; width: 58px; height: 58px; border-radius: 50%;
    border: 0; background: var(--navy); color: #fff; font-size: 32px; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
  .hide-fab-desktop { display: none; }
  .cell { min-height: 64px; padding: 3px; }
  .cell .e, .cell .o, .cell .moreline { display: none; }
  .cell .dn small { display: none; }
  .cell .dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 4px; }
  .cell .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--new); display: block; }
  .cell .dots i.st-1 { background: var(--work); } .cell .dots i.st-2 { background: var(--done); }
  .cell .dots i.noshow { background: var(--noshow); } .cell .dots i.off { background: #9aa4ae; border-radius: 2px; }
  .overlay { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; max-width: none; }
  .modal .mf { border-radius: 0; padding-bottom: calc(12px + var(--safe-b)); }
  .cols { grid-template-columns: 1fr; }
  .item.w { grid-template-columns: 40px 1fr 100px; grid-template-areas: "c nm nm" "c wk pr"; position: relative; padding-right: 32px; }
  .item.w .n { display: none; }
  .item.w .chk { grid-area: c; height: 78px; }
  .item.w .nm { grid-area: nm; } .item.w .wk { grid-area: wk; } .item.w .pr { grid-area: pr; }
  .item.w .del { position: absolute; right: -2px; top: 0; }
  .item:not(.w) { grid-template-columns: 1fr 96px 30px; } .item:not(.w) .n { display: none; }
  .additem, .additem.w { grid-template-columns: 1fr 1fr; }
  .additem input.nm { grid-column: 1 / -1; }
  .remind .ri { grid-template-columns: 70px 1fr; font-size: 17px; padding: 10px 12px; }
  .remind .ri.h { display: none; }
  .remind .ri > :nth-child(n+3) { grid-column: 2; }
  .remind .ok { min-width: 90%; }
  .tbl .hide-m { display: none; }
}
@media (min-width: 761px) { .fab { display: none; } }
@media print { .top, .bottom-nav, .toolbar, .fab { display: none; } }
