/* THE THEME «тёплый бьюти-стиль» (ANSWERS_35 п. 4): every colour and corner of the copy lives in this block and nowhere else.
   The --c-* names of theme.css are re-pointed here, so the old frame (app.css) and the new one (v2) wear the same dress.
   Change the --bt-* values to change the look of the whole copy. */
:root {
  --bt-page: #FBF7F4;       /* milk */
  --bt-card: #FFFFFF;
  --bt-line: #EFE4DD;       /* card border, row separators */
  --bt-field-line: #9C8780; /* fields and buttons: 3.2 : 1 against the page */
  --bt-text: #3A2A26;       /* dark chocolate */
  --bt-muted: #8C7670;
  --bt-accent: #B5576B;     /* dusty rose */
  --bt-accent-dark: #9A4357;
  --bt-soft: #F7E6EA;       /* light accent: resting hot buttons, chips */
  --bt-soft-text: #9A4357;
  --bt-select: #FBF0EC;     /* chosen / hovered rows */
  --bt-row-alt: #FDF9F7;
  --bt-pink-on-dark: #F2B8C6;
  --bt-input-line: #D9C4BA;       /* fields: clear 1px frame */
  --bt-input-hover: #BFA79C;
  --bt-placeholder: #A8948D;
  --bt-glow: rgba(181, 87, 107, .22);   /* soft rose halo of the focused field */
  --bt-shadow: 0 6px 18px rgba(60, 30, 36, .16);   /* a small drop-down menu (ANSWERS_47 п. 2) */
  --bt-disabled: #F1EEED;
  --bt-ok: #2F7A4B;  --bt-ok-bg: #E4F2E8;
  --bt-amber: #8A5A00;  --bt-amber-bg: #FBEFCB;
  --bt-blue: #2B5F9E;  --bt-blue-bg: #E2ECF8;
  --bt-red: #A8261E;  --bt-red-bg: #F9E1DD;
  --bt-r-card: 14px;
  --bt-r-ctl: 10px;
  --c-page: var(--bt-page);
  --c-surface: var(--bt-card);
  --c-border: var(--bt-line);
  --c-border-strong: var(--bt-field-line);
  --c-text: var(--bt-text);
  --c-text-muted: var(--bt-muted);
  --c-header: var(--bt-text);            /* dark: focus rings, pinned totals rows; the header bar itself is white (below) */
  --c-header-text: var(--bt-select);
  --c-gold: var(--bt-pink-on-dark);      /* accents on the dark totals rows */
  --c-accent: var(--bt-accent);
  --c-accent-text: var(--bt-card);
  --c-accent-dark: var(--bt-accent-dark);
  --c-tabs-bg: var(--bt-card);
  --c-tabs-text: var(--bt-text);
  --c-row-alt: var(--bt-row-alt);
  --c-row-hover: var(--bt-select);
  --c-table-head: var(--bt-soft);
  --c-panel-head: var(--bt-soft);
  --radius: var(--bt-r-ctl);
  --radius-lg: var(--bt-r-card);
}

