/* ТК «Мой город» — CRM. Рассчитано на Chrome 109 / Firefox 115 (Windows 7): без :has, вложенности и color-mix. */
:root {
  --brand: #13614d;
  --brand-dark: #0d4638;
  --brand-deep: #0a2f26;
  --brand-soft: #e7f2ee;
  --accent: #f7bc13;
  --accent-soft: #fff6d6;
  --bg: #f2f4f6;
  --panel: #ffffff;
  --line: #e2e6ea;
  --line-strong: #cfd5db;
  --text: #1f2429;
  --muted: #6b737c;
  --faint: #9aa2aa;
  --danger: #c9372c;
  --danger-soft: #fdecea;
  --warn: #b7791f;
  --warn-soft: #fff4e0;
  --ok: #1f8a4c;
  --ok-soft: #e6f5ec;
  --info: #2764c5;
  --info-soft: #e8f0fc;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 1px 1px rgba(20, 30, 40, .04);
  --shadow-lg: 0 10px 30px rgba(20, 30, 40, .18);
  --sidebar: 232px;
  --font: "Segoe UI", Tahoma, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: Consolas, "Courier New", monospace; }
.hidden { display: none !important; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -4px; }
.ic.sm { width: 15px; height: 15px; vertical-align: -3px; }

/* ---------- каркас ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; background: var(--brand-deep); color: #cfe3dc;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto;
}
.brand-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo:hover { text-decoration: none; }
.brand-logo img { width: 128px; height: auto; display: block; }
.brand-logo span, .login-logo span { font-size: 11px; font-weight: 600; letter-spacing: 3px; color: #8fb8aa; }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 22px; }
.login-logo img { width: 150px; height: auto; display: block; }
.login-logo span { color: var(--muted); }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-group { margin: 14px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #6f9a8c; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: #cfe3dc;
  margin-bottom: 1px;
}
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav .count {
  margin-left: auto; background: var(--accent); color: #3b2c00; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 0 7px; line-height: 18px;
}
.sidebar-foot { padding: 12px 18px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #8fb8aa; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.search { position: relative; flex: 1 1 360px; max-width: 520px; }
.search .ic { position: absolute; left: 11px; top: 10px; color: var(--faint); }
.search input { padding-left: 36px; background: var(--bg); border-color: transparent; }
.search input:focus { background: #fff; }
.topbar .spacer { flex: 1 1 0; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--text); }
.user-chip:hover { text-decoration: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.user-chip .who { line-height: 1.15; white-space: nowrap; }
.user-chip .who small { display: block; color: var(--muted); font-size: 11px; }
.content { padding: 22px 24px 40px; max-width: 1480px; width: 100%; }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
/* заголовок с переключателем вида: переключатель стоит сразу за названием и не прыгает между видами */
.page-head .head-main { margin-right: auto; }
.page-head .title-row { display: flex; align-items: center; gap: 18px; }
.page-head .title-row h1 { margin-right: 0; }
.page-head .title-row + .sub { margin-top: 6px; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text); font: 500 14px var(--font);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: #f6f7f9; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.accent { background: var(--accent); border-color: #e0a800; color: #2f2300; }
.btn.accent:hover { background: #ffc933; }
.btn.danger { color: var(--danger); border-color: #efc2be; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.input {
  width: 100%; height: 36px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: #fff; color: var(--text); font: 14px var(--font);
}
textarea.input { height: auto; min-height: 60px; resize: vertical; }
select.input { padding-right: 6px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(19, 97, 77, .15); }
.input[readonly] { background: var(--bg); }
.check { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: -3px; }
.file { font: 13px var(--font); max-width: 100%; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field .req { color: var(--danger); }
.field .help { font-size: 12px; color: var(--faint); margin-top: 3px; }
.field .err { font-size: 12px; color: var(--danger); margin-top: 3px; }
.field.has-err .input { border-color: var(--danger); }
.field.checkbox { display: flex; align-items: center; gap: 8px; padding-top: 20px; }
.field.checkbox label.lbl { margin: 0; font-size: 14px; color: var(--text); font-weight: 400; }
.form-errors {
  background: var(--danger-soft); color: var(--danger); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px;
}
.form-section { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600;
  margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); grid-column: 1 / -1; }
.form-section:first-child { margin-top: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- панели ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.grid-2 > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin-right: auto; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.card-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); gap: 16px; align-items: start; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.warn { border-left: 3px solid var(--accent); }
.stat.bad { border-left: 3px solid var(--danger); }
.stat a { color: inherit; }

/* ---------- таблицы ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px;
  border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap;
}
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child b { white-space: nowrap; }
.table tbody tr:hover td { background: #fafcfb; }
.table tr.row-link { cursor: pointer; }
.table tfoot td { font-weight: 600; background: #fafbfc; border-top: 1px solid var(--line); }
.table .sub { font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters .input { width: auto; min-width: 140px; height: 32px; font-size: 13px; }
.filters .q { min-width: 240px; }
.filters .btn { height: 32px; }
.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 11px 12px 9px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.totals-bar { display: flex; gap: 22px; padding: 10px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); background: #fafbfc; flex-wrap: wrap; }
.totals-bar b { color: var(--text); font-variant-numeric: tabular-nums; }

.pager { display: flex; gap: 6px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.pager .info { margin-right: auto; color: var(--muted); }

/* ---------- значки ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; line-height: 18px; }
.st-expected { background: var(--accent-soft); color: #7a5800; }
.st-accepted { background: var(--info-soft); color: var(--info); }
.st-ready { background: #efe9fb; color: #6b3fc4; }
.st-shipped { background: #fff0e3; color: #c25a00; }
.st-delivered { background: #e3f4f6; color: #0e7c86; }
.st-issued { background: var(--ok-soft); color: var(--ok); }
.st-new { background: var(--info-soft); color: var(--info); }
.st-review { background: var(--warn-soft); color: var(--warn); }
.st-satisfied, .st-partial { background: var(--ok-soft); color: var(--ok); }
.st-rejected { background: #eef0f2; color: var(--muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: #eef0f2; color: var(--muted); white-space: nowrap; }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.yellow { background: var(--accent-soft); color: #7a5800; }
.tag.green { background: var(--ok-soft); color: var(--ok); }
.tag.blue { background: var(--info-soft); color: var(--info); }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start; }
.alert.success { background: var(--ok-soft); color: #145c33; }
.alert.error { background: var(--danger-soft); color: #8c2019; }
.alert.warning { background: var(--warn-soft); color: #7a4d0b; }
.alert.info { background: var(--info-soft); color: #1b4a94; }
.messages { margin-bottom: 14px; }

/* ---------- карточка ---------- */
.props { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 7px 14px; font-size: 14px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.card-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-title .num-big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.route { font-size: 15px; font-weight: 500; }
.route .arrow { color: var(--faint); margin: 0 6px; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pipeline { display: flex; gap: 4px; margin: 14px 0 4px; }
.pipeline span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.pipeline span.done { background: var(--brand); }
.pipeline-labels { display: flex; gap: 4px; font-size: 11px; color: var(--muted); }
.pipeline-labels span { flex: 1; }
.kv-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv-row.total { font-weight: 700; font-size: 15px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photo { position: relative; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: #f5f6f7; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; cursor: zoom-in; }
.photo .cap { font-size: 11px; padding: 4px 6px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo .flag { position: absolute; top: 6px; left: 6px; }
.photo form { position: absolute; top: 4px; right: 4px; }
.photo .del { width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; display: grid; place-items: center; }

/* ---------- лента ---------- */
.feed-form { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.feed-form textarea { min-height: 42px; }
.feed-form .btn-row { margin-top: 8px; justify-content: flex-end; }
.feed { list-style: none; margin: 0; padding: 4px 16px 12px; max-height: 760px; overflow-y: auto; }
.feed li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: #eef0f2; color: var(--muted); }
.feed .dot.comment { background: var(--accent-soft); color: #7a5800; }
.feed .dot.create { background: var(--ok-soft); color: var(--ok); }
.feed .dot.status { background: var(--brand-soft); color: var(--brand); }
.feed .dot.delete { background: var(--danger-soft); color: var(--danger); }
.feed .body { min-width: 0; flex: 1; }
.feed .meta { font-size: 12px; color: var(--muted); }
.feed .what { font-weight: 600; font-size: 13px; }
.feed .text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.feed .changes { margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; }
.feed .changes li { display: block; padding: 1px 0; border: 0; }
.feed .changes .old { color: var(--faint); text-decoration: line-through; }

/* ---------- доска ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { flex: 0 0 262px; background: #e9edf0; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.col-head { padding: 10px 12px 8px; border-top: 3px solid var(--line-strong); border-radius: var(--radius) var(--radius) 0 0; }
.col-head .t { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.col-head .s { font-size: 12px; color: var(--muted); }
.col-expected .col-head { border-top-color: var(--accent); }
.col-accepted .col-head { border-top-color: var(--info); }
.col-ready .col-head { border-top-color: #6b3fc4; }
.col-shipped .col-head { border-top-color: #c25a00; }
.col-delivered .col-head { border-top-color: #0e7c86; }
.col-issued .col-head { border-top-color: var(--ok); }
.col-body { padding: 4px 8px 10px; overflow-y: auto; flex: 1; min-height: 80px; }
.col.drop-ok .col-body { background: rgba(19, 97, 77, .08); outline: 2px dashed var(--brand); outline-offset: -4px; border-radius: 6px; }
.col.drop-no { opacity: .55; }
.kcard { background: #fff; border-radius: 6px; padding: 9px 10px; margin-top: 6px; box-shadow: var(--shadow); border: 1px solid transparent; cursor: grab; }
.kcard:hover { border-color: var(--line-strong); }
.kcard.dragging { opacity: .5; }
.kcard .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.kcard .c { font-size: 13px; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .r { font-size: 12px; color: var(--muted); }
.kcard .tags { margin-top: 5px; display: flex; gap: 4px; flex-wrap: wrap; }
.col-more { font-size: 12px; color: var(--muted); text-align: center; padding: 8px; }

/* ---------- автоподбор клиента ---------- */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 2px; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow-lg); z-index: 30; max-height: 320px; overflow-y: auto; }
.ac-item { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active { background: var(--brand-soft); }
.ac-item .sub { font-size: 12px; color: var(--muted); }
.ac-item.new { color: var(--brand); font-weight: 600; }
.client-picked { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 6px; }
.client-picked .name { font-weight: 600; }
.client-picked .x { margin-left: auto; }

/* ---------- отправитель / получатель ---------- */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 16px; font-weight: 500; color: var(--muted); border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--brand); color: #fff; }
.seg input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--accent); }
.party[data-kind="person"] .ip-only, .party[data-kind="person"] .company-only, .party[data-kind="person"] .biz-only { display: none; }
.party[data-kind="ip"] .person-only, .party[data-kind="ip"] .company-only { display: none; }
.party[data-kind="company"] .person-only, .party[data-kind="company"] .ip-only, .party[data-kind="company"] .not-company { display: none; }
.party .panel-head { flex-wrap: wrap; }
.party-found { display: inline-flex; align-items: center; gap: 6px; }
.same-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.inn-row { display: flex; gap: 6px; }
.inn-row .btn { height: 36px; flex: none; }
.inn-msg.bad { color: var(--danger); }
.inn-msg.good { color: var(--ok); }
.passport-row { display: flex; gap: 8px; }
.passport-row > .input { width: 90px; flex: none; }
.passport-row .grow { flex: 1; position: relative; }
.payer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.payer-row .lbl-inline { font-weight: 600; }
.payer-row .radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.payer-row .radio input { accent-color: var(--brand); }

.phrases { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--line-strong); background: #fff; border-radius: 14px; padding: 3px 10px; font: 12px var(--font); color: var(--muted); cursor: pointer; }
.chip:hover { border-color: var(--brand); color: var(--brand); }

.value-list { display: flex; flex-wrap: wrap; gap: 6px; }
.value-item { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-strong); border-radius: 16px; padding: 1px 2px 1px 12px; background: #fafbfc; }
.value-item .btn { height: 24px; width: 24px; padding: 0; justify-content: center; border-radius: 50%; }

/* ---------- задачи и календарь ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.cal-nav h2 { margin: 0 auto 0 8px; min-width: 150px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--line); }
.cal-day { display: flex; flex-direction: column; gap: 3px; min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); overflow: hidden; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: #f7faf9; text-decoration: none; }
.cal-day.out { background: #fafbfc; }
.cal-day.out .cal-num { color: var(--faint); }
.cal-day.selected { box-shadow: inset 0 0 0 2px var(--brand); background: var(--brand-soft); }
.cal-num { font-weight: 600; font-size: 13px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--brand); color: #fff; }
.cal-task { font-size: 11.5px; line-height: 1.25; padding: 2px 5px; border-radius: 4px; background: var(--info-soft); color: #1b4a94; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-task.done { background: #eef0f2; color: var(--faint); text-decoration: line-through; }
.cal-task.overdue { background: var(--danger-soft); color: #8c2019; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.quick-task { display: grid; gap: 8px; padding-bottom: 14px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.quick-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; }
.quick-task .btn { justify-self: start; }
.task-list { display: grid; gap: 2px; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; color: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; margin-top: 1px; }
.task .tick:hover { border-color: var(--brand); color: var(--brand); }
.task.done .tick { background: var(--brand); border-color: var(--brand); color: #fff; }
.task-body { min-width: 0; flex: 1; }
.task-title { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.task.done .task-title { color: var(--faint); text-decoration: line-through; }
.task.overdue .sub { color: var(--danger); }
.task .sub { font-size: 12px; color: var(--muted); }
.task .sub > span + span::before { content: ' · '; }

.view-switch span { padding: 6px 14px; }
.task-board .col { flex: 1 1 240px; min-width: 230px; background: transparent; }
.task-board .col-head { border-top: 0; border-bottom: 3px solid var(--line-strong); text-align: center; border-radius: 0; text-transform: uppercase; font-size: 12px; letter-spacing: .5px; }
.task-board .col-head .t { justify-content: center; gap: 8px; }
.tcol-today .col-head { border-bottom-color: var(--brand); }
.tcol-overdue .col-head { border-bottom-color: var(--danger); color: var(--danger); }
.tcard { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); }
.tcard-body { color: var(--text); flex: 1; min-width: 0; }
.tcard-body:hover { text-decoration: none; }
.tcard .tdate { color: var(--info); font-size: 14px; margin: 1px 0; }
.tcol-overdue .tdate { color: var(--danger); }
.tcard .tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; color: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; margin-top: 2px; }
.tcard .tick:hover { border-color: var(--brand); color: var(--brand); }

details.fold > summary { cursor: pointer; list-style: none; border-bottom: 0; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin-right: 10px; }
details.fold > summary h2::before { content: '▸ '; color: var(--faint); }
details.fold[open] > summary h2::before { content: '▾ '; }
details.fold[open] > summary { border-bottom: 1px solid var(--line); }
details.fold > summary .small { margin-right: auto; }
details.more { grid-column: 1 / -1; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 13px; margin: 4px 0 10px; }

.team-tabs { margin-bottom: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.team-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 120px; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.progress.reached > span { background: var(--ok); }
.goal-num { font-weight: 600; white-space: nowrap; }
.goal-num.reached { color: var(--ok); }
.month-nav { display: inline-flex; align-items: center; gap: 8px; }
.month-nav b { min-width: 130px; text-align: center; font-size: 15px; }
.matrix-n { text-align: center; }
.table th.matrix-n { white-space: normal; padding-left: 6px; padding-right: 6px; }
.matrix-n.zero { color: var(--faint); }

.task.boss { border-left: 3px solid var(--danger); padding-left: 8px; background: var(--danger-soft); border-radius: 4px; }
.tcard.boss { border-left: 3px solid var(--danger); }
.check-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; cursor: pointer; }
.boss-panel { border: 1px solid var(--danger); border-left: 4px solid var(--danger); margin-bottom: 16px; }
.boss-panel > .panel-head { background: var(--danger-soft); }
.boss-panel > .panel-head h2 { color: var(--danger); display: flex; align-items: center; gap: 8px; }
.boss-task { display: flex; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.boss-task:last-child { border-bottom: 0; }
.boss-task .boss-body { flex: 1; min-width: 0; }
.boss-task .boss-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

.an-filters { padding: 12px 14px; display: grid; gap: 10px; }
.an-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.an-row select.input { width: auto; max-width: 230px; }
.an-row .seg span { padding: 6px 12px; }
.table.wrap-first td:first-child b { white-space: normal; }
.table.wrap-first td, .table.wrap-first th { padding-left: 10px; padding-right: 10px; }
.progress.thin { height: 4px; margin-top: 5px; min-width: 0; }
.share { display: flex; align-items: center; gap: 8px; }
.share .progress { flex: 1; min-width: 36px; }
.share > span { width: 38px; text-align: right; color: var(--muted); font-size: 12px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; overflow-x: auto; }
.bars.days { gap: 3px; }
.bar { flex: 1 1 0; min-width: 18px; display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.bar-n { font-size: 11px; text-align: center; color: var(--muted); height: 16px; }
.bar-col { flex: 1; display: flex; align-items: flex-end; }
.bar-col span { display: block; width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-l { font-size: 11px; text-align: center; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.bar.weekend .bar-l { color: var(--danger); }
tr.selected td { background: var(--brand-soft); }

/* ---------- окна ---------- */
dialog { border: 0; border-radius: 10px; padding: 0; box-shadow: var(--shadow-lg); width: 480px; max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(15, 25, 30, .45); }
dialog .dlg-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
dialog .dlg-head h2 { margin-right: auto; }
dialog .dlg-body { padding: 16px 18px; }
dialog .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfc; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 100; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; }

/* ---------- калькулятор ---------- */
.calc-result { font-size: 30px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---------- роли и команда ---------- */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix th.area-office { color: var(--brand); }
.matrix th.area-warehouse { color: var(--warn); }
.area-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.area-card { position: relative; display: block; cursor: pointer; }
.area-card input { position: absolute; opacity: 0; pointer-events: none; }
.area-body { display: block; height: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; }
.area-card:hover .area-body { border-color: var(--line-strong); }
.area-card input:checked + .area-body { border-color: var(--brand); background: var(--brand-soft); }
.area-card input:focus-visible + .area-body { box-shadow: 0 0 0 3px rgba(19, 97, 77, .2); }
.area-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.area-hint { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.role-caps { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 13px; }
.role-caps .desc { grid-column: 1 / -1; color: var(--muted); margin-bottom: 6px; }
.role-caps .yes { color: var(--ok); }
.role-caps .no { color: var(--faint); }
.team-group .avatar { width: 30px; height: 30px; }
.team-norole .panel-head h2, .team-blocked .panel-head h2 { color: var(--muted); }

/* ---------- вход ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--brand-deep), var(--brand) 70%); padding: 16px; }
.login-box { width: 380px; max-width: 100%; background: #fff; border-radius: 12px; padding: 28px; box-shadow: var(--shadow-lg); }
.login-box .field { margin-bottom: 12px; }

@media (max-width: 1100px) {
  .card-layout, .grid-2, .cal-layout { grid-template-columns: minmax(0, 1fr); }
  .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- печать ---------- */
@media print {
  .sidebar, .topbar, .no-print, .messages { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
}
