/* Relay staff console. Builds on relay.css tokens. */
body.app { display: grid; grid-template-columns: 76px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.muted { color: var(--muted); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); flex: none; transition: background-color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--bg-2); } }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.fine { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.p-you { background: var(--ink); color: var(--surface); }
.p-wait { background: var(--gold-soft); color: var(--gold); }
.p-neutral { background: var(--bg-2); color: var(--ink-2); }
.p-paid { background: #DDEBD3; color: #35591C; }

/* Rail */
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 16px 8px; background: var(--surface); border-right: 1px solid var(--line); z-index: 40; }
.rail-brand { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; }
.rail-nav { display: grid; gap: 4px; width: 100%; }
.rail-nav a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 14px; font-size: 11px; font-weight: 600; color: var(--muted); transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
.rail-nav a:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .rail-nav a:hover { background: var(--bg); color: var(--ink); } }
.rail-nav a[aria-current='page'] { background: var(--accent-soft); color: var(--accent-deep); }
.rail-badge { position: absolute; top: 5px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--clay); color: #fff; font-size: 10.5px; display: grid; place-items: center; }

/* Shell + topbar */
.shell { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 64px; padding: 10px clamp(14px, 2vw, 24px); background: rgba(242,235,223,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ws { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.ws-pick { position: relative; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 34px 0 5px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.ws-pick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ws-av { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.ws-pick select { appearance: none; -webkit-appearance: none; border: 0; background: none; font-weight: 600; font-size: 14.5px; outline: none; cursor: pointer; min-width: 0; max-width: 260px; text-overflow: ellipsis; }
.ws-caret { position: absolute; right: 12px; pointer-events: none; color: var(--muted); }
.demo-pill { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 18px; }
.top-date { font-size: 12px; color: var(--muted); }
.top-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--accent-deep); }
.top-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.top-db { color: var(--muted); }

.view-host { min-width: 0; flex: 1; outline: none; }
.view:not(.view-inbox) { padding: 22px clamp(14px, 2.4vw, 32px) 48px; }
.v-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.v-kicker { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.v-title { font-family: var(--font-display); font-weight: 600; font-size: 34px; letter-spacing: -.03em; line-height: 1.1; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); transition: background-color var(--t-fast) ease, color var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
.chip span { font-size: 11.5px; color: var(--muted); }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip[aria-pressed='true'] span { color: rgba(252,250,245,.7); }
@media (hover: hover) and (pointer: fine) { .chip:hover:not([aria-pressed='true']) { border-color: var(--line-2); color: var(--ink); } }

/* Inbox */
.view-inbox { position: relative; display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; height: calc(100vh - var(--top-h, 64px)); height: calc(100dvh - var(--top-h, 64px)); overflow: hidden; }
.view-inbox[hidden] { display: none; }
.ib-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.ib-list-head { padding: 18px 16px 12px; display: grid; gap: 12px; border-bottom: 1px solid var(--line); }
.ib-list-head .v-title { font-size: 28px; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--bg); border: 1px solid transparent; color: var(--muted); transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; outline: 0; background: none; width: 100%; font-size: 14px; color: var(--ink); }
.ib-list .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.ib-list .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; }
.convs { flex: 1; overflow-y: auto; padding: 6px; }
.conv { width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 11px; padding: 11px 10px; border-radius: 14px; text-align: left; transition: background-color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .conv:hover { background: var(--bg); } }
.conv.is-active { background: var(--accent-soft); }
.cv-av, .th-av { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--bg-2); color: var(--ink-2); flex: none; }
.av-staff { background: var(--clay-soft); color: var(--clay); }
.av-relay { background: #DCEAE6; color: var(--accent-deep); }
.av-booked { background: #E3E0F1; color: #463D86; }
.av-paid { background: #DDEBD3; color: #35591C; }
.av-you { background: var(--ink); color: var(--surface); }
.cv-main { display: grid; gap: 3px; min-width: 0; }
.cv-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cv-top b { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-top time { font-size: 11px; color: var(--muted); flex: none; }
.cv-prev { display: flex; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.cv-prev > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cv-who { flex: none; color: var(--ink-2); font-weight: 500; }
.cv-who:empty { display: none; }
.cv-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 3px; }
.cv-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--clay); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

.ib-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; background-color: #EFE7D9; background-image: radial-gradient(rgba(27,36,34,.055) 1px, transparent 1.3px); background-size: 18px 18px; }
.ib-thread[hidden] { display: none; }
.th-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.th-back { display: none; }
.th-who { min-width: 0; flex: 1; }
.th-who h2 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-who p { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-actions { display: flex; gap: 8px; flex: none; }
.th-info { display: none; }
.th-banner { padding: 10px 18px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.bn-staff { background: #F8E6DB; color: #6E2E12; }
.bn-you { background: var(--ink); color: var(--surface); }
.th-msgs { flex: 1; overflow-y: auto; padding: 18px clamp(14px, 3vw, 40px); display: flex; flex-direction: column; gap: 8px; }
.day-sep { align-self: center; font-size: 11.5px; color: var(--ink-2); background: rgba(252,250,245,.85); padding: 3px 10px; border-radius: 999px; margin-bottom: 4px; }
.bub { max-width: min(72%, 520px); padding: 8px 12px 6px; border-radius: 16px; font-size: 14.5px; line-height: 1.45; transition: opacity 260ms var(--ease-out), transform 320ms var(--ease-out); }
.bub[data-enter] { opacity: 0; transform: translateY(8px) scale(.98); }
.bub-in { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 5px; box-shadow: 0 1px 1px rgba(27,36,34,.06); }
.bub-out { align-self: flex-end; background: #D5E8E3; border-bottom-right-radius: 5px; }
.bub-out.staff { background: var(--ink); color: var(--surface); }
.bub-out.tpl { background: var(--surface); border: 1px dashed var(--accent); }
.bub-by { display: block; font-size: 11px; font-weight: 700; color: var(--accent-deep); margin-bottom: 1px; letter-spacing: .01em; }
.bub-out.staff .bub-by { color: #9FD4CD; }
.bub-gloss { display: block; margin-top: 3px; font-size: 12.5px; font-style: italic; color: var(--muted); }
.bub-out.staff .bub-gloss { color: rgba(252,250,245,.7); }
.bub time { display: block; text-align: right; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.bub-out.staff time { color: rgba(252,250,245,.6); }
.ev { align-self: center; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); background: rgba(252,250,245,.9); padding: 4px 11px; border-radius: 999px; max-width: 92%; text-align: center; transition: opacity 260ms var(--ease-out), transform 320ms var(--ease-out); }
.ev[data-enter] { opacity: 0; transform: translateY(6px); }
.ev time { font-size: 10.5px; color: var(--muted); }
.composer { padding: 10px 18px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.comp-note { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.comp-row { display: flex; gap: 8px; }
.comp-row input { flex: 1; min-width: 0; height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); font-size: 14.5px; outline: none; transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease; }
.comp-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.comp-row input:disabled { cursor: not-allowed; color: var(--muted); }
.comp-row .btn { height: 42px; }

.ib-info { min-height: 0; overflow-y: auto; padding: 18px; background: var(--surface); border-left: 1px solid var(--line); display: grid; align-content: start; gap: 16px; }
.in-head { display: flex; justify-content: space-between; align-items: center; }
.in-head h2 { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.in-close { display: none; }
.in-who { display: flex; gap: 12px; align-items: center; }
.in-name { font-weight: 600; font-size: 16px; }
.in-phone { font-size: 12px; color: var(--muted); }
.in-rows { margin: 0; display: grid; gap: 0; }
.in-rows div { display: grid; grid-template-columns: 92px 1fr; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.in-rows dt { color: var(--muted); }
.in-rows dd { margin: 0; }
.in-card { padding: 14px; border-radius: 14px; background: var(--bg); display: grid; gap: 3px; font-size: 13.5px; }
.in-card .btn { margin-top: 8px; justify-self: start; }
.in-k { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.in-big { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -.02em; }
.in-ok { color: #35591C; font-weight: 600; }
.in-wait { color: var(--gold); font-weight: 600; }
.in-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.in-fine { font-size: 12px; color: var(--muted); }

/* Calendar */
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-relay { background: var(--accent); }
.lg-staff { background: #8C8375; }
.lg-paid { background: #6B9A45; }
.week { border-radius: 18px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.wk-head, .wk-body { display: grid; grid-template-columns: 58px repeat(7, minmax(0, 1fr)); }
.wk-head { border-bottom: 1px solid var(--line); }
.wk-head span { padding: 10px 10px; font-size: 13px; color: var(--muted); border-left: 1px solid var(--line); }
.wk-head span:first-child { border-left: 0; }
.wk-head b { color: var(--ink); font-weight: 600; margin-right: 2px; }
.wk-head .is-today { color: var(--accent-deep); background: var(--accent-soft); }
.wk-head .is-today b { color: var(--accent-deep); }
.wk-body { --hh: 64px; }
.wk-hours { display: grid; grid-template-rows: repeat(var(--rows), var(--hh)); }
.wk-hours span { font-size: 10.5px; color: var(--muted); padding: 3px 8px 0 0; text-align: right; }
.wk-col { position: relative; height: calc(var(--rows) * var(--hh)); border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% var(--hh); }
.wk-col.is-today { background-color: rgba(210,230,225,.3); }
.now { position: absolute; left: -1px; right: 0; top: calc(var(--top) * var(--hh)); height: 2px; background: var(--clay); z-index: 2; }
.now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--clay); }
.bk { text-align: left; color: var(--ink); }
.wk-col .bk { position: absolute; top: calc(var(--top) * var(--hh) + 1px); height: calc(var(--h) * var(--hh) - 3px); min-height: 22px; left: calc(var(--lane) / var(--lanes) * 100% + 3px); width: calc(100% / var(--lanes) - 6px); padding: 4px 7px; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; gap: 0; font-size: 12px; line-height: 1.3; transition: transform var(--t-press) var(--ease-out), box-shadow var(--t-fast) ease; }
.wk-col .bk:focus-visible, .ag-list .bk:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.bk-relay { background: #D5E8E3; border-left: 3px solid var(--accent); color: var(--ink); }
.bk-staff { background: var(--bg-2); border-left: 3px solid #8C8375; color: var(--ink); }
.wk-col .bk b, .ag-list .bk b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-t { font-size: 10.5px; color: var(--ink-2); }
.bk-s { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-width: 0; }
.bk-paid-tag { flex: none; padding: 0 5px; border-radius: 5px; background: #DDEBD3; color: #35591C; font-size: 10.5px; font-weight: 600; line-height: 1.5; }
.wk-col .bk-sm .bk-s { display: none; }
.wk-col .bk-xs { flex-direction: row; align-items: center; gap: 6px; padding: 2px 7px; }
.wk-col .bk-xs .bk-top { flex: none; }
.wk-col .bk-xs .bk-s, .wk-col .bk-xs .bk-paid-tag { display: none; }
.wk-col .bk-xs b { min-width: 0; }
@media (hover: hover) and (pointer: fine) { .wk-col .bk:hover, .ag-list .bk:hover { box-shadow: 0 6px 16px -8px rgba(27,36,34,.4); } }
.wk-col .bk:active, .ag-list .bk:active { transform: scale(.97); }
.day-tabs, .agenda { display: none; }
.day-tabs { gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; }
.day-tabs button { flex: 1 0 44px; display: grid; justify-items: center; padding: 8px 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.day-tabs button b { font-size: 17px; color: var(--ink); font-weight: 600; }
.day-tabs button[aria-selected='true'] { background: var(--ink); border-color: var(--ink); color: rgba(252,250,245,.75); }
.day-tabs button[aria-selected='true'] b { color: var(--surface); }
.ag-day { font-weight: 600; margin-bottom: 10px; }
.ag-list { display: grid; gap: 8px; }
.ag-list .bk { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; font-size: 14px; }
.ag-list .bk-t { font-size: 12px; }

/* Drawer */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(15,42,43,.32); opacity: 0; transition: opacity 280ms ease; }
.scrim[data-open] { opacity: 1; }
.drawer { position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(440px, 100%); display: flex; flex-direction: column; background: var(--surface); box-shadow: -30px 0 80px -30px rgba(15,42,43,.45); transform: translateX(100%); visibility: hidden; transition: transform 380ms var(--ease-drawer), visibility 0s 380ms; outline: none; }
.drawer[data-open] { transform: none; visibility: visible; transition: transform 380ms var(--ease-drawer), visibility 0s; }
.dr-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dr-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.dr-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: grid; align-content: start; gap: 18px; }
.dr-rows { margin: 0; }
.dr-rows div { display: grid; grid-template-columns: 100px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.dr-rows dt { color: var(--muted); }
.dr-rows dd { margin: 0; }
.dr-chat { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; background: #EFE7D9; }
.dr-chat .bub { max-width: 90%; font-size: 13.5px; }
.dr-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pf { display: grid; gap: 14px; }
.pf label:not(.radio) { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.pf input:not([type='radio']), .kn-fields input, .svc-row input, .faq-row input, .faq-row textarea, .kn-area textarea, .kt-form input {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; font-weight: 400; color: var(--ink); outline: none; transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.faq-row textarea, .kn-area textarea { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.45; font-family: inherit; }
.pf input:focus, .kn-fields input:focus, .svc-row input:focus, .faq-row input:focus, .faq-row textarea:focus, .kn-area textarea:focus, .kt-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pf fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.pf legend { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.radio { position: relative; display: inline-flex; }
.radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.radio span { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); font-size: 14px; transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease; }
.radio input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); font-weight: 600; }
.radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pf-err { color: var(--clay); font-size: 13px; font-weight: 600; }

/* Payments */
.pay-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 18px 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 2px; }
.kpi p { font-size: 13px; color: var(--muted); }
.kpi b { font-family: var(--font-display); font-weight: 600; font-size: 36px; letter-spacing: -.03em; line-height: 1.15; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.view-pay .chips { margin-bottom: 12px; }
.pay-table-wrap { border-radius: 18px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.pay-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pay-table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.pay-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pay-table tr:last-child td { border-bottom: 0; }
.pay-table .num { text-align: right; }
.pay-table td b { font-weight: 600; }
.pay-table .mono { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.sub-ref { display: block; font-size: 11px !important; color: var(--muted) !important; }
.pay-table .act { text-align: right; width: 1%; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .pay-table tbody tr:hover { background: #FAF6EE; } }

/* Knowledge */
.kn-save { display: flex; align-items: center; gap: 12px; }
.kn-dirty { font-size: 13px; color: var(--gold); font-weight: 600; }
.kn-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.kn-forms { display: grid; gap: 14px; }
.kn-sec { padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.kn-sec h2 { font-size: 16px; font-weight: 600; margin-bottom: 14px; letter-spacing: -.01em; }
.kn-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kn-fields label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kn-fields .span2 { grid-column: 1 / -1; }
.svc-head, .svc-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 90px 34px; gap: 8px; align-items: center; }
.svc-head { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.svc-list, .faq-ed { display: grid; gap: 8px; }
.faq-row { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 6px 8px; padding: 12px; border-radius: 14px; background: var(--bg); }
.faq-row label:nth-child(2) { grid-column: 1; }
.faq-row .icon-btn { grid-column: 2; grid-row: 1; }
.add-btn { margin-top: 10px; color: var(--accent-deep); }
.toggles { display: grid; gap: 4px; }
.toggles-row { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tog { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 14px; cursor: pointer; }
.tog input { position: absolute; opacity: 0; width: 38px; height: 22px; margin: 0; cursor: pointer; }
.tog-ui { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--bg-3); transition: background-color 200ms ease; }
.tog-ui::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 220ms var(--ease-out); }
.tog input:checked + .tog-ui { background: var(--accent); }
.tog input:checked + .tog-ui::after { transform: translateX(16px); }
.tog input:focus-visible + .tog-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.tog em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 4px; }

.kn-test { position: sticky; top: 84px; }
.kt-card { border-radius: 20px; background: #EFE7D9; background-image: radial-gradient(rgba(27,36,34,.055) 1px, transparent 1.3px); background-size: 16px 16px; border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.kt-card header { padding: 16px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.kt-card h2 { font-size: 16px; font-weight: 600; }
.kt-card header p { font-size: 13px; color: var(--muted); }
.kt-msgs { min-height: 240px; max-height: 380px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.kt-msgs .bub { max-width: 88%; font-size: 14px; }
.kt-msgs .bub-in { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; border-bottom-left-radius: 16px; }
.kt-msgs .bub-out { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 5px; border-bottom-right-radius: 16px; }
.kt-msgs .bub-hand { border: 1px solid var(--clay); }
.kt-src { display: block; margin-top: 5px; font-size: 10.5px; color: var(--accent-deep); letter-spacing: .02em; }
.bub-hand .kt-src { color: var(--clay); }
.kt-hint { margin: auto 0; font-size: 13px; color: var(--ink-2); text-align: center; padding: 20px 10px; }
.kt-typing { margin: 0; }
.kt-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px; }
.kt-form { display: flex; gap: 8px; padding: 12px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.kt-form .btn { height: 40px; }

/* Responsive */
@media (max-width: 1279px) {
  .view-inbox { grid-template-columns: 320px minmax(0, 1fr); }
  .th-info { display: inline-flex; }
  .ib-info { position: absolute; z-index: 5; top: 0; right: 0; bottom: 0; width: min(340px, 100%); box-shadow: -24px 0 60px -30px rgba(15,42,43,.45); transform: translateX(100%); visibility: hidden; transition: transform 320ms var(--ease-drawer), visibility 0s 320ms; }
  .view-inbox[data-info-open] .ib-info { transform: none; visibility: visible; transition: transform 320ms var(--ease-drawer), visibility 0s; }
  .in-close { display: grid; }
  .kn-grid { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 1100px) {
  .top-date { display: none; }
  .kn-grid { grid-template-columns: 1fr; }
  .kn-test { position: static; }
}
@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; padding-bottom: 68px; }
  .rail { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); z-index: 60; }
  .rail-brand { display: none; }
  .rail-nav { grid-auto-flow: column; grid-auto-columns: 1fr; }
  .rail-nav a { padding: 7px 2px 6px; }
  .rail-badge { right: calc(50% - 22px); top: 3px; }
  .topbar { padding: 8px 14px; min-height: 0; }
  .top-status { display: none; }
  .view-inbox { grid-template-columns: 1fr; height: calc(100dvh - var(--top-h, 64px) - 68px); }
  .ib-thread { display: none; }
  .view-inbox[data-open] .ib-list { display: none; }
  .view-inbox[data-open] .ib-thread:not([hidden]) { display: flex; }
  .th-back { display: grid; margin-left: -6px; }
  .th-head { padding: 10px 12px; gap: 8px; }
  .th-av { width: 36px; height: 36px; }
  .bub { max-width: 86%; }
  .week { display: none; }
  .day-tabs { display: flex; }
  .agenda { display: block; }
  .cal-legend { font-size: 12px; }
  .pay-kpis { grid-template-columns: 1fr 1fr; }
  .pay-kpis .kpi:last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .pay-table-wrap { background: none; border: 0; border-radius: 0; overflow: visible; }
  .pay-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pay-table, .pay-table tbody { display: block; }
  .pay-table tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; margin-bottom: 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
  .pay-table td { padding: 0; border: 0; }
  .pay-table td[data-l='Customer'] { grid-column: 1; }
  .pay-table td[data-l='Amount'] { grid-column: 2; grid-row: 1; font-size: 16px; }
  .pay-table td[data-l='For'] { grid-column: 1 / -1; color: var(--ink-2); }
  .pay-table td[data-l='Method'] { grid-column: 1; font-size: 13px; color: var(--muted); }
  .pay-table td[data-l='Status'] { grid-column: 2; grid-row: 3; text-align: right; }
  .pay-table td[data-l='Sent'] { grid-column: 1; font-size: 12px !important; }
  .pay-table td.act { grid-column: 2; grid-row: 4; width: auto; }
  .kn-fields { grid-template-columns: 1fr; }
  .svc-head, .svc-row { grid-template-columns: minmax(0, 1fr) 84px 64px 34px; gap: 6px; }
  .v-title { font-size: 28px; }
  .top-db { display: none; }
}
@media (max-width: 480px) {
  .hide-xs { display: none; }
  .th-who p { display: none; }
  .th-actions { gap: 6px; }
  .ws-pick select { max-width: 200px; font-size: 14px; }
  .th-actions .btn-sm { padding: 0 10px; font-size: 13px; }
  .kpi b { font-size: 28px; }
  .svc-head { display: none; }
  .svc-row { grid-template-columns: 1fr 1fr 34px; padding: 10px; border-radius: 12px; background: var(--bg); }
  .svc-row label:first-child { grid-column: 1 / -1; }
  .svc-row .icon-btn { grid-column: 3; grid-row: 1; }
  .svc-row label:first-child { grid-column: 1 / 3; }
}
[data-takeover] { gap: 0; }