/* The frame of the new design of the copy v2 (ANSWERS_32 п. 0.5): header, menu, cards, buttons, fields, the window on the page,
   notices, the base banner. Flat, white cards with a 12 px corner and a thin border; buttons are at least 44 px high.
   Colours come only from theme.css (--c-*). Components are listed in docs/UI_V2.md. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.v2 { margin: 0; background: var(--c-page); color: var(--c-text); font: calc(15 * var(--u))/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.v2-main { max-width: calc(1480 * var(--u)); margin: 0 auto; padding: calc(16 * var(--u)); }
.v2-banner { padding: calc(1 * var(--u)) calc(16 * var(--u)); font-size: calc(11 * var(--u)); font-weight: 700; letter-spacing: .03em; color: var(--c-db-text); text-align: center; }
.v2-banner.db-mirror { background: var(--c-db-mirror); }
.v2-banner.db-sandbox { background: var(--c-db-sandbox); }
.v2-banner.db-demo { background: var(--c-db-demo); }

/* header and menu */
.v2-sticky { position: sticky; top: 0; z-index: 60; }
.v2-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: calc(4 * var(--u)) calc(16 * var(--u)); padding: 0 calc(16 * var(--u)); background: var(--bt-card); color: var(--bt-text); border-bottom: 1px solid var(--bt-line); }
.v2-menu { display: flex; flex-wrap: wrap; }
.v2-menu a { display: inline-flex; align-items: center; min-height: calc(44 * var(--u)); padding: 0 calc(12 * var(--u)); color: var(--bt-text); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; }
.v2-menu a:hover { color: var(--bt-accent); }
.v2-menu a.active { color: var(--bt-accent-dark); border-bottom-color: var(--bt-accent); font-weight: 600; }
.v2-who { display: flex; flex-wrap: wrap; align-items: center; gap: calc(4 * var(--u)) calc(12 * var(--u)); font-size: calc(13 * var(--u)); }
.v2-user { opacity: .9; }
.v2-inline { display: inline; margin: 0; }
.v2-link { background: none; border: 0; padding: calc(8 * var(--u)) 0; color: var(--bt-accent-dark); cursor: pointer; font: inherit; font-size: calc(13 * var(--u)); }
.v2-db { position: relative; }
.v2-db summary { cursor: pointer; padding: calc(8 * var(--u)) 0; list-style: none; }
.v2-db .menu-list { position: absolute; right: 0; top: 100%; z-index: 40; min-width: calc(160 * var(--u)); background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--bt-r-ctl); padding: calc(4 * var(--u)) 0; }
.v2-db .menu-item { display: block; padding: calc(10 * var(--u)) calc(14 * var(--u)); color: var(--c-text); text-decoration: none; white-space: nowrap; }
.v2-db a.menu-item:hover { background: var(--c-row-hover); }
.v2-db .menu-item.current { font-weight: 700; color: var(--c-text-muted); }

/* cards */
.v2-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--bt-r-card); padding: calc(14 * var(--u)) calc(16 * var(--u)); }
.v2-card + .v2-card { margin-top: calc(12 * var(--u)); }
.v2-card-title { font-size: calc(19 * var(--u)); font-weight: 700; color: var(--c-text); }
.v2-card--sheet { border: 1px solid var(--bt-accent); margin-bottom: calc(12 * var(--u)); }
.v2-card--warn { background: var(--c-warn-bg); border-color: var(--c-warn); color: var(--c-warn); }
.v2-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(320 * var(--u)), 1fr)); gap: calc(12 * var(--u)); }
.v2-grid2 > .v2-card + .v2-card { margin-top: 0; }
.v2-muted { color: var(--c-text-muted); font-size: calc(13 * var(--u)); }
.v2-num { font-variant-numeric: tabular-nums; }
.v2-err { color: var(--c-err); font-size: calc(14 * var(--u)); margin-top: calc(8 * var(--u)); }
.v2-row { display: flex; justify-content: space-between; align-items: center; gap: calc(8 * var(--u)); padding: calc(8 * var(--u)) 0; border-top: 1px solid var(--c-border); }
.v2-row:first-child { border-top: 0; }

/* buttons: at least 44 px high */
.v2-btn { display: inline-flex; align-items: center; justify-content: center; gap: calc(6 * var(--u)); min-height: calc(44 * var(--u)); padding: 0 calc(14 * var(--u)); font: inherit; font-size: calc(15 * var(--u)); color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--bt-r-ctl); cursor: pointer; text-decoration: none; }
.v2-btn:hover { background: var(--c-row-hover); }
.v2-btn:focus-visible, .v2-field:focus-visible, .v2-chip:focus-visible, .v2-link:focus-visible { outline: 2px solid var(--c-header); outline-offset: 2px; }
.v2-btn--primary { background: var(--bt-accent); color: var(--bt-card); border-color: var(--bt-accent); }
.v2-btn--primary:hover { background: var(--bt-accent-dark); border-color: var(--bt-accent-dark); }
.v2-btn--act { min-width: calc(180 * var(--u)); max-width: 100%; margin-top: calc(12 * var(--u)); }
.v2-btn--pick { justify-content: space-between; width: 100%; max-width: calc(420 * var(--u)); }
.v2-actions { display: flex; flex-wrap: wrap; gap: calc(8 * var(--u)); margin-top: calc(12 * var(--u)); }
.v2-actions .v2-btn--act { margin-top: 0; }
.v2-btn--wide { width: 100%; }
.v2-btn--big { min-height: calc(52 * var(--u)); font-size: calc(16 * var(--u)); }
.v2-btn--small { min-height: calc(44 * var(--u)); padding: 0 calc(12 * var(--u)); font-size: calc(14 * var(--u)); }
.v2-btn[disabled] { opacity: .5; cursor: default; }
.v2-chip { display: inline-flex; align-items: center; min-height: calc(44 * var(--u)); padding: 0 calc(14 * var(--u)); font: inherit; font-size: calc(14 * var(--u)); color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--bt-r-ctl); cursor: pointer; }
.v2-chip:hover { background: var(--bt-soft); }
.v2-chip.is-on { background: var(--bt-soft); border-color: var(--bt-accent); color: var(--bt-soft-text); font-weight: 600; }
.v2-chips { display: flex; flex-wrap: wrap; gap: calc(8 * var(--u)); }
.v2-textlink { color: var(--c-accent-dark); cursor: pointer; font-size: calc(14 * var(--u)); background: none; border: 0; padding: calc(12 * var(--u)) 0; font-family: inherit; text-decoration: underline; }

