/* «Дни рождения и годовщины клиентов». Живёт внутри Битрикс24: белые панели с тонкой рамкой без теней,
 * один акцент (синий портала) - для действий и выбора. Статусы - точка и текст. Даты - лентой по дням. */
:root {
    --ink: #1f2329; --text: #333a45; --muted: #5f6873; --faint: #8a929b;
    --line: #e3e6ea; --line2: #cfd4d9; --bg: #eef2f5; --panel: #fff; --soft: #f5f7f9;
    --accent: #0075ff; --accent-d: #0063d6; --accent-l: #eaf3ff;
    --ok: #137a4c; --ok-dot: #1bab6a; --bad: #c2343b; --bad-dot: #e0464d; --wait-dot: #4a90e2;
    --warn: #8a5a00; --warn-dot: #e09b1a; --warn-l: #fff7e8; --warn-line: #f3dcb0;
    --r: 10px; --ease: cubic-bezier(.2, .8, .2, 1); --graphite: #0075ff;
}
html { scrollbar-gutter: stable; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body.is-tab { background: #fff; }
h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 600; text-wrap: balance; }
h1 { font-size: 18px; line-height: 1.3; }
h2 { font-size: 15px; line-height: 1.35; }
p { margin: 0 0 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.pad { padding: 20px; }
.tn { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sub { display: block; font-size: 12.5px; color: var(--muted); }

/* --- каркас */
.app { max-width: 1080px; margin: 0 auto; padding: 18px 20px 36px; }
.is-tab .app { max-width: 860px; padding: 14px 16px 24px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.head .grow { flex: 1; min-width: 200px; }
.head .state { font-size: 13px; color: var(--muted); text-align: right; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 16px; overflow-x: auto; }
.tab { appearance: none; border: 0; background: none; font: inherit; color: var(--muted); padding: 9px 12px; cursor: pointer; white-space: nowrap;
    border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .18s, border-color .18s; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.tab .cnt { color: var(--faint); font-weight: 400; margin-left: 4px; }
.fade { animation: fadeUp .28s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 12px; }
.panel > .sec { padding: 14px 18px; }
.panel > .sec + .sec { border-top: 1px solid var(--line); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 12px; }
.toolbar .grow { flex: 1; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.foot { color: var(--faint); font-size: 12px; margin-top: 16px; text-align: center; }
.foot a { color: var(--muted); }

/* --- кнопки и переключатели */
.btn { appearance: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
    font: inherit; font-weight: 500; padding: 7px 14px; border-radius: 8px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line2); }
.btn.ghost:hover { border-color: var(--muted); color: var(--ink); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.link { background: none; border-color: transparent; color: var(--accent); padding: 4px 6px; font-weight: 400; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.btn:focus-visible, .seg button:focus-visible, .tab:focus-visible, .num-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { appearance: none; border: 0; border-left: 1px solid var(--line2); background: #fff; font: inherit; font-size: 13px; color: var(--text);
    padding: 6px 12px; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--soft); }
.seg button.on { background: var(--accent-l); color: var(--accent-d); font-weight: 500; }
.in { font: inherit; color: var(--ink); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 117, 255, .14); }
textarea.in { width: 100%; min-height: 72px; resize: vertical; line-height: 1.45; }
.chk { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; color: var(--ink); }
.chk input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.chk span small { display: block; color: var(--muted); font-size: 12.5px; }

/* --- статусы: точка и текст */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line2); flex: none; }
.dot.ok { background: var(--ok-dot); } .dot.bad { background: var(--bad-dot); } .dot.wait { background: var(--wait-dot); } .dot.warn { background: var(--warn-dot); }
.st { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 13px; color: var(--muted); }
.st.ok { color: var(--ok); } .st.bad { color: var(--bad); }

/* --- лента дат */
.day { margin: 0 0 14px; }
.day-h { display: flex; align-items: baseline; gap: 10px; padding: 0 2px 6px; }
.day-h b { color: var(--ink); font-weight: 600; font-size: 14px; }
.day-h span { color: var(--muted); font-size: 13px; }
.day-h .today { color: var(--accent-d); }
.ev { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) 150px auto; gap: 6px 16px; align-items: center; padding: 10px 16px; }
.ev + .ev, .ev-more + .ev { border-top: 1px solid var(--line); }
.ev .who { min-width: 0; }
.ev .who a { color: var(--ink); font-weight: 500; }
.ev .who a:hover { color: var(--accent); }
.ev .sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .what { font-size: 13.5px; color: var(--text); }
.ev .what b { font-weight: 500; color: var(--ink); }
.ev-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s var(--ease); }
.ev-more.open { grid-template-rows: 1fr; }
.ev-more > div { overflow: hidden; min-height: 0; opacity: 0; transition: opacity .25s var(--ease); }
.ev-more.open > div { opacity: 1; }
.greet { margin: 0 16px 12px; padding: 12px 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; }
.greet p { margin: 0 0 10px; white-space: pre-wrap; color: var(--ink); }
.greet .row { gap: 10px; }
.copied { color: var(--ok); font-size: 13px; }
@media (max-width: 760px) {
    .ev { grid-template-columns: 1fr auto; }
    .ev .what { grid-column: 1 / -1; order: 3; }
    .ev .st { order: 4; }
}

.empty { padding: 26px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-weight: 500; margin-bottom: 4px; }

/* --- предупреждение */
.alert { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-l); border: 1px solid var(--warn-line); border-radius: var(--r); padding: 11px 14px; margin: 0 0 12px; color: var(--ink); }
.alert svg { flex: none; width: 18px; height: 18px; color: var(--warn); margin-top: 1px; }
.alert b { display: block; color: var(--warn); font-weight: 600; }

