/* Экран заказа. Плотная вёрстка: менеджер работает при клиенте. */
:root {
  --ink: #292929; --stone: #666666; --stone-2: #C9C9C9; --stone-3: #E3E3E3;
  --paper: #F4F4F4; --white: #fff; --act: #404040; --act-2: #E8E8E8;
  --warn: #505050; --warn-2: #EEEEEE; --bad: #333333; --r: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: var(--white); border: 1px solid var(--stone-2);
  border-radius: var(--r); padding: 8px 10px; width: 100%; min-height: 38px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--act); border-color: var(--act); }
label { display: block; font-size: 12.5px; color: var(--stone); margin-bottom: 4px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--stone-3); }
h3 { font-size: 14px; margin: 16px 0 8px; }
a { color: var(--act); }
.muted, .hint { color: var(--stone); font-size: 12.5px; }
.err { color: var(--bad); font-size: 13px; }

.f { margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row > * { flex: 1; min-width: 0; }
.row .narrow { flex: 0 0 auto; width: auto; }

/* вход */
/* атрибут hidden слабее правил ниже, поэтому задаём его явно */
[hidden] { display: none !important; }
.login { min-height: 100vh; display: grid; place-items: center; }
.login .card { background: var(--white); border: 1px solid var(--stone-3);
  border-radius: 8px; padding: 24px; width: 320px; }

/* шапка */
header { background: var(--ink); color: #fff; padding: 10px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
header select { background: #3D3D3D; color: #fff; border-color: #666666;
  width: auto; min-height: 30px; padding: 3px 8px; }
.ctx { font-size: 13px; color: #C9C9C9; }
.ctx.user { margin-left: auto; }
.link { background: none; border: 0; color: #C9C9C9; cursor: pointer; text-decoration: underline; }
.tabs { display: flex; gap: 4px; }
.tab { background: transparent; border: 1px solid #666666; color: #ddd;
  border-radius: var(--r); padding: 6px 14px; cursor: pointer; }
.tab.on { background: #fff; color: var(--ink); border-color: #fff; }

/* колонки */
main { padding: 16px 20px; max-width: 1500px; margin: 0 auto; }
.pane { display: none; }
.pane.on { display: grid; grid-template-columns: 320px 1fr 320px; gap: 16px; }
.col { background: var(--white); border: 1px solid var(--stone-3); border-radius: 8px; padding: 16px; }
.col.wide { grid-column: 1 / -1; }
.col.sum { position: sticky; top: 16px; align-self: start; }
@media (max-width: 1200px) { .pane.on { grid-template-columns: 1fr 1fr; } .col.sum { grid-column: 1 / -1; position: static; } }
@media (max-width: 760px) { .pane.on { grid-template-columns: 1fr; } main { padding: 10px; } }

/* кнопки */
.btn { border: 0; border-radius: var(--r); padding: 11px; cursor: pointer;
  font-weight: 500; width: 100%; margin-top: 8px; }
.btn.primary { background: var(--act); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--stone-2); }
.btn.narrow { width: auto; padding: 10px 14px; margin: 0; }
.add { border: 1px dashed var(--stone-2); background: transparent; border-radius: var(--r);
  padding: 8px 12px; cursor: pointer; color: var(--act); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { border: 1px solid var(--stone-2); background: var(--white); border-radius: 20px;
  padding: 6px 12px; cursor: pointer; font-size: 14px; }
.toggle { display: flex; border: 1px solid var(--stone-2); border-radius: var(--r); overflow: hidden; }
.toggle button { flex: 1; border: 0; background: var(--white); padding: 8px; cursor: pointer; }
.toggle button.on { background: var(--ink); color: #fff; }
.del { border: 0; background: none; color: var(--stone); cursor: pointer; font-size: 18px; }

/* памятники в заказе */
.mtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--stone-3); margin-bottom: 12px; }
.mtabs button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--stone); }
.mtabs button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.mtabs .add { border: 0; }
.mtabs .rm { margin-left: auto; color: var(--bad); font-size: 13px; }

/* части и строки */
.part { display: grid; grid-template-columns: 88px 1fr 1.4fr .8fr 100px 26px;
  gap: 6px; align-items: center; margin-bottom: 6px; }
.part-head { display: grid; grid-template-columns: 88px 1fr 1.4fr .8fr 100px 26px;
  gap: 6px; font-size: 12px; color: var(--stone); margin-bottom: 4px; }
.part input, .part select { min-height: 34px; padding: 6px 8px; }
.part .pr { text-align: right; background: var(--paper); }
.part .pr.up { background: var(--act-2); border-color: var(--act); color: var(--act); }
.part .pr.down { background: var(--warn-2); border-color: var(--warn); color: var(--warn); }
.part.persons, .part-head.persons { grid-template-columns: 26px 1.1fr 1fr 1fr .9fr .9fr 26px; }
.part.decor { grid-template-columns: 1fr 110px 26px; }
.part-warn { font-size: 12.5px; margin: -2px 0 6px 94px; }
.part-warn.ok { color: var(--act); } .part-warn.warn { color: var(--warn); }
.prow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0; }
.prow .hint { flex: 1 1 200px; }

.lines { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.lines td { padding: 5px 4px; border-bottom: 1px solid var(--stone-3); vertical-align: middle; }
.lines td.n { width: 70px; } .lines td.p { width: 110px; text-align: right; }
.lines input { min-height: 32px; padding: 5px 8px; }
.lines input.unit { width: 70px; text-align: center; }

/* итоги */
.tot { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.tot.big { font-size: 20px; font-weight: 600; border-top: 1px solid var(--stone-3);
  margin-top: 6px; padding-top: 12px; }
.tot.up { color: var(--act); } .tot.down { color: var(--warn); }
.note { border-radius: var(--r); padding: 10px 12px; font-size: 13.5px;
  margin: 8px 0; background: var(--paper); }
.note.warn { background: var(--warn-2); border-left: 3px solid var(--warn); }
.spec { background: var(--paper); border-radius: var(--r); padding: 10px; font-size: 13.5px;
  margin-top: 8px; text-align: center; }
.spec .surname { font-weight: 600; letter-spacing: .04em; }
.spec .dates { color: var(--stone); }
.why { color: var(--stone); font-size: 12.5px; cursor: pointer;
  text-decoration: underline dotted; margin: 6px 0 0; }
.calc { background: var(--paper); border-radius: var(--r); padding: 8px 10px;
  font-size: 12.5px; margin-top: 6px; }
.doc-title { font-weight: 500; color: var(--ink); margin-top: 12px; }

/* быстрый режим благоустройства */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.quick button { border: 1px solid var(--stone-2); background: var(--white);
  border-radius: var(--r); padding: 12px 10px; cursor: pointer; text-align: left; line-height: 1.25; }
.quick button:hover { border-color: var(--act); }
.quick b { display: block; font-weight: 500; }
.quick span { font-size: 12px; color: var(--stone); }
.password-field { display: flex; align-items: stretch; gap: 6px; min-width: 0; }
.password-field input { min-width: 0; flex: 1; width: 100%; }
.password-toggle { flex: 0 0 auto; padding: 6px 10px; background: #f0f0f0; color: #333; border: 1px solid #bbb; border-radius: 5px; cursor: pointer; font: inherit; font-size: 12px; }
.password-toggle:focus-visible { outline: 2px solid #555; outline-offset: 2px; }
.password-hint { display: block; margin-top: 5px; font-size: 12px; color: #555; max-width: 320px; }
.quick-fence { grid-column: 1 / -1; border: 1px solid var(--stone-2); border-radius: 6px; padding: 12px; display: grid; gap: 8px; min-width: 0; }
.quick-fence select { width: 100%; min-width: 0; }
.fence-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.fence-actions label { display: grid; gap: 4px; }
.fence-actions input { width: 120px; }
.bsum { display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--stone-3); margin-top: 10px; padding-top: 12px; }
.bsum b { font-size: 22px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r); z-index: 10; }
#toast.save-confirmation { top: 100px; bottom: auto; z-index: 200; width: min(520px, calc(100vw - 32px)); box-sizing: border-box; padding: 20px 24px; background: #fff; color: #292929; border: 1px solid #aaa; border-left: 5px solid #327549; box-shadow: 0 8px 32px #0003; font-size: 16px; line-height: 1.6; white-space: pre-line; }

/* ---------------------------------------------------------------- отчёты */
.top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
       background: var(--ink, #292929); color: #fff; padding: 10px 20px; }
.top h1 { font-size: 18px; margin: 0; }
.top .back { color: #C9C9C9; text-decoration: none; margin-left: auto; font-size: 14px; }
.top .back:hover { color: #fff; }
.top .tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.top .tabs button { border: 0; background: transparent; color: #C9C9C9;
                    padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.top .tabs button:hover { background: #3D3D3D; color: #fff; }
.top .tabs button.on { background: #fff; color: var(--ink, #292929); }

.reports { max-width: 1200px; margin: 0 auto; padding: 18px 20px 60px; }
.reports h2 { font-size: 20px; margin: 0 0 4px; }
.reports h3 { font-size: 15px; margin: 22px 0 8px; }
.reports .note { color: #666666; font-size: 13.5px; margin: 0 0 14px; }
.reports .empty { color: #666666; padding: 20px 0; }

.filters { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.filters label { font-size: 12.5px; color: #666666; display: grid; gap: 4px; }
.filters select, .filters input { min-height: 36px; padding: 6px 8px;
  border: 1px solid #C9C9C9; border-radius: 6px; background: #fff; }

.summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.card-num { background: #fff; border: 1px solid #E3E3E3; border-radius: 8px;
            padding: 12px 16px; min-width: 150px; }
.card-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-label { font-size: 12.5px; color: #666666; margin-top: 2px; }

table.rep { width: 100%; border-collapse: collapse; background: #fff;
            border: 1px solid #E3E3E3; border-radius: 8px; overflow: hidden; font-size: 14px; }
table.rep th { text-align: left; font-weight: 500; font-size: 12.5px; color: #666666;
               padding: 10px 12px; border-bottom: 1px solid #E3E3E3; background: #F4F4F4; }
table.rep td { padding: 9px 12px; border-bottom: 1px solid #F0F0F0; }
table.rep tr:last-child td { border-bottom: 0; }
table.rep .num { text-align: right; font-variant-numeric: tabular-nums; }
table.rep tr.bad td { background: #E2E2E2; }
table.rep tr.warn td { background: #EEEEEE; }
table.rep .muted { color: #666666; font-size: 12.5px; }

.bars { display: grid; gap: 6px; margin-bottom: 18px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 120px; gap: 10px; align-items: center;
           font-size: 13.5px; }
.bar-label { color: #666666; }
.bar-track { background: #E3E3E3; border-radius: 4px; height: 16px; }
.bar-fill { display: block; height: 100%; background: #404040; border-radius: 4px; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .bar-row { grid-template-columns: 92px 1fr 90px; font-size: 12.5px; }
  table.rep { font-size: 13px; }
}

/* ---------------------------------------------------------------- сводка */
.btn-link { color: #C9C9C9; text-decoration: none; padding: 6px 10px;
            border-radius: 6px; font-size: 13.5px; }
.btn-link:hover { background: #3D3D3D; color: #fff; }
.btn-link.on { background: #fff; color: var(--ink, #292929); }

.dash-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 900px) {
  .dash-row, .dash-grid { grid-template-columns: 1fr; }
}

.dash-card, .dash-panel { background: #fff; border: 1px solid #E3E3E3;
                          border-radius: 8px; padding: 16px; }
.dash-panel.accent { border-color: #404040; }
.dash-panel.ok { background: #F5F5F5; }
.dash-title { font-size: 12.5px; color: #666666; text-transform: uppercase; letter-spacing: .04em; }
.dash-value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums;
              margin: 6px 0 2px; }
.dash-sub { font-size: 13.5px; }
.dash-note { font-size: 12.5px; color: #666666; margin-top: 8px; }
.dash-panel h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.badge { background: #333333; color: #fff; border-radius: 10px;
         padding: 1px 8px; font-size: 12px; font-weight: 500; }
.delta.up { color: #404040; font-weight: 500; }
.delta.down { color: #333333; font-weight: 500; }
.more { display: inline-block; margin-top: 10px; color: #404040;
        text-decoration: none; font-size: 13.5px; }
.more:hover { text-decoration: underline; }

.season { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-bottom: 6px; }
.season-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
              align-items: center; height: 100%; }
.season-bar { width: 100%; background: #C9C9C9; border-radius: 3px 3px 0 0; min-height: 2px; }
.season-col.on .season-bar { background: #404040; }
.season-label { font-size: 11px; color: #666666; margin-top: 4px; }
.season-col.on .season-label { color: #404040; font-weight: 500; }

/* ------------------------------------------------------------ справочники */
.row-actions { white-space: nowrap; }
.row-actions .link { background: none; border: 0; color: #404040; cursor: pointer;
                     font-size: 13px; padding: 2px 6px; }
.row-actions .link:hover { text-decoration: underline; }
table.rep input { min-height: 32px; padding: 4px 8px; border: 1px solid #C9C9C9;
                  border-radius: 5px; width: 100%; max-width: 150px; }
table.rep .num input { text-align: right; }
table.rep tr.history-row td { background: #F4F4F4; }
table.rep.inner { margin-top: 6px; max-width: 460px; border: 0; }
table.rep.inner th { background: transparent; }
.add-block { margin-top: 18px; background: #fff; border: 1px solid #E3E3E3;
             border-radius: 8px; padding: 12px 16px; }
.add-block summary { cursor: pointer; font-size: 14px; font-weight: 500; }
.add-block .filters { margin: 12px 0 0; align-items: end; }
.add-block .btn { width: auto; padding: 8px 16px; }
.toast.bad { background: #333333; }

/* -------------------------------------------------------- список заказов */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #F5F5F5; }
td.debt { color: #333333; font-weight: 500; }
.status { display: inline-block; font-size: 12.5px; padding: 1px 8px; border-radius: 10px;
          background: #E3E3E3; }
.status.signed, .status.in_production, .status.crew_in_progress { background: #E8E8E8; color: #404040; }
.status.ready_in_stock, .status.installed_pending, .status.supervisor_review { background: #EEEEEE; color: #505050; }
.status.refused, .status.cancelled, .status.frozen { background: #E2E2E2; color: #333333; }
.status.closed, .status.accepted, .status.done { background: #EFEFEF; color: #5C5C5C; }

.modal { position: fixed; inset: 0; background: rgba(41, 41, 41, .55);
         display: flex; align-items: flex-start; justify-content: center;
         padding: 40px 16px; z-index: 20; overflow: auto; }
.modal-box { background: #fff; border-radius: 10px; max-width: 760px; width: 100%;
             padding: 20px 24px; }
.modal-head { display: flex; align-items: center; justify-content: space-between;
              margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-head .link { background: none; border: 0; color: #404040; cursor: pointer; font-size: 14px; }
.card-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.card-actions .btn { width: auto; padding: 9px 16px; text-decoration: none; text-align: center; }
.note ul { margin: 6px 0 0 18px; padding: 0; }

/* --------------------------------------------------------------- наряды */
.tabs.sub { margin-bottom: 14px; gap: 6px; }
.tabs.sub button { border: 1px solid #E3E3E3; background: #fff; color: #5C5C5C;
                   padding: 7px 14px; border-radius: 16px; cursor: pointer; font-size: 13.5px; }
.tabs.sub button:hover { border-color: #C9C9C9; }
.tabs.sub button.on { background: #292929; border-color: #292929; color: #fff; }
.status.created { background: #EEEEEE; color: #505050; }
.status.taken, .status.assigned { background: #E8E8E8; color: #404040; }
.status.done { background: #292929; color: #fff; }
.status.rework { background: #E2E2E2; color: #333333; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.photos img { width: 150px; height: 112px; object-fit: cover; border-radius: 6px;
              border: 1px solid #E3E3E3; display: block; }
.photos a:hover img { border-color: #404040; }
table.rep tr.cancelled td { color: #666666; text-decoration: line-through; }
table.rep tr.cancelled .muted { text-decoration: none; }
#action_form .filters { margin-top: 12px; align-items: end; background: #F4F4F4;
                        padding: 12px; border-radius: 8px; }
#action_form .btn { width: auto; padding: 9px 16px; }
.adjust { background: #F4F4F4; border-radius: 8px; padding: 14px 16px; margin-top: 12px; }
.adjust h4 { margin: 14px 0 6px; font-size: 14px; }
.adjust .filters { background: none; padding: 0; margin: 0 0 6px; }
.adjust table.rep input { max-width: 90px; }
.adjust .inline { font-size: 13px; color: #5C5C5C; }
#adj_preview { align-self: center; margin: 0; }
.status.lead-new { background: #EEEEEE; color: #505050; }
.status.lead-in_work { background: #E8E8E8; color: #404040; }
.status.lead-converted { background: #404040; color: #fff; }
.status.lead-refused { background: #E2E2E2; color: #333333; }
tr.reason-row td { background: #F4F4F4; }
tr.reason-row .filters { margin: 0; align-items: end; }
tr.reason-row .btn { width: auto; padding: 8px 14px; }

/* Выбор ритуальных услуг и принадлежностей. */
.ritual-picker-blocks { display: grid; gap: 12px; margin-bottom: 18px; }
.ritual-picker { padding: 14px; background: var(--paper); border: 1px solid var(--stone-3); border-radius: 8px; min-width: 0; }
.ritual-picker h3 { margin: 0 0 12px; }
.ritual-picker .row { align-items: end; }
.ritual-picker .row .f { margin: 0; max-width: 110px; }
.ritual-picker .btn { margin: 0; }
@media (max-width: 480px) { .ritual-picker .row { flex-wrap: wrap; } .ritual-picker .row .btn { width: 100%; } }

.attachment-form { padding: 14px; background: var(--paper); border-radius: 8px; margin-bottom: 12px; }
.attachment-form label { margin-top: 8px; }
.attachment-form .btn { margin-top: 12px; width: auto; padding: 8px 14px; }

/* Единая серая палитра: состояния различаются также текстом и границами. */
input { accent-color: var(--act); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn.primary:hover { background: #292929; }
.quick button:hover, .btn.ghost:hover, .chip:hover { background: #F0F0F0; }
.err { font-weight: 600; }
.status.refused, .status.cancelled, .status.frozen, .status.rework, .status.lead-refused { border: 1px solid #777777; }

.calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px}.calendar-day{background:white;border:1px solid var(--stone-2);padding:8px;min-height:95px}.calendar-event{padding:8px 0;border-top:1px solid var(--stone-3);font-size:12px;overflow-wrap:anywhere}.calendar-event small{font-weight:600}.client-suggestions{font-size:12px}.client-suggestions .btn{font-size:12px;text-align:left}.modal-box{max-width:1000px}#recovery{margin-bottom:14px}#recovery button{margin:4px}@media(max-width:760px){.calendar-grid{grid-template-columns:1fr}.calendar-grid>b,.calendar-pad{display:none}.calendar-day{min-height:0}}

.direction-summary{margin:0 0 30px;padding-bottom:18px;border-bottom:2px solid #ccc}.direction-summary h2{margin-bottom:4px}.direction-summary .dash-sub{line-height:1.6}.page-toolbar #today{color:#555}