/* fields */
.v2-field { width: 100%; min-height: calc(44 * var(--u)); padding: 0 calc(12 * var(--u)); font: inherit; color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--bt-r-ctl); }
.v2-field--money { font-size: calc(20 * var(--u)); min-height: calc(52 * var(--u)); text-align: right; }
.v2-label { display: block; margin: calc(12 * var(--u)) 0 calc(4 * var(--u)); color: var(--c-text-muted); font-size: calc(13 * var(--u)); }
.v2-label:first-child { margin-top: 0; }
.v2-fields2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(8 * var(--u)); }

/* drop-down list under a field */
.v2-dd { border: 1px solid var(--c-border-strong); border-radius: var(--bt-r-ctl); margin-top: calc(4 * var(--u)); background: var(--c-surface); max-height: calc(320 * var(--u)); overflow: auto; }
.v2-dd > div { display: flex; justify-content: space-between; gap: calc(8 * var(--u)); align-items: center; min-height: calc(44 * var(--u)); padding: calc(8 * var(--u)) calc(12 * var(--u)); border-top: 1px solid var(--c-border); cursor: pointer; }
.v2-dd > div:first-child { border-top: 0; }
.v2-dd > div:hover, .v2-dd > div.is-active { background: var(--c-row-hover); }
.v2-dd .v2-add { color: var(--c-accent-dark); font-weight: 600; }

/* tables */
.v2-table { width: 100%; border-collapse: collapse; font-size: calc(14 * var(--u)); }
.v2-table td, .v2-table th { padding: calc(8 * var(--u)) calc(4 * var(--u)); text-align: right; border-top: 1px solid var(--c-border); }
.v2-table td:first-child, .v2-table th:first-child { text-align: left; }
.v2-table th { color: var(--c-text); font-weight: 600; font-size: calc(13 * var(--u)); border-top: 0; }
.v2-table td { color: var(--c-text); }
.v2-table tr.is-total td { font-weight: 700; }

/* window heading, notices, toast */
.v2-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: calc(12 * var(--u)); }
.v2-note { margin-bottom: calc(12 * var(--u)); padding: calc(10 * var(--u)) calc(14 * var(--u)); border-radius: var(--bt-r-ctl); background: var(--c-ok-bg); color: var(--c-ok); border: 1px solid var(--c-ok); }
.v2-note.error { background: var(--c-err-bg); color: var(--c-err); border-color: var(--c-err); }
.v2-toast { position: fixed; left: 50%; bottom: calc(16 * var(--u)); transform: translateX(-50%); z-index: 50; max-width: calc(100% - calc(32 * var(--u))); display: none; align-items: center; gap: calc(12 * var(--u)); padding: calc(12 * var(--u)) calc(16 * var(--u)); border-radius: var(--bt-r-ctl); background: var(--bt-text); color: var(--bt-card); }
.v2-toast.is-on { display: flex; }
.v2-toast a, .v2-toast button { color: var(--bt-pink-on-dark); background: none; border: 0; font: inherit; text-decoration: underline; cursor: pointer; padding: calc(8 * var(--u)) calc(4 * var(--u)); }
.v2-toast.is-error { background: var(--c-err); color: var(--c-surface); }