/* --- таблицы */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 13px; white-space: nowrap; background: var(--soft); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tw { overflow-x: auto; }
tfoot td { font-weight: 600; color: var(--ink); background: var(--soft); border-top: 1px solid var(--line); }
.num-btn { appearance: none; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.num-btn:hover { background: var(--accent-l); color: var(--accent-d); }
.num-btn.on { background: var(--accent-l); color: var(--accent-d); font-weight: 600; }
.num-btn.zero { color: var(--faint); cursor: default; }
.num-btn.zero:hover { background: none; color: var(--faint); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 70px; }
.bar i { display: block; height: 100%; background: var(--ok-dot); }

/* --- настройки: подпись слева, управление справа */
.frow { display: grid; grid-template-columns: 240px 1fr; gap: 16px; padding: 14px 18px; }
.frow + .frow { border-top: 1px solid var(--line); }
.frow .lbl b { display: block; color: var(--ink); font-weight: 600; }
.frow .lbl span { font-size: 13px; color: var(--muted); }
.fctl { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.fctl.wide { align-items: stretch; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.inline .cs { width: auto; min-width: 180px; }
.hint { font-size: 13px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tagb { appearance: none; border: 1px solid var(--line2); background: #fff; border-radius: 6px; font: inherit; font-size: 12.5px; color: var(--text); padding: 2px 8px; cursor: pointer; transition: border-color .15s, color .15s; }
.tagb:hover { border-color: var(--accent); color: var(--accent-d); }
.sample { font-size: 13px; color: var(--muted); border-left: 2px solid var(--line2); padding: 2px 0 2px 10px; white-space: pre-wrap; }
.custom { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.custom .inline .in.title { flex: 1; min-width: 160px; }
.savebar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--soft); border-radius: 0 0 var(--r) var(--r); flex-wrap: wrap; }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
@media (max-width: 680px) { .frow { grid-template-columns: 1fr; gap: 8px; } }

/* --- вкладка клиента */
.dates { display: flex; flex-direction: column; }
.date-card { padding: 14px 16px; }
.date-card + .date-card { border-top: 1px solid var(--line); }
.date-card .top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.date-card .top b { color: var(--ink); font-weight: 600; }
.date-card .when { font-size: 13.5px; color: var(--muted); }
.date-card .when.soon { color: var(--accent-d); font-weight: 500; }
.date-card .greet { margin: 10px 0 0; }

/* --- строка просьбы об оценке */
.rate { font-size: 12px; color: var(--faint); text-align: center; margin-top: 14px; }
.rate a { color: var(--muted); }
.rate .sep { margin: 0 6px; }

/* --- свои выпадающие списки (assets/app-select.js из скила bitrix24-app) */
.cs { position: relative; width: 100%; }
.cs > select { display: none; }
.cs-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; min-height: 34px; }
.cs-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cs-btn > svg { color: var(--muted); width: 14px; height: 14px; flex: none; transition: transform .15s ease; }
.cs-btn:hover { border-color: var(--faint); }
.cs-btn:focus-visible, .cs-btn[aria-expanded=true] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 117, 255, .14); }
.cs-btn[aria-expanded=true] > svg { transform: rotate(180deg); }
.cs-sub { color: var(--muted); }
#cs-pop { position: absolute; z-index: 1000; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; max-height: 300px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 28px rgba(31, 35, 41, .12); opacity: 0; transform: translateY(-4px) scale(.98); transition: opacity .14s ease, transform .14s ease; }
#cs-pop.on { opacity: 1; transform: none; }
.cs-opt { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.cs-opt > svg { visibility: hidden; width: 14px; height: 14px; color: var(--accent); flex: none; }
.cs-opt.sel > svg { visibility: visible; }
.cs-opt.sel { font-weight: 500; }
.cs-opt.act { background: var(--soft); }
.cs-list { overflow: auto; min-height: 0; position: relative; }
.cs-search { display: flex; align-items: center; gap: 8px; padding: 4px 8px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); flex: none; }
.cs-search > svg { color: var(--muted); width: 14px; height: 14px; }
.cs-search input, .cs-search input:focus { border: 0; padding: 6px 0; box-shadow: none; background: transparent; font: inherit; font-size: 13px; outline: none; width: 100%; }
.cs-empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* --- окно подтверждения */
.modal-bg { position: fixed; inset: 0; background: rgba(31, 35, 41, .35); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 900; opacity: 0; transition: opacity .2s var(--ease); }
.modal-bg.on { opacity: 1; }
.modal { background: #fff; border-radius: 12px; max-width: 720px; width: 100%; max-height: 80vh; display: flex; flex-direction: column; transform: translateY(-6px) scale(.98); transition: transform .22s var(--ease); }
.modal-bg.on .modal { transform: none; }
.modal .mh { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal .mb { padding: 12px 18px; overflow: auto; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
