/* Español Win · CRM. Тот же тёплый стиль, что у сайта и демо-кабинетов. */
:root {
  --bg: #f8f5ef;
  --side: #f0e7da;
  --line: #e8ddce;
  --line-2: #ece3d8;
  --card: #fffdf9;
  --ink: #3a3040;
  --muted: #938375;
  --accent: #8d644f;
  --accent-2: #a86f4c;
  --chip: #eee8de;
  --ok: #e6eee2;
  --ok-ink: #4f6b45;
  --warn: #f6e7d3;
  --warn-ink: #8a5a2b;
  --bad: #f4e1dc;
  --bad-ink: #94473a;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 34px; letter-spacing: -1px; margin-bottom: 0; line-height: 1.15; }
h2 { font-size: 22px; letter-spacing: -0.4px; margin-bottom: 14px; }
h3 { font-size: 17px; margin-bottom: 6px; }
[hidden] { display: none !important; }

/* ── каркас */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); max-width: 1500px; margin: auto; min-height: 100vh; }
.side { padding: 30px 22px; background: var(--side); border-right: 1px solid #e1d2c1; display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { background: var(--accent); color: var(--card); border-radius: 14px; min-width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.brand-name { font-weight: 650; line-height: 1.25; }
.brand-role { font-size: 12px; color: var(--accent); margin-top: 16px; }
.ws-switch { margin-top: 10px; width: 100%; background: var(--card); border: 1px solid #dccbb8; border-radius: 10px; padding: 8px; font-size: 13px; }
.side nav { display: grid; gap: 6px; margin: 24px 0; }
.side nav button { border: 0; background: transparent; text-align: left; padding: 12px 15px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; }
.side nav button:hover { background: #f6efe5; }
.side nav button[aria-current="page"] { background: var(--card); color: var(--accent); font-weight: 650; }
.nav-count { font-size: 11px; background: var(--accent); color: var(--card); border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.side-foot { margin-top: auto; padding-top: 30px; font-size: 12px; color: var(--accent); display: grid; gap: 8px; }
.side-foot button { border: 0; background: none; padding: 0; color: var(--accent); text-align: left; text-decoration: underline; }
.logo-word { font-weight: 800; letter-spacing: -0.6px; font-size: 15px; color: var(--ink); }
.logo-word span { color: var(--accent-2); }

.main { padding: 32px; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #9b795f; display: block; margin-bottom: 10px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── блоки */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stats article { padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.stats small { display: block; color: var(--muted); font-size: 13px; }
.stats strong { font-size: 28px; letter-spacing: -0.5px; }
.card { background: var(--card); border: 1px solid var(--line); padding: 24px; border-radius: 20px; margin-bottom: 22px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid2 > .card { margin: 0; }
.grid2 { margin-bottom: 22px; }
.empty { color: var(--muted); font-size: 14px; padding: 14px 0 4px; }
.caption { font-size: 12px; color: var(--muted); }
.notice { background: #e9eee6; padding: 14px 16px; border-radius: 14px; font-size: 13px; }
.notice.warn { background: var(--warn); color: var(--warn-ink); }

/* ── строки списков */
.row { display: grid; grid-template-columns: 44px minmax(120px, 1fr) auto auto; align-items: center; gap: 16px; border: 0; border-top: 1px solid var(--line-2); background: none; width: 100%; text-align: left; padding: 16px 0; }
.row:first-of-type { border-top: 0; }
button.row:hover .row-go { text-decoration: underline; }
.row small { display: block; color: var(--muted); font-size: 12px; }
.row-go { font-size: 12px; color: var(--accent); white-space: nowrap; }
.row.time { grid-template-columns: 64px minmax(120px, 1fr) auto auto; }
.time-cell { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--accent); }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; background: var(--side); color: var(--accent); border-radius: 50%; font-size: 13px; font-weight: 600; }
.day-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #9b795f; margin: 22px 0 4px; }
.day-title:first-child { margin-top: 0; }

.pill { font-size: 12px; border-radius: 20px; padding: 5px 11px; background: var(--chip); color: var(--accent); white-space: nowrap; }
.pill.ok { background: var(--ok); color: var(--ok-ink); }
.pill.warn { background: var(--warn); color: var(--warn-ink); }
.pill.bad { background: var(--bad); color: var(--bad-ink); }
.pill.mute { background: #f1ede7; color: var(--muted); }

/* ── заявки: колонки по статусам */
.board { display: grid; grid-template-columns: repeat(5, minmax(165px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #f3ece2; border-radius: 16px; padding: 12px; min-height: 120px; }
.col h3 { font-size: 13px; color: var(--accent); margin: 2px 4px 10px; display: flex; justify-content: space-between; }
.lead { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.lead:hover { border-color: #d7c3ad; }
.lead strong { display: block; font-size: 14px; }
.lead small { display: block; color: var(--muted); font-size: 12px; }
.lead .pill { display: inline-block; margin-top: 8px; }

/* ── кнопки и формы */
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--card); border-radius: 11px; padding: 11px 17px; font-weight: 600; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; }
.btn:hover { background: #785541; }
.btn.ghost { background: transparent; color: var(--accent); border-color: #dfcdbb; }
.btn.ghost:hover { background: #f6efe5; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; background: var(--chip); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 9px; font-size: 13px; color: var(--accent); }
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 650; }
.tools { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.tools input[type="search"] { max-width: 320px; }

label { display: block; font-size: 14px; font-weight: 600; }
input, select, textarea { display: block; width: 100%; font-weight: 400; background: var(--card); border: 1px solid #dccbb8; border-radius: 10px; padding: 10px 11px; margin: 7px 0 14px; min-width: 0; }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; }
.check input { width: auto; margin: 0; }
.fields2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.err { color: var(--bad-ink); font-size: 13px; min-height: 1em; margin: -4px 0 10px; }

dialog { background: var(--card); border: 1px solid #dfcdbb; border-radius: 22px; padding: 28px; width: min(640px, calc(100% - 24px)); max-height: 92vh; overflow: auto; color: inherit; }
dialog.wide { width: min(860px, calc(100% - 24px)); }
dialog::backdrop { background: #392c2590; }
.dlg-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.dlg-head h2 { margin: 0; }
.close { border: 0; background: var(--side); border-radius: 50%; font-size: 22px; width: 34px; height: 34px; flex: none; line-height: 1; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent); border-color: var(--accent); font-weight: 600; }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0 0 16px; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px 6px 0; }
.mini td { border-top: 1px solid var(--line-2); padding: 10px 8px 10px 0; vertical-align: top; }
.att { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; border-top: 1px solid var(--line-2); padding: 12px 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); }

/* ── вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { max-width: 460px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 36px; }
.login-card h1 { font-size: 30px; margin: 18px 0 12px; }
.login-card ol { padding-left: 20px; color: #5d5060; }
.login-card li { margin-bottom: 6px; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #bd9b78; outline-offset: 2px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { border: 0; padding: 18px 16px; }
  .side nav { grid-template-columns: 1fr 1fr; margin: 14px 0 0; }
  .side nav button { padding: 10px 12px; }
  .side-foot { display: none; }
  .main { padding: 20px 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid2, .fields2 { grid-template-columns: 1fr; }
  .row, .row.time { grid-template-columns: 40px 1fr; gap: 10px 12px; }
  .row.time { grid-template-columns: 52px 1fr; }
  .row > .pill, .row > .row-go { grid-column: 2; justify-self: start; }
  .card { padding: 18px; }
  h1 { font-size: 28px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
  dialog { padding: 20px; }
  .board { grid-template-columns: repeat(5, 78vw); }
  .att { grid-template-columns: 1fr; gap: 6px; }
  .att .seg { justify-self: start; flex-wrap: wrap; }
}
.tg-login { min-height: 48px; margin: 6px 0 18px; }

/* ── календарь */
.cal-card { padding: 16px; overflow-x: auto; }
.cal-week { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); min-width: 860px; }
.cal-gutter .cal-hour { height: 52px; font-size: 11px; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.cal-dayhead { height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); }
.cal-dayhead span { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.cal-dayhead strong { font-size: 18px; }
.cal-col.today .cal-dayhead strong { background: var(--accent); color: var(--card); border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; font-size: 15px; }
.cal-col { border-left: 1px solid var(--line-2); }
.cal-col.today { background: #fbf6ee; }
.cal-slots { position: relative; }
.cal-cell { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--line-2); background: transparent; padding: 0; cursor: cell; }
.cal-cell:hover { background: #f4ece1; }
.cal-ev { position: absolute; border: 0; border-left: 3px solid; border-radius: 8px; padding: 4px 7px; text-align: left; overflow: hidden; font-size: 12px; line-height: 1.3; cursor: pointer; display: flex; flex-direction: column; gap: 1px; box-shadow: 0 1px 2px #0000000d; }
.cal-ev strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev small { color: inherit; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev:hover { filter: brightness(.97); z-index: 2; }
.lesson.t0 { background: #f3e4d6; border-color: #a86f4c; color: #5d3a26; }
.lesson.t1 { background: #e6ece0; border-color: #6c8a5a; color: #374a2b; }
.lesson.t2 { background: #e3e7f0; border-color: #6a7fa8; color: #2f3c5a; }
.lesson.t3 { background: #efe2ea; border-color: #a26a8a; color: #59324a; }
.lesson.t4 { background: #f1ead2; border-color: #a8913c; color: #574a1b; }
.lesson.t5 { background: #dfecec; border-color: #4f8d8d; color: #234848; }
.cal-ev.lesson.cancelled { opacity: .5; text-decoration: line-through; }
.cal-ev.lesson.done { opacity: .75; }
.item { background: #fffdf9; border: 1px dashed #cdb8a0; border-left: 3px solid #8d644f; color: #4c4046; }
.item.kind-homework { border-left-color: #6a7fa8; }
.item.kind-note { border-left-color: #b9a99a; }
.item.done { opacity: .55; text-decoration: line-through; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: #c0533a; pointer-events: none; z-index: 3; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #c0533a; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2); min-width: 700px; }
.cal-mhead { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 8px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.cal-day { min-height: 108px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal-day.out { background: #faf7f2; }
.cal-day.out .cal-daynum { color: #c4b6a8; }
.cal-daynum { align-self: flex-start; border: 0; background: none; font-weight: 600; font-size: 13px; padding: 2px 6px; border-radius: 8px; }
.cal-day.today .cal-daynum { background: var(--accent); color: var(--card); }
.cal-chip { border: 0; border-left: 3px solid; border-radius: 6px; font-size: 11.5px; padding: 3px 6px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { border: 0; background: none; color: var(--accent); font-size: 12px; text-align: left; padding: 2px 6px; }
.is-done { text-decoration: line-through; opacity: .6; }
@media (max-width: 900px) { .head .seg button { padding: 7px 9px; } }