@media (max-width: 640px) {
  .v2-main { padding: calc(12 * var(--u)); }
  .v2-top { padding: 0 calc(8 * var(--u)); }
  .v2-menu a { padding: 0 calc(8 * var(--u)); }
  .v2-grid2 { grid-template-columns: 1fr; }
}

/* brand, employee colour dot (the colour itself comes from the data as --emp) */
.v2-brand { display: inline-flex; align-items: center; min-height: calc(44 * var(--u)); margin-right: calc(12 * var(--u)); color: var(--bt-accent); font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: calc(21 * var(--u)); letter-spacing: .01em; text-decoration: none; }
.v2-brand img { height: calc(28 * var(--u)); display: block; }
.emp-dot { display: inline-block; width: calc(10 * var(--u)); height: calc(10 * var(--u)); border-radius: 50%; background: var(--emp); margin-right: calc(6 * var(--u)); border: 1px solid var(--c-border-strong); vertical-align: baseline; }
.v2-top .v2-menu { margin-right: auto; }

/* hot buttons and amount fields: narrow, a caption above, left aligned (ANSWERS_34 п. 3) */
.v2-btn--hot { min-height: calc(40 * var(--u)); padding: 0 calc(12 * var(--u)); font-size: calc(14 * var(--u)); background: var(--bt-soft); color: var(--bt-soft-text); border-color: var(--bt-soft); }
.v2-btn--hot:hover, .v2-btn--hot.is-open { background: var(--bt-accent); color: var(--bt-card); border-color: var(--bt-accent); }
.v2-chip--small { min-height: calc(36 * var(--u)); padding: 0 calc(10 * var(--u)); font-size: calc(13 * var(--u)); }
.v2-sums { display: flex; flex-wrap: wrap; gap: calc(8 * var(--u)) calc(10 * var(--u)); margin-top: calc(8 * var(--u)); }
.v2-sum { display: grid; gap: 2px; width: calc(124 * var(--u)); font-size: calc(12 * var(--u)); color: var(--c-text-muted); }
.v2-sum--wide { width: calc(240 * var(--u)); max-width: 100%; }
/* the windows under the hot buttons: as wide as the content, left aligned, at most ~640 px; a phone takes the whole width */
.v2-card--sheet { width: fit-content; min-width: min(100%, calc(360 * var(--u))); max-width: min(100%, 640px); }
.v2-card--sheet .day-note, .v2-card--sheet .day-wide, .v2-card--sheet .v2-dd { max-width: calc(420 * var(--u)); }
@media (max-width: 640px) { .v2-card--sheet { width: 100%; max-width: 100%; } .v2-btn--act, .v2-btn--pick { width: 100%; } .v2-actions .v2-btn--act { flex: 1 1 100%; } }
.v2-table td.v2-num { white-space: nowrap; }
.v2-sum--cert { width: calc(170 * var(--u)); }
.v2-field--cert { width: calc(170 * var(--u)); min-height: calc(40 * var(--u)); font-size: calc(15 * var(--u)); text-align: left; }
.v2-field--sum { font-size: calc(16 * var(--u)); min-height: calc(40 * var(--u)); text-align: left; }
.v2-field--date { min-height: calc(40 * var(--u)); }
@media (max-width: 640px) { .v2-sums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } .v2-sum, .v2-sum--wide { width: auto; } .v2-btn--hot { min-height: calc(44 * var(--u)); } }

/* ONE place of the scale: every size of this frame is N * var(--u). 0.9px = 90% of the drawn sizes (80% was too small, ANSWERS_35);
   on a phone the unit is a whole pixel, so the main text is never smaller than 14 px. */
:root { --u: 0.9px; }
@media (max-width: 640px) { :root { --u: 1px; } }

