:root {
  --bg: #ffffff; --surface: #f6f7f9; --line: #e3e6eb; --text: #1a1f2b; --muted: #6b7382;
  --accent: #2563eb; --accent-soft: #e8efff;
  --ok: #157a3c; --ok-bg: #edf8f0; --ok-bar: #45b36b; --ok-pill: #d5f0de;
  --bad: #b42318; --bad-bg: #fff0ef; --bad-bar: #e4665d; --bad-pill: #fcdcd9;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.dim { color: var(--muted); }
.cur { white-space: nowrap; }
.spacer { flex: 1; }

/* кнопки */
.btn { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 8px; white-space: nowrap; }
.btn:hover { background: var(--surface); }
.btn.on { background: var(--accent-soft); border-color: #bcd0ff; color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #1d4fd0; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.icon { padding: 4px 9px; border-color: transparent; background: transparent; color: var(--muted); font-size: 17px; line-height: 1.2; }
.btn.icon:hover { background: rgba(0,0,0,.06); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }

/* шапка */
.top { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { font-weight: 700; font-size: 18px; margin-right: 6px; }
.month { display: flex; align-items: center; gap: 4px; }
.month .input { width: auto; padding: 6px 8px; }
.month .btn.icon { font-size: 24px; padding: 0 10px; }
.menu-wrap { position: relative; }
/* кнопка меню: рамка + три полоски */
.menu-btn { width: 42px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-color: #cfd4dc; }
.menu-btn .burger, .menu-btn .burger::before, .menu-btn .burger::after { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text); content: ''; position: relative; }
.menu-btn .burger::before { position: absolute; top: -6px; left: 0; }
.menu-btn .burger::after { position: absolute; top: 6px; left: 0; }
.menu { position: absolute; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.14); min-width: 190px; padding: 4px; z-index: 10; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 7px; }
.menu button:hover { background: var(--surface); }

/* вкладки: «таблетки», активная — яркая */
.tabs { display: flex; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 1px solid var(--line); background: #fff; padding: 7px 18px; border-radius: 999px; color: var(--muted); font-weight: 600; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; }
.tab:hover { background: var(--surface); color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(37, 99, 235, .35); }
.tab.active:hover { background: #1d4fd0; }

main { padding: 16px 20px 90px; max-width: 1180px; margin: 0 auto; }

/* полоса итогов */
.sum-bar { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.sb { padding: 9px 14px; background: var(--surface); }
.sb + .sb { border-left: 1px solid var(--line); }
.sb .t { display: block; font-size: 12px; color: var(--muted); }
.sb b { font-size: 17px; }
.sb.ok { background: var(--ok-bg); } .sb.ok b { color: var(--ok); }
.sb.bad { background: var(--bad-bg); } .sb.bad b { color: var(--bad); }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 19px; }
.toolbar .note { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 6px; }

/* раскладка: календарь слева, записи справа */
.split { display: block; }
.split.with-cal { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.split aside { position: sticky; top: 118px; }

/* календарь */
.cal { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: #fff; }
.cal-row { display: grid; grid-template-columns: 46px repeat(7, 1fr); gap: 2px; align-items: center; border-radius: 8px; padding: 1px 0; }
.cal-row.sel { background: var(--accent-soft); }
.cal-head { color: var(--muted); font-size: 11px; text-align: center; padding-bottom: 4px; }
.cal-w { border: 0; background: none; font-size: 11px; color: var(--muted); padding: 6px 2px; text-align: left; border-radius: 6px; white-space: nowrap; }
.cal-w:hover { background: var(--surface); color: var(--accent); }
.cal-c { border: 0; background: none; height: 34px; border-radius: 8px; text-align: center; padding: 0; position: relative; font-variant-numeric: tabular-nums; }
button.cal-c:hover { background: var(--surface); }
.cal-c.has { font-weight: 700; }
.cal-c.has.ok { background: var(--ok-bg); color: var(--ok); }
.cal-c.has.bad { background: var(--bad-bg); color: var(--bad); }
.cal-c.today { box-shadow: inset 0 0 0 1.5px var(--text); }
.cal-c.sel { background: var(--accent) !important; color: #fff !important; }
.cal-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); padding: 8px 4px 2px; }
.cal-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cal-legend i.ok { background: var(--ok-bar); } .cal-legend i.bad { background: var(--bad-bar); }

/* чипы недель */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 4px; scrollbar-width: thin; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 5px 11px; text-align: left; }
.chip:hover { background: var(--surface); }
.chip.active { border-color: var(--accent); background: var(--accent-soft); }
.chip .n { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; }
.chip .s { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* список записей */
.wk-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; margin: 16px 0 2px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.wk-head:first-child { margin-top: 4px; }
.day-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 4px 5px; }
.row-e { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 112px 118px 72px; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; margin-bottom: 5px; border-radius: 10px; border-left: 4px solid; }
.row-e.paid { background: var(--ok-bg); border-left-color: var(--ok-bar); }
.row-e.unpaid { background: var(--bad-bg); border-left-color: var(--bad-bar); }
.row-e:hover { filter: brightness(.98); }
.c-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.c-what { font-weight: 500; overflow-wrap: anywhere; }
.c-thumbs { display: flex; gap: 4px; }
.c-amt { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-status { text-align: center; }
.c-act { display: flex; justify-content: flex-end; }
.thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; border: 1px solid rgba(0,0,0,.12); cursor: zoom-in; background: #fff; display: block; }
.thumb:hover { border-color: var(--accent); }
.empty { padding: 34px 14px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; margin-top: 6px; }

.pill { border: 0; border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill.paid { color: var(--ok); background: var(--ok-pill); }
.pill.unpaid { color: var(--bad); background: var(--bad-pill); }
.pill:hover { filter: brightness(.94); }

/* таблицы (Итого) */
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.g { color: var(--ok); } td.r { color: var(--bad); }
tr.total-row td { font-weight: 700; background: var(--surface); }
a.wname { color: var(--accent); font-weight: 600; text-decoration: none; }
a.wname:hover { text-decoration: underline; }
a.cell { color: inherit; text-decoration: none; display: block; }
a.cell:hover { background: var(--accent-soft); border-radius: 6px; }

/* модальные окна */
.overlay { position: fixed; inset: 0; background: rgba(20, 25, 40, .5); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; z-index: 20; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 640px; }
.modal h3 { margin: 0 0 14px; font-size: 18px; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; }
.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { border: 0; background: #fff; padding: 9px 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }
.seg.paidseg button.on.p1 { background: var(--ok); } .seg.paidseg button.on.p0 { background: var(--bad); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 6px; }
.attach { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.att { position: relative; }
.att .thumb { width: 64px; height: 64px; }
.att .x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #1a1f2b; color: #fff; font-size: 12px; line-height: 22px; padding: 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.paste-zone-flash { outline: 2px dashed var(--accent); outline-offset: 3px; }

.wlist .wrow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.wlist h4 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); }

/* просмотр фото */
.lightbox { position: fixed; inset: 0; background: rgba(10, 12, 20, .92); z-index: 40; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 96vw; max-height: 88vh; border-radius: 6px; background: #fff; }
.lightbox .lb-btn { position: absolute; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 50%; width: 46px; height: 46px; font-size: 22px; }
.lightbox .lb-btn:hover { background: rgba(255,255,255,.3); }
.lb-close { top: 14px; right: 14px; } .lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb-count { position: absolute; bottom: 14px; color: #fff; font-size: 13px; }
.lb-open { position: absolute; bottom: 10px; right: 16px; font-size: 13px; }

/* плавающая кнопка (телефон) */
.fab { display: none; position: fixed; right: 18px; bottom: 18px; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 34px; line-height: 1; box-shadow: 0 6px 20px rgba(37,99,235,.45); z-index: 6; padding: 0 0 4px; }

/* тост */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: 94vw; }
.toast { background: #1a1f2b; color: #fff; padding: 10px 16px; border-radius: 10px; display: flex; gap: 14px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast button { background: none; border: 0; color: #8fb4ff; font-weight: 600; padding: 0; }

/* вход */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { width: 100%; max-width: 340px; border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.login h1 { margin: 0 0 18px; font-size: 22px; }

/* ===== телефон ===== */
@media (max-width: 760px) {
  .top { padding: 8px 10px; gap: 6px; }
  .brand { display: none; }
  .month { gap: 2px; }
  .month .input { padding: 6px 2px 6px 8px; font-size: 16px; }
  .month .btn.icon { padding: 0 7px; }
  .today-btn { padding: 6px 9px; font-size: 13px; }
  .tabs { padding: 6px 10px 0; }
  main { padding: 12px 10px 100px; }
  .deskonly { display: none; }
  .fab { display: block; }
  .sum-bar { grid-template-columns: 1fr 1fr 1fr; }
  .sb { padding: 7px 8px; } .sb b { font-size: 13px; display: block; line-height: 1.25; }
  .split.with-cal { display: block; }
  .split aside { position: static; margin-bottom: 12px; }
  .toolbar h2 { font-size: 17px; }

  /* запись = карточка */
  .row-e { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "what what amt" "time thumbs thumbs" "status status act"; gap: 6px 10px; padding: 10px 10px 8px 12px; }
  .c-what { grid-area: what; font-size: 16px; }
  .c-amt { grid-area: amt; font-size: 16px; }
  .c-time { grid-area: time; align-self: center; }
  .c-thumbs { grid-area: thumbs; flex-wrap: wrap; }
  .thumb { width: 44px; height: 44px; }
  .c-status { grid-area: status; text-align: left; }
  .c-act { grid-area: act; }
  .pill { padding: 6px 14px; font-size: 13.5px; }
  .btn.icon { padding: 6px 12px; font-size: 19px; }

  /* окна — снизу на весь экран */
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 96vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px 14px 20px; }
  .input, .seg button { font-size: 16px; }
  .wlist .wrow { grid-template-columns: 1fr; }
  .tbl-wrap table { font-size: 13px; }
  td, th { padding: 7px 8px; }
}
.cal-head .cal-c, .cal-head .cal-w { height: 18px; padding: 0; }

/* ===== пользователи, журнал, живые обновления ===== */
.online { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.online .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok-bar); box-shadow: 0 0 0 3px var(--ok-pill); }
.menu-head { padding: 8px 12px 6px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head b { color: var(--text); }
.c-time .by { display: block; font-size: 10px; color: var(--muted); opacity: .8; max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editing-badge { display: inline-block; font-size: 11px; font-weight: 600; color: #8a5a00; background: #fff3cd; border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
.row-e.flash { animation: flash 2.6s ease-out; }
@keyframes flash { 0%, 35% { box-shadow: 0 0 0 3px var(--accent), 0 0 18px rgba(37,99,235,.45); } 100% { box-shadow: 0 0 0 0 transparent; } }
.warn-box { background: #fff3cd; border: 1px solid #f0d98a; color: #6b4a00; border-radius: 8px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }

.tag { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 8px; background: var(--surface); color: var(--muted); vertical-align: 1px; }
.tag.ok { background: var(--ok-pill); color: var(--ok); } .tag.bad { background: var(--bad-pill); color: var(--bad); }
.ulist { display: flex; flex-direction: column; gap: 6px; }
.urow { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; }
.urow.off { opacity: .6; background: var(--surface); }
.uact { display: flex; gap: 6px; flex: none; }
.modal h4.sub { margin: 18px 0 8px; font-size: 13px; color: var(--muted); }
.add-user .input { flex: 1; min-width: 0; }

.modal.audit { max-width: 900px; }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.filters .input { padding: 7px 9px; font-size: 14px; }
.filters #a-q { grid-column: span 2; }
.loglist { max-height: 58vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.log-row { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.log-t { color: var(--muted); font-variant-numeric: tabular-nums; }
.who-chip { font-weight: 700; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 9px; }
.log-a { font-weight: 600; } .log-a.ok { color: var(--ok); } .log-a.bad { color: var(--bad); }
.log-link { margin-left: auto; color: var(--accent); text-decoration: none; font-weight: 600; }
.log-link:hover { text-decoration: underline; }
.log-s { font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .online { display: none; }
  .filters { grid-template-columns: 1fr 1fr; } .filters #a-q { grid-column: span 2; }
  .urow { flex-direction: column; align-items: stretch; } .uact { justify-content: flex-end; }
  .loglist { max-height: 62vh; }
  .add-user { flex-wrap: wrap; } .add-user .input { flex: 1 1 100%; }
}
.filt-toggle { display: none; margin-bottom: 8px; }
@media (max-width: 760px) {
  .filt-toggle { display: inline-block; }
  .filters:not(.open) { display: none; }
}
.other-months { margin-top: 12px; font-size: 13px; line-height: 2.2; }

/* ===== SKLADomer 2.0.8: бренд, «Сегодня», онлайн ===== */
.brand .ver { margin-left: 8px; font-size: 11px; font-weight: 700; letter-spacing: .03em; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; vertical-align: 2px; }
.login h1 .ver { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; vertical-align: 3px; margin-left: 6px; }
.btn.today-btn { color: var(--muted); background: #fff; }
.btn.today-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(37, 99, 235, .3); }
.online i, .online-foot i { font-style: normal; color: var(--muted); opacity: .8; }
.foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.online-foot { display: inline-flex; align-items: center; gap: 6px; }
.online-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok-bar); box-shadow: 0 0 0 3px var(--ok-pill); }
.menu-head { line-height: 1.6; }
@media (max-width: 760px) {
  .tabs { padding: 10px 10px; gap: 6px; }
  .tab { padding: 7px 15px; }
}