/* the old frame (app.css) in the same dress: white header, rose underline of the open item, rounded cards (ANSWERS_35 п. 4) */
.topbar { background: var(--bt-card); color: var(--bt-text); border-bottom: 1px solid var(--bt-line); }
.topbar nav a, .who { color: var(--bt-text); }
.topbar nav a:hover { color: var(--bt-accent); }
.topbar nav a.active { color: var(--bt-accent-dark); border-bottom-color: var(--bt-accent); font-weight: 600; }
.brand { color: var(--bt-accent); font-family: Georgia, "Times New Roman", serif; font-size: 20px; }
.who button.link, .db-switch summary { color: var(--bt-accent-dark); }
.subbar { background: var(--bt-card); }
.subbar nav a { color: var(--bt-text); }
.subbar nav a.active { color: var(--bt-soft-text); background: var(--bt-soft); border-bottom-color: var(--bt-accent); border-radius: var(--bt-r-ctl) var(--bt-r-ctl) 0 0; }
.card, .kpi, .filter-panel, .tile { border-radius: var(--bt-r-card); border-color: var(--bt-line); }
.primary, .button.accent { background: var(--bt-accent); color: var(--bt-card); border-color: var(--bt-accent); }
.primary:hover, .button.accent:hover { background: var(--bt-accent-dark); border-color: var(--bt-accent-dark); }

/* ---- ANSWERS_36 п. 3: the header stays on top on every page; nothing hides under it when jumping to an anchor ---- */
html { scroll-padding-top: calc(var(--sticky-sub, 48px) + 8px); }
.topbar { z-index: 60; }
.subbar { z-index: 55; }
.db-banner { padding: 1px 14px; font-size: 11px; letter-spacing: .03em; }
.day [id], .v2-card--sheet { scroll-margin-top: calc(var(--sticky-sub, 48px) + 8px); }

/* ---- ANSWERS_36 п. 2: five totals tables read as five separate columns ---- */
.day-totals { grid-template-columns: repeat(auto-fit, minmax(calc(230 * var(--u)), 1fr)); gap: calc(14 * var(--u)); align-items: stretch; }
.day-total-table { display: flex; flex-direction: column; padding: calc(10 * var(--u)) calc(12 * var(--u)); background: var(--bt-row-alt); border: 1px solid var(--bt-line); border-radius: var(--bt-r-card); }
.day-total-table .v2-table { flex: 1; }
.day-total-table .v2-table td { white-space: nowrap; height: calc(34 * var(--u)); }
.day-total-title { color: var(--bt-accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: calc(4 * var(--u)); border-bottom: 2px solid var(--bt-soft); }
.day-total-note { margin-top: calc(8 * var(--u)); font-size: calc(12 * var(--u)); }

/* ---- ANSWERS_36 п. 4: sharper forms and lists. Looks only: no field moves, no logic changes ---- */
input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=hidden]), select, textarea, .v2-field, .lookup-field {
  background: var(--bt-card); color: var(--bt-text); border: 1px solid var(--bt-input-line); border-radius: var(--bt-r-ctl); }
input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=hidden]):hover, select:hover, textarea:hover, .v2-field:hover, .lookup-field:hover { border-color: var(--bt-input-hover); }
input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=hidden]):focus, select:focus, textarea:focus, .v2-field:focus, .lookup-field:focus-within {
  outline: 0; border-color: var(--bt-accent); box-shadow: 0 0 0 3px var(--bt-glow); }
input::placeholder, textarea::placeholder, .v2-field::placeholder { color: var(--bt-placeholder); opacity: 1; }
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly], .v2-field:disabled { background: var(--bt-disabled); color: var(--bt-muted); }
.lines input, .lines select { border-color: var(--bt-input-line); }
input[type=checkbox], input[type=radio] { accent-color: var(--bt-accent); }
label, .v2-label { color: var(--bt-text); font-weight: 600; font-size: 13px; }
.v2-label { font-size: calc(13 * var(--u)); }
.field.checkbox label, .inline-check, .payments .pay label { font-weight: 500; }
label.v2-sum, .v2-sum span { font-weight: 500; }

/* payment block */
.payments, .pay-box { background: var(--bt-card); border: 1px solid var(--bt-field-line); border-radius: var(--bt-r-ctl); }
.payments .pay { border: 1px solid var(--bt-input-line); border-radius: var(--bt-r-ctl); }
.payments .pay.on { border-color: var(--bt-accent); background: var(--bt-soft); }

/* table of goods and every table of the frame */
table { background: var(--bt-card); border: 1px solid var(--bt-line); border-radius: var(--bt-r-ctl); }
th { background: var(--bt-soft); color: var(--bt-soft-text); font-weight: 700; border-bottom: 2px solid var(--bt-soft-text); }
td, th { border-bottom-color: var(--bt-line); }
tbody tr:hover { background: var(--bt-select); }
.lines td.num, .lines th.num { text-align: right; }
tr.short td, tr.short td input, tr.short td .line-stock { color: var(--bt-red); font-weight: 600; }
.doc-total-row .doc-total, .doc-foot .totals { font-size: 17px; font-weight: 800; color: var(--bt-text); }
.doc-sum { color: var(--bt-accent); }
.v2-table { border: 0; border-radius: 0; background: transparent; }
.v2-table th { background: transparent; color: var(--bt-text); border-bottom: 0; }

/* buttons: main — filled rose, secondary — white with a rose frame and text */
button, .button { background: var(--bt-card); color: var(--bt-accent); border: 1px solid var(--bt-accent); border-radius: var(--bt-r-ctl); }
button:hover, .button:hover, summary.button:hover { background: var(--bt-soft); }
button.primary, .primary, .button.accent { background: var(--bt-accent); color: var(--bt-card); border-color: var(--bt-accent); }
button.primary:hover, .primary:hover, .button.accent:hover { background: var(--bt-accent-dark); border-color: var(--bt-accent-dark); }
button.link, .v2-link, .v2-textlink { background: transparent; border: 0; }
button.link:hover { background: transparent; }

/* document lists */
.doc-list-table td:first-child a, table[data-resizable] tbody td:first-child a { color: var(--bt-accent); font-weight: 600; }
tfoot tr.totals th { background: var(--bt-soft); color: var(--bt-text); border-top: 2px solid var(--bt-soft-text); }
tfoot tr.totals th b, tfoot tr.totals th.num { color: var(--bt-accent); }
.badge { border-radius: 999px; padding: 1px 9px; font-weight: 600; background: var(--bt-soft); color: var(--bt-soft-text); }
.badge.ok { background: var(--bt-ok-bg); color: var(--bt-ok); }
.badge.warn { background: var(--bt-amber-bg); color: var(--bt-amber); }
.badge.bad { background: var(--bt-red-bg); color: var(--bt-red); }
.badge.part { background: var(--bt-blue-bg); color: var(--bt-blue); }
tr.overdue td { background: var(--bt-amber-bg); }
.topbar nav a.brand { color: var(--bt-accent); }

/* ---- ANSWERS_37 п. 2: «Итого деньгами» and, under the line and smaller, «Оплачено сертификатом» (not added to it) ---- */
.v2-table tr.is-used td { font-size: calc(12 * var(--u)); color: var(--bt-muted); border-top: 2px solid var(--bt-line); height: calc(30 * var(--u)); }

/* ---- ANSWERS_37 п. 3: one calendar table, one header with the dates pinned, the same columns for administrators and masters ---- */
.cal-table { table-layout: fixed; width: 100%; border-collapse: collapse; }
.cal-col-name { width: 240px; }
.cal-col-sum { width: 52px; }
.cal-table th.cal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-table thead th { position: sticky; top: var(--sticky-sub, 0); z-index: 5; background: var(--bt-soft); color: var(--bt-soft-text); }
.cal-table thead th.cal-name { z-index: 6; }
.cal-table tr.cal-section th, .cal-table tr.cal-section td { background: var(--bt-soft); color: var(--bt-accent-dark); font-weight: 700; height: 28px; }
.cal-table tr.cal-section th { text-align: left; padding: 0 8px; }
.cal-cell { min-width: 0; }
.cal-day { min-width: 0; }
.cal-day.today, .cal-cell.today, .cal-gap.today { outline: 0; box-shadow: inset 2px 0 0 var(--bt-accent), inset -2px 0 0 var(--bt-accent); }
.cal-day.today { box-shadow: inset 2px 0 0 var(--bt-accent), inset -2px 0 0 var(--bt-accent), inset 0 2px 0 var(--bt-accent); }
.cal-table tbody tr:last-child .cal-cell.today { box-shadow: inset 2px 0 0 var(--bt-accent), inset -2px 0 0 var(--bt-accent), inset 0 -2px 0 var(--bt-accent); }
@media (max-width: 700px) { .cal-col-name { width: 96px; } .cal-col-sum { width: 40px; } .cal-table th.cal-name { padding: 4px 4px; font-size: 12px; } }

/* ---- ANSWERS_37 п. 5: windows and drop-downs stand above the pinned header (z 60) ---- */
.modal-overlay, .fin-overlay { z-index: 900; }
.modal { height: min(620px, calc(100vh - 24px)); max-height: calc(100vh - 24px); }
.cert-modal { max-height: calc(100vh - 24px); }
.modal-body, .modal-right { min-height: 0; }
.modal-tree, .modal-table { overflow: auto; min-height: 0; }
body.modal-open { overflow: hidden; }
.emp-list { z-index: 800; }
.message.toast, .v2-toast { z-index: 950; }
details[data-menu] > .pop, details[data-menu] > .menu-items, details[data-menu] > .menu-list { z-index: 800; }
.lookup-box, .suggest { z-index: 700; }

/* ---- ANSWERS_38 п. 1: the certificate chip stands inside the cell of its own master row; the row is tinted and centred ---- */
.studio-table td { vertical-align: middle; }
.studio-table tr.has-cert > td { background: var(--bt-soft); }
.studio-table .cert-cell { text-align: left; }
.cert-chip { display: block; width: max-content; max-width: 100%; margin: 2px 0; padding: 1px 6px; border: 1px solid var(--bt-accent); border-radius: 10px; background: var(--c-surface); font-size: 12px; white-space: nowrap; cursor: help; }
.cert-chip .inline-form { margin-left: 4px; }
.cert-chip .link { padding: 0 2px; }
.cert-cell .cert-more { min-height: 0; padding: 0 6px; font-size: 11px; line-height: 18px; }
.cert-chip-bar { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--bt-accent); border-radius: 10px; background: var(--bt-soft); cursor: help; }

/* ---- ANSWERS_38 п. 3: the small «?» instead of a standing explanation (hover or focus shows the text) ---- */
.help-tip { position: relative; display: inline-block; width: 16px; height: 16px; margin-left: 4px; border: 1px solid var(--bt-line); border-radius: 50%; font-weight: 700; font-size: 11px; line-height: 14px; text-align: center; color: var(--bt-muted); cursor: help; vertical-align: middle; }
.help-tip:hover, .help-tip:focus { color: var(--bt-accent-dark); border-color: var(--bt-accent); outline: 0; }
.help-tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-30%); z-index: 850; width: max-content; max-width: min(320px, 80vw); padding: 6px 8px; border: 1px solid var(--bt-line); border-radius: 8px; background: var(--c-surface); color: var(--c-text, inherit); font-weight: 400; font-size: 12px; line-height: 1.35; text-align: left; white-space: normal; display: none; }
.help-tip:hover::after, .help-tip:focus::after { display: block; }

/* ---- ANSWERS_39 п. 4: the chosen item of every menu and tab is light rose with dark rose bold text and a stripe: it always reads ---- */
.settings-nav a { background: var(--bt-card); color: var(--bt-text); }
.settings-nav a.active, .v2-menu a.active, .subbar nav a.active, .topbar nav a.active {
  background: var(--bt-soft); color: var(--bt-soft-text); font-weight: 700;
}
.settings-nav a.active { border-left: 3px solid var(--bt-accent); }
.v2-menu a.active, .subbar nav a.active, .topbar nav a.active { border-bottom: 2px solid var(--bt-accent); }
.settings-nav a.active:hover, .v2-menu a.active:hover, .subbar nav a.active:hover, .topbar nav a.active:hover { color: var(--bt-soft-text); }

/* ---- ANSWERS_39 п. 6а: the menu and «База · пользователь · Сменить пользователя» share one row; a narrow screen wraps the menu
   inside its own column, never a separate line of the user block in the middle ---- */
.topbar { align-items: flex-start; gap: 0 12px; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; flex: 1 1 0; min-width: 0; }
.topbar nav a { padding-left: 8px; padding-right: 8px; }
.topbar .brand { margin-right: 8px; }
.topbar .who { flex: 0 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px 8px; padding-top: 8px; text-align: right; max-width: 46%; }
.topbar .who form { display: inline; margin: 0; }
.db-banner, .sync-warning { order: 5; }

/* ANSWERS_49: the user name in the header opens «Профиль» */
.who-link { color: inherit; text-decoration: none; }
.who-link:hover .who-name { text-decoration: underline; }
