:root {
  --navy-950: #0b1b2d;
  --navy-900: #10263f;
  --navy-800: #173653;
  --teal-700: #087b74;
  --teal-600: #0c9187;
  --teal-100: #dff5f1;
  --teal-50: #effaf8;
  --ink: #172b3f;
  --muted: #647487;
  --line: #dfe6eb;
  --surface: #ffffff;
  --canvas: #f4f7f8;
  --danger: #b53a3a;
  --danger-bg: #fff0ef;
  --warning: #9a6108;
  --warning-bg: #fff6df;
  --success: #19714e;
  --success-bg: #e9f7ef;
  --shadow: 0 12px 34px rgba(19, 43, 65, .08);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(12, 145, 135, .35); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 10px; left: 10px; padding: 10px 16px; transform: translateY(-150%); background: var(--surface); border-radius: 8px; }
.skip-link:focus { transform: none; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, .95fr) 1.25fr; background: var(--surface); }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(40px, 7vw, 96px); color: #fff; background: linear-gradient(145deg, var(--navy-950), #123c53 72%, #0a6b68); }
.login-brand::after { content: ""; position: absolute; width: 430px; height: 430px; right: -180px; bottom: -170px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.02); }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 11px; color: #fff; background: var(--teal-600); font-size: 13px; font-weight: 800; letter-spacing: -.04em; }
.brand-mark--large { width: 52px; height: 52px; }
.brand-logo { display: block; width: auto; height: auto; object-fit: contain; }
.brand-logo--login { position: relative; z-index: 1; width: min(220px, 48%); max-height: 160px; margin-bottom: 8px; border-radius: 16px; background: #f7f4ee; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.brand-logo--mobile { width: 120px; max-height: 88px; border-radius: 12px; background: #f7f4ee; padding: 6px; }
.brand-logo--sidebar { width: 100%; max-height: 56px; }
.sidebar__logo-plate { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-width: 0; padding: 8px 10px; border-radius: 12px; background: #f7f4ee; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.nav-subhead { margin: 12px 12px 4px; color: #61798c; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; pointer-events: none; }
.login-brand h1 { max-width: 620px; margin: 18px 0; font-size: clamp(34px, 4.2vw, 64px); line-height: 1.06; letter-spacing: -.045em; }
.login-brand__copy { max-width: 540px; color: #bad0dc; font-size: 18px; line-height: 1.7; }
.login-brand__foot { position: relative; z-index: 1; color: #94acba; font-size: 13px; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(100%, 440px); }
.login-card h2 { margin: 8px 0 8px; font-size: 32px; letter-spacing: -.035em; }
.login-card > .muted { margin-bottom: 34px; }
.mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 48px; }
.login-help { margin: 24px 0 0; text-align: center; color: var(--muted); font-size: 13px; }

.app { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 252px; padding: 26px 18px 18px; color: #c5d3de; background: var(--navy-950); }
.sidebar__brand { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 10px 26px; color: #fff; }
.sidebar__brand strong { display: block; line-height: 1.1; font-size: 15px; }
.sidebar__brand span { display: block; margin-top: 4px; color: #8197a8; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.nav-list { display: grid; gap: 5px; }
.nav-list a { display: flex; align-items: center; gap: 13px; min-height: 46px; padding: 0 13px; text-decoration: none; border-radius: 9px; color: #a9bbc8; font-size: 14px; font-weight: 600; }
.nav-list a:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-list a[aria-current="page"] { color: #fff; background: rgba(19, 161, 149, .18); box-shadow: inset 3px 0 var(--teal-600); }
.nav-icon { width: 20px; color: #84a0b1; text-align: center; font-size: 20px; }
.nav-badge { min-width: 21px; margin-left: auto; padding: 2px 6px; border-radius: 12px; color: #fff; background: var(--teal-600); text-align: center; font-size: 11px; }
.nav-section { margin-top: 28px; }
.nav-section > p { margin: 0 13px 10px; color: #61798c; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.phase-card { margin-top: auto; padding: 16px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.035); }
.phase-card__label { color: #74cec4; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.phase-card strong { display: block; margin-top: 7px; color: #dbe6ed; font-size: 13px; }
.phase-card p { margin: 7px 0 0; color: #7890a1; font-size: 11px; line-height: 1.5; }
.sidebar__footer { display: flex; align-items: center; gap: 8px; padding: 18px 10px 0; color: #70899b; font-size: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #e2a33e; box-shadow: 0 0 0 3px rgba(226,163,62,.12); }

.workspace { min-height: 100vh; margin-left: 252px; padding-bottom: 34px; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; height: 72px; padding: 0 clamp(24px, 3.5vw, 52px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.global-search { display: flex; align-items: center; gap: 10px; width: min(420px, 45vw); color: #82909d; }
.global-search input { width: 100%; padding: 10px 3px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.global-search kbd { padding: 2px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--canvas); font-size: 11px; }
.topbar__actions { display: flex; align-items: center; gap: 15px; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); }
.icon-button:hover { background: var(--canvas); }
.icon-button--dark { margin-left: auto; color: #fff; border-color: rgba(255,255,255,.15); background: transparent; }
.attention-button { position: relative; font-size: 22px; }
.attention-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; padding: 2px 5px; border: 2px solid #fff; border-radius: 10px; color: #fff; background: var(--danger); font-size: 9px; }
.profile { position: relative; }
.profile__button { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border: 0; border-radius: 10px; background: transparent; }
.profile__button:hover { background: var(--canvas); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: #fff; background: linear-gradient(145deg, #27607b, var(--teal-600)); font-size: 12px; font-weight: 800; }
.profile__text { min-width: 110px; text-align: left; }
.profile__text strong, .profile__text small { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile__text strong { font-size: 13px; }.profile__text small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.profile-menu { position: absolute; top: calc(100% + 9px); right: 0; width: 235px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.profile-menu p { margin: 4px 8px 12px; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.profile-menu button { width: 100%; padding: 10px; border: 0; border-radius: 8px; color: var(--danger); background: var(--danger-bg); text-align: left; }
.content { padding: 38px clamp(24px, 3.5vw, 52px) 50px; }
.dev-notice { position: fixed; z-index: 15; right: 18px; bottom: 14px; padding: 7px 11px; border: 1px solid #d8e0e5; border-radius: 7px; color: #657786; background: rgba(255,255,255,.94); box-shadow: 0 3px 12px rgba(20,40,60,.07); font-size: 10px; }
.dev-notice span { color: #d89b36; }
.mobile-only { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head h1 { margin: 5px 0 0; font-size: clamp(26px, 3vw, 36px); letter-spacing: -.04em; }
.page-head p { margin: 7px 0 0; }
.eyebrow { margin: 0; color: var(--teal-700); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
.eyebrow--light { color: #62c2b8; }
.muted { color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); font-weight: 700; font-size: 13px; text-decoration: none; }
.button:hover { border-color: #bdcbd4; background: #fafcfc; }
.button--primary { color: #fff; border-color: var(--teal-700); background: var(--teal-700); }
.button--primary:hover { border-color: var(--teal-600); background: var(--teal-600); }
.button--danger { color: var(--danger); border-color: #efcccc; background: var(--danger-bg); }
.button--wide { width: 100%; min-height: 48px; }
.button:disabled { cursor: wait; opacity: .55; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { min-height: 140px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 15px rgba(25,48,67,.035); }
.metric-card__top { display: flex; align-items: center; justify-content: space-between; }
.metric-card__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--teal-700); background: var(--teal-50); }
.metric-card__value { display: block; margin-top: 17px; font-size: 29px; line-height: 1; letter-spacing: -.035em; }
.metric-card__label { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; }
.metric-card--attention { border-color: #efd9b3; }
.metric-card--unavailable .metric-card__value { color: var(--muted); font-size: 17px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 20px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 18px rgba(25,48,67,.035); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel__head h2, .panel__head h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.panel__body { padding: 22px; }
.attention-list { display: grid; gap: 13px; }
.attention-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px; border-radius: 10px; background: var(--canvas); }
.attention-item strong { display: block; margin-bottom: 3px; font-size: 13px; }
.attention-item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.tabs { display: flex; gap: 5px; margin-bottom: 20px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #eaf0f2; width: fit-content; }
.tabs a { padding: 9px 17px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: 0 2px 7px rgba(20,44,63,.08); }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 210px)) auto; gap: 10px; margin-bottom: 16px; }
.search-field { position: relative; }
.search-field span { position: absolute; top: 50%; left: 13px; transform: translateY(-50%); color: var(--muted); }
.search-field input { padding-left: 38px; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #ccd7de; border-radius: 8px; color: var(--ink); background: #fff; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal-600); outline: 3px solid rgba(12,145,135,.11); }
.field { display: grid; gap: 7px; margin-bottom: 17px; color: #32495c; font-size: 12px; font-weight: 700; }
.field small { color: var(--muted); font-weight: 400; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 90px; }
.input-action { position: absolute; top: 50%; right: 7px; transform: translateY(-50%); padding: 6px 8px; border: 0; color: var(--teal-700); background: transparent; font-size: 11px; font-weight: 700; }
.form-alert { margin-bottom: 17px; padding: 11px 13px; border: 1px solid #efc8c5; border-radius: 8px; color: #8f2f2f; background: var(--danger-bg); font-size: 12px; line-height: 1.5; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.checkbox { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 13px; }
.checkbox input { width: 17px; min-height: 17px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; color: #718090; background: #f7f9fa; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
td { padding: 15px 16px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #f9fbfb; }
.row-link { color: var(--ink); font-weight: 750; text-decoration: none; }
.row-link:hover { color: var(--teal-700); text-decoration: underline; }
.cell-main { display: block; font-weight: 700; }.cell-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; color: #506272; background: #edf1f3; font-size: 10px; font-weight: 800; white-space: nowrap; }
.pill--new, .pill--in_progress, .pill--executing { color: #08776f; background: var(--teal-100); }
.pill--waiting, .pill--waiting_client, .pill--waiting_internal { color: var(--warning); background: var(--warning-bg); }
.pill--processed, .pill--completed { color: var(--success); background: var(--success-bg); }
.pill--irrelevant, .pill--duplicate, .pill--cancelled { color: var(--danger); background: var(--danger-bg); }
.priority-high { color: var(--danger); font-weight: 750; }.priority-low { color: var(--muted); }
.table-action { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--teal-700); font-size: 11px; font-weight: 700; }

.state { display: grid; place-items: center; min-height: 280px; padding: 40px; text-align: center; }
.state__icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 14px; color: var(--teal-700); background: var(--teal-50); font-size: 22px; }
.state h2 { margin: 0 0 7px; font-size: 17px; }.state p { max-width: 480px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }.state .button { margin-top: 17px; }
.spinner { width: 26px; height: 26px; margin-bottom: 14px; border: 3px solid var(--line); border-top-color: var(--teal-600); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal { position: fixed; z-index: 1100; inset: 0; display: grid; place-items: center; padding: 24px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(6, 20, 33, .61); backdrop-filter: blur(2px); }
.modal__panel { position: relative; display: flex; flex-direction: column; width: min(680px, 100%); max-height: min(840px, calc(100vh - 48px)); overflow: hidden; border-radius: 16px; background: var(--surface); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; padding: 23px 25px; border-bottom: 1px solid var(--line); }
.modal__header h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.025em; }
.modal__body { overflow-y: auto; padding: 25px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 24px; }
.detail { padding: 13px; border-radius: 9px; background: var(--canvas); }
.detail span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }.detail strong { font-size: 13px; }
.section-title { margin: 25px 0 12px; font-size: 14px; }
.timeline { display: grid; gap: 12px; padding-left: 9px; border-left: 2px solid var(--line); }
.timeline__item { position: relative; padding-left: 16px; }
.timeline__item::before { content: ""; position: absolute; top: 5px; left: -14px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal-600); box-shadow: 0 0 0 4px #fff; }
.timeline__item p { margin: 0; line-height: 1.5; font-size: 13px; }.timeline__item time { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.inline-form { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.inline-form h3 { margin: 0 0 17px; font-size: 16px; }

.integration-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.integration-card { padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.integration-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.integration-card__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; color: var(--teal-700); background: var(--teal-50); font-weight: 800; }
.integration-card h2 { margin: 18px 0 7px; font-size: 16px; }.integration-card p { min-height: 52px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.integrations-page { display: grid; gap: 18px; }
.integrations-employee-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; padding: 0 0 16px; border-bottom: 1px solid var(--line); }
.integrations-employee-bar__field { margin: 0; min-width: min(420px, 100%); flex: 1 1 280px; }
.integrations-employee-bar__field select { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; }
.integrations-employee-bar__hint { flex: 1 1 100%; margin: 0; }
.mail-cascade { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 18px; padding: 4px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.mail-cascade__field { margin: 0; min-width: min(320px, 100%); flex: 1 1 240px; }
.mail-cascade__field select { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; }
.mail-cascade__field small { display: block; margin-top: 6px; }
.integrations-context { display: grid; gap: 8px; margin-bottom: 4px; }
.integrations-context__main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.integrations-context__main h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.integrations-org-body { display: grid; gap: 14px; padding: 18px 22px 22px; }
.integrations-org-body p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; min-height: 0; }
.panel__head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; }
.panel__head-row h2 { margin: 0; font-size: 16px; }
.mail-account-form { display: grid; gap: 4px; padding: 8px 22px 22px; }
.mail-account-form > .muted { margin: 0 0 12px; }
.mail-proto { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; margin: 8px 0 4px; }
.mail-proto__col { display: grid; gap: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas, #f5f8fa); }
.mail-proto__col .eyebrow { margin: 0 0 12px; }
.field--port { max-width: 120px; }
.mail-account-form__toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.mail-account-form__status { min-height: 1.4em; }
.mail-account-form__status p { margin: 8px 0 0; font-size: 13px; }
.integration-history-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.integration-history-item:last-child { border-bottom: 0; }
.integration-history-item h3 { margin: 0 0 8px; font-size: 14px; }
@media (max-width: 900px) {
  .mail-proto { grid-template-columns: 1fr; }
  .field--port { max-width: none; }
}
.connection-warning { margin-top: 17px; padding: 10px; border-radius: 8px; color: var(--warning); background: var(--warning-bg); font-size: 11px; font-weight: 700; }
.toast-region { position: fixed; z-index: 1300; right: 20px; bottom: 48px; display: grid; gap: 8px; }
.toast { max-width: 350px; padding: 13px 16px; border-radius: 9px; color: #fff; background: var(--navy-900); box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .integration-list { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .mobile-only { display: inline-grid; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 28px; }
  .mobile-brand { display: flex; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; }
  .sidebar.is-open { transform: none; }
  .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; display: block; background: rgba(5,18,30,.48); }
  .workspace { margin-left: 0; }
  .topbar { height: 64px; padding: 0 16px; gap: 10px; }
  .global-search { width: auto; flex: 1; }.global-search kbd { display: none; }
  .profile__text, .profile__button > span:last-child { display: none; }
  .content { padding: 26px 16px 70px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head .button { width: 100%; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 125px; padding: 16px; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-bar .button { width: 100%; }
  .tabs { width: 100%; overflow-x: auto; }.tabs a { flex: 1; min-width: max-content; text-align: center; }
  .integration-list { grid-template-columns: 1fr; }
  .modal { padding: 0; align-items: end; }.modal__panel { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .detail-grid, .field-row { grid-template-columns: 1fr; }
  .dev-notice { right: 9px; bottom: 8px; left: 9px; text-align: center; }
}
@media (max-width: 440px) {
  .metrics { grid-template-columns: 1fr; }
  .attention-button { width: 36px; height: 36px; }
  .profile__button { padding: 0; }
  .modal__body, .modal__header { padding: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* External integrations */
.ai-result { margin-top: 16px; padding: 16px; border: 1px solid var(--border, #d9e1ea); border-radius: 12px; overflow-wrap: anywhere; }
.ai-result h4 { margin: 14px 0 6px; }
.ai-result ul { padding-left: 22px; }
.integration-card > .button { margin: 4px 8px 4px 0; }
.integration-card input[type="file"] { max-width: 100%; margin: 10px 0; }
/* WhatsApp workspace */
.wa-widget { --wa-sidebar: 380px; --wa-green: #087f70; --wa-line: #e7eeeb; }
.wa-fab,.msg-fab { position:fixed; right:24px; bottom:24px; display:grid; place-items:center; width:60px; height:60px; padding:0; border:0; border-radius:22px; background:linear-gradient(145deg,#1b4a66,#10263f); color:#fff; box-shadow:0 8px 24px #10263f40; z-index:1000; transition:transform .18s,box-shadow .18s; }
.msg-tabs { display:flex; flex-wrap:wrap; gap:6px; padding:0 16px 8px; }
.msg-tab { min-height:34px; padding:6px 10px; border:1px solid #d9e4df; border-radius:999px; background:#f4f8f5; color:#355246; font-size:12px; font-weight:650; cursor:pointer; }
.msg-tab.is-active { background:#123c53; border-color:#123c53; color:#fff; }
.msg-alt-pane { flex:1; min-height:0; overflow:auto; padding:12px 16px 24px; }
.msg-alt-card { display:grid; gap:12px; padding:16px; border:1px solid var(--wa-line,#e7eeeb); border-radius:14px; background:#fff; }
.msg-alt-card h4 { margin:0; font-size:16px; }
.msg-grey-pane { display:flex; flex-direction:column; flex:1; min-height:0; }
.msg-grey-pane[hidden],.msg-alt-pane[hidden] { display:none!important; }
.msg-grey-pane > input[type=search] { width:calc(100% - 40px); flex-shrink:0; min-height:44px; margin:12px 20px 10px; padding:11px 15px; border:1px solid #edf1ef; border-radius:12px; background:#f3f6f4; font-size:13px; }
.msg-grey-pane > input[type=search]:focus { background:#fff; border-color:#75bdab; outline:3px solid #159f8b14; }
.msg-mail-pane > .wa-status { padding-top:4px; padding-bottom:0; color:#168773; }
.msg-mail-pane > .wa-status:empty { display:none; }
.msg-mail-pane .msg-alt-card { margin:8px 6px; }
.wa-contact-row { position:relative; display:flex; align-items:center; gap:2px; border-radius:13px; }
.wa-contact-row .wa-contact { flex:1; min-width:0; }
.wa-contact-row.is-active { background:#e8f5ee; }
.msg-more { display:grid; place-items:center; flex-shrink:0; width:34px; height:34px; padding:0; border:0; border-radius:50%; background:transparent; color:#5f7469; font-size:20px; font-weight:700; line-height:1; cursor:pointer; }
.msg-more:hover,.msg-more[aria-expanded=true] { background:#e4eee8; color:#18382f; }
.msg-lead-state { font-size:11px!important; font-weight:650; }
.msg-lead-state--free { color:#a0701c!important; }
.msg-lead-state--mine { color:#168773!important; }
.msg-lead-state--other { color:#9a5a52!important; }
.msg-menu { position:fixed; z-index:1150; display:grid; min-width:260px; max-width:min(320px,calc(100vw - 16px)); padding:6px; border:1px solid #dfe8e3; border-radius:14px; background:#fff; box-shadow:0 18px 48px #10263f2e; animation:wa-chat-in .14s ease-out; }
.msg-menu__item { display:grid; gap:2px; width:100%; padding:10px 12px; border:0; border-radius:10px; background:transparent; color:#1f3a30; text-align:left; cursor:pointer; }
.msg-menu__item strong { font-size:13px; font-weight:650; }
.msg-menu__item small { color:#7b8c83; font-size:11px; line-height:1.4; }
.msg-menu__item:hover,.msg-menu__item:focus-visible { background:#f0f6f2; outline:none; }
.msg-menu__item.is-disabled { color:#a5b0aa; cursor:not-allowed; }
.msg-menu__item.is-disabled strong { color:#a5b0aa; }
.msg-menu__item.is-disabled small { color:#b38a5c; }
.msg-menu__item.is-disabled:hover { background:#f6f7f6; }
.msg-menu__sep { height:1px; margin:4px 8px; background:#e7eeeb; }
.msg-mail-header { gap:16px; }
.msg-mail-head { display:flex; align-items:center; gap:14px; min-width:0; flex:1; }
.msg-mail-head .wa-subtitle { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.msg-mail-actions { display:flex; align-items:center; flex-wrap:wrap; justify-content:flex-end; gap:10px; }
.msg-mail-actions .msg-lead-state { padding:5px 10px; border-radius:999px; background:#f2f6f4; }
.msg-claim { min-height:36px; padding:0 14px; border-radius:10px; background:#128b75; border-color:#128b75; font-size:12px; }
.msg-mail-message { max-width:min(80%,760px); }
.msg-mail-message .msg-mail-meta { margin:0 0 6px!important; color:#6f8378!important; font-size:11px!important; font-weight:600; }
.wa-fab:hover { transform:translateY(-3px); box-shadow:0 12px 28px #087f7050; }
.wa-fab[hidden],.wa-pane[hidden],.wa-widget[hidden] { display:none!important; }
.wa-badge,.wa-count { display:inline-grid; place-items:center; min-width:22px; height:22px; padding:0 6px; border-radius:12px; background:#138b73; color:#fff; font-size:11px; font-weight:750; }
.wa-badge { position:absolute; right:-5px; top:-5px; height:24px; min-width:24px; border:2px solid white; background:#df495b; }
.wa-widget.wa-open { position:fixed; inset:0; z-index:999; pointer-events:none; background:transparent; }
.wa-pane { position:fixed; top:0; bottom:0; display:flex; flex-direction:column; min-height:0; overflow:hidden; pointer-events:auto; background:#fff; z-index:999; }
.wa-contacts { right:0; width:var(--wa-sidebar); border-left:1px solid var(--wa-line); box-shadow:-16px 0 55px #18352c17; animation:wa-slide-in .24s cubic-bezier(.2,.8,.2,1); }
.wa-conversation { left:0; right:var(--wa-sidebar); width:auto; border:0; animation:wa-chat-in .18s ease-out; }
.wa-header { display:flex; align-items:center; justify-content:space-between; flex-shrink:0; min-height:88px; padding:20px 24px; gap:14px; border-bottom:1px solid var(--wa-line); background:#fff; }
.wa-header h3 { margin:0; color:#17382f; overflow-wrap:anywhere; font-size:20px; font-weight:750; letter-spacing:-.035em; line-height:1.3; }
.wa-contacts .wa-header h3::before { content:''; display:inline-block; width:10px; height:10px; margin:0 10px 2px 0; border-radius:50%; background:#20ad88; box-shadow:0 0 0 5px #e9f7f1; }
.wa-header .icon-button { flex-shrink:0; width:36px; height:36px; border:0; border-radius:50%; color:#64766d; background:#f2f6f4; font-size:23px; line-height:1; }
.wa-header .icon-button:hover { color:#18382f; background:#e4eee8; }
.wa-status { margin:0; padding:10px 24px; color:#72867b; font-size:12px; line-height:1.55; }
.wa-contacts > .wa-status { padding-top:12px; padding-bottom:0; color:#168773; }
.wa-contacts > input { width:calc(100% - 40px); flex-shrink:0; min-height:44px; margin:16px 20px 10px; padding:11px 15px; border:1px solid #edf1ef; border-radius:12px; background:#f3f6f4; font-size:13px; }
.wa-contacts > input:focus { background:#fff; border-color:#75bdab; outline:3px solid #159f8b14; }
.wa-settings { margin:0 20px 12px; padding:0; color:#728278; font-size:12px; }
.wa-settings summary { width:fit-content; padding:7px 0; cursor:pointer; font-weight:600; }
.wa-settings[open] { padding-bottom:12px; border-bottom:1px solid var(--wa-line); }
.wa-settings label { display:flex; align-items:center; gap:8px; margin:9px 0 12px; }
.wa-settings input[type=checkbox] { width:16px; min-height:16px; accent-color:var(--wa-green); }
.wa-settings .button { min-height:34px; padding:0 10px; font-size:11px; font-weight:600; border-radius:9px; }
.wa-contact-list,.wa-messages { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#c5d7cd transparent; }
.wa-contact-list { padding:4px 10px 18px; }
.wa-contact { display:flex; align-items:center; width:100%; gap:13px; margin:3px 0; padding:14px 12px; border:0; border-radius:13px; background:#fff; text-align:left; transition:background .15s; }
.wa-contact:hover { background:#f4f8f5; }
.wa-contact.is-active { background:#e8f5ee; box-shadow:inset 3px 0 #1a9a7c; }
.wa-avatar { display:grid; place-items:center; flex-shrink:0; width:44px; height:44px; border-radius:15px; background:#edf4f0; color:#4d8470; font-weight:650; font-size:17px; }
.wa-contact:nth-child(3n+2) .wa-avatar { background:#eef1f7; color:#697c9c; }
.wa-contact:nth-child(3n+3) .wa-avatar { background:#f6f0e9; color:#a18461; }
.wa-contact.is-active .wa-avatar { background:#d2eade; color:#16816b; }
.wa-contact-text { min-width:0; flex:1; }
.wa-contact-text strong,.wa-contact-text > span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wa-contact-text strong { color:#263c32; font-size:13px; font-weight:650; line-height:1.45; }
.wa-contact-text > span { margin-top:4px; color:#8a9890; font-size:12px; line-height:1.4; }
.wa-messages { display:flex; flex-direction:column; align-items:flex-start; padding:28px clamp(20px,4vw,60px); background-color:#f2f6f1; background-image:radial-gradient(#b4cdb833 .9px,transparent .9px); background-size:20px 20px; }
.wa-message { width:fit-content; max-width:min(76%,680px); margin:0 0 16px; padding:13px 16px 9px; border:1px solid #e4eae3; border-radius:3px 16px 16px; background:#fff; box-shadow:0 2px 4px #263e2c05; overflow-wrap:anywhere; }
.wa-message.is-outgoing { align-self:flex-end; margin-left:auto; border-color:#d6e8d5; border-radius:16px 3px 16px 16px; background:#e1f3df; }
.wa-message p { margin:0; color:#314336; white-space:pre-wrap; font-size:14px; line-height:1.6; }
.wa-message time { display:block; margin-top:8px; color:#8a9b8b; font-size:10px; text-align:right; }
.wa-message small { display:block; margin-top:8px; color:#9d7665; font-size:11px; line-height:1.5; }
.wa-composer { display:flex; align-items:flex-end; flex-wrap:wrap; gap:12px; flex-shrink:0; padding:18px 24px; border-top:1px solid var(--wa-line); background:#fff; }
.wa-composer textarea { flex:1; min-width:100px; min-height:48px; max-height:140px; padding:12px 15px; border:1px solid #e4ebe6; border-radius:13px; background:#f8faf8; resize:vertical; font-size:13px; line-height:1.5; }
.wa-composer .button { min-height:48px; border-radius:12px; background:#128b75; border-color:#128b75; }
.wa-composer .wa-status { width:100%; padding:0; color:#ad5b53; }
.wa-composer .wa-status:empty { display:none; }
.wa-connect-body { text-align:center; }
.wa-connect-body img { max-width:100%; padding:12px; border:1px solid var(--wa-line); border-radius:16px; background:#fff; }
@keyframes wa-slide-in { from { transform:translateX(100%); } to { transform:translateX(0); } }
@keyframes wa-chat-in { from { opacity:0; transform:translateX(18px); } to { opacity:1; transform:translateX(0); } }
@media(max-width:850px) { .wa-widget { --wa-sidebar:330px; } .wa-header { padding:18px 20px; } .wa-message { max-width:90%; } }
@media(max-width:650px) { .wa-contacts,.wa-conversation { right:0; left:0; width:auto; top:0; bottom:0; } .wa-conversation { z-index:1001; } .wa-contacts.wa-has-chat { visibility:hidden; } .wa-header { min-height:76px; } .wa-fab { right:16px; bottom:20px; } .wa-messages { padding:20px 16px; } .wa-composer { padding:14px 16px; gap:8px; } .wa-message p { font-size:13px; } }
@media(prefers-reduced-motion:reduce) { .wa-pane,.wa-fab { animation:none; transition:none; } }
.wa-heading { min-width:0; }
.wa-message audio {display:block;width:310px;max-width:100%;height:42px;margin:10px 0 4px;}
.wa-voice-title {font-weight:600;}.wa-transcript {margin-top:12px!important;padding-top:12px;border-top:1px solid #ccdccc;}
.wa-subtitle { margin:5px 0 0; color:#8b9b91; font-size:11px; line-height:1.4; letter-spacing:.01em; }
.analytics-nav summary { display:flex; align-items:center; gap:12px; padding:12px 16px; cursor:pointer; border-radius:10px; color:inherit; list-style:none; }
.analytics-nav summary::-webkit-details-marker { display:none; }
.analytics-nav summary:hover { background:rgba(255,255,255,.08); }
.nav-group summary { gap:8px; padding:12px; font-size:13px; }
.nav-group summary .nav-icon { flex-shrink:0; }
.analytics-nav .analytics-chevron { margin-left:auto; }
.analytics-nav[open] .analytics-chevron { transform:rotate(180deg); }
.analytics-nav a { margin:4px 0 4px 24px; }
.analytics-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin:16px 0; }
.analytics-toolbar input[type=date],.analytics-toolbar select { padding:9px 12px; border:1px solid #d8e0e8; border-radius:8px; background:white; color:#18344d; }
.analytics-auto { display:flex; align-items:center; }
.analytics-notice { background:#eef5fb; border:1px solid #d7e6f4; padding:12px 18px; border-radius:12px; margin-bottom:20px; }
.analytics-notice p { margin:5px 0; }
.analytics-table { width:100%; border-collapse:collapse; font-size:14px; margin:14px 0 24px; background:white; }
.analytics-table th,.analytics-table td { padding:14px; text-align:left; vertical-align:top; border-bottom:1px solid #e3e9ef; min-width:100px; max-width:450px; overflow-wrap:anywhere; white-space:pre-wrap; }
.analytics-table th { background:#f3f7fa; }
.analytics-table p { margin:0 0 8px; }
.analytics-citations { max-height:260px; overflow:auto; display:flex; flex-direction:column; align-items:flex-start; gap:8px; }
.analytics-citations blockquote { margin:0; border-left:3px solid #90b6d3; padding-left:8px; }
.analytics-citations .button { padding:6px 10px; font-size:12px; }
.analytics-screenshot { display:block; width:100%; height:auto; border:1px solid #d8e0e8; border-radius:8px; }
.analytics-evidence pre { white-space:pre-wrap; overflow-wrap:anywhere; font-family:inherit; }
.analytics-evidence audio { width:100%; }
.table-scroll { overflow-x:auto; }
.analytics-auto input[type=checkbox] { width:18px; height:18px; min-height:18px; margin:0 8px 0 0; flex:none; }
.analytics-tabs { margin:4px 0 16px; }
.analytics-tabs .rq-tab--attention[aria-current="page"] .rq-tab__count { background:var(--teal-700); }
.analytics-table tr.analytics-row--selected > td { background:var(--teal-50); }
.analytics-table ul { margin:4px 0 8px; padding-left:18px; }
.analytics-level { display:inline-block; padding:3px 9px; border-radius:999px; font-size:12px; font-weight:700; color:var(--muted); background:var(--canvas); }
.analytics-level--high { color:var(--teal-700); background:var(--teal-100); }
.analytics-level--normal { color:var(--teal-700); background:var(--teal-50); }
.analytics-level--low { color:var(--warning); background:var(--warning-bg); }
.analytics-assessment__title { margin:10px 0 2px !important; font-size:12px; font-weight:700; color:var(--muted); }
.analytics-groups tr.analytics-group > td { background:var(--surface); }
.analytics-group__details > td { padding:0 14px 14px; background:var(--canvas); max-width:none; }
.analytics-group__details .analytics-table { margin:10px 0 0; }
.modal__panel:has(.analytics-gallery) { width:min(1100px,100%); }
.analytics-gallery__brief { padding:10px 14px; border:1px solid var(--line); border-radius:10px; background:var(--canvas); }
.analytics-gallery__grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:12px; }
.analytics-gallery__thumb { display:flex; flex-direction:column; gap:6px; padding:6px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); font-size:12px; text-align:left; cursor:pointer; }
.analytics-gallery__thumb:hover,.analytics-gallery__thumb:focus-visible { border-color:var(--teal-600); }
.analytics-gallery__thumb img,.analytics-gallery__thumb .analytics-gallery__missing { width:100%; aspect-ratio:16/10; object-fit:cover; border-radius:6px; background:var(--canvas); }
.analytics-gallery__missing { display:grid; place-items:center; color:var(--muted); font-size:12px; }
.analytics-gallery__nav { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:12px; }
.analytics-gallery__nav .muted { margin-right:auto; }
.analytics-gallery__large img,.analytics-gallery__large .analytics-gallery__missing { display:block; width:100%; max-height:62vh; object-fit:contain; border:1px solid var(--line); border-radius:8px; background:var(--canvas); }
.analytics-gallery__large .analytics-gallery__missing { min-height:200px; }
.price-tabs,.price-toolbar { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin:20px 0; }
.price-toolbar input { flex:1; min-width:220px; }
.price-toolbar select { max-width:240px; }
.price-source { background:#edf6f5; border:1px solid #cfe4e2; border-radius:12px; padding:16px 20px; }
.price-source p { margin:6px 0 0; color:#50677b; }
.price-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:20px; }
.price-card { display:flex; flex-direction:column; border:1px solid #d9e4eb; border-radius:14px; background:white; padding:24px; }
.price-card h2 { font-size:19px; line-height:1.4; margin:10px 0; }
.price-card p { white-space:pre-wrap; }
.price-amount { font-size:30px; font-weight:750; color:#087d79; margin:12px 0 0; }
.price-limits { margin:14px 0; }
.price-limits div { display:flex; justify-content:space-between; gap:12px; border-bottom:1px solid #edf1f5; padding:8px 0; }
.price-limits dt { color:#546c7d; }.price-limits dd { margin:0; font-weight:600; }
.price-conditions { color:#51697a; font-size:13px; line-height:1.6; }
.price-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:auto; padding-top:12px; }
.price-badges { display:flex; gap:6px; flex-wrap:wrap; }.price-badge { padding:4px 8px; border-radius:6px; background:#edf1f4; font-size:12px; }
.price-badge--warning { background:#fff1cf; color:#865500; }
.price-table { width:100%; background:white; border-collapse:collapse; }
.price-table th,.price-table td { padding:14px; text-align:left; border-bottom:1px solid #e2e9ee; vertical-align:top; }
.price-table th { background:#edf3f7; }.price-cell-amount { white-space:nowrap; font-weight:650; }.price-cell-conditions { min-width:230px; max-width:380px; white-space:pre-wrap; }
.price-form { display:grid; gap:14px; }.price-limit-fields { display:grid; grid-template-columns:1fr 1fr; gap:12px; border:1px solid #d9e4eb; border-radius:10px; padding:16px; }
.price-check { display:flex; align-items:center; gap:10px; }.price-check input[type=checkbox] { width:18px; height:18px; min-height:18px; margin:0; }
@media(max-width:600px) { .price-limit-fields { grid-template-columns:1fr; } }
.modal__panel:has(.client-profile),.modal__panel:has(.client-requisites-fields) { width:min(1100px,100%); }
.client-summary { display:grid; grid-template-columns:1.3fr 1fr; gap:20px; padding:20px; border:1px solid #d9e7e7; background:#f0f8f7; border-radius:12px; margin-bottom:20px; }
.client-summary h3 { margin:8px 0; }.client-summary p { margin:8px 0; }
.client-tabs { display:flex; gap:4px; border-bottom:1px solid #d7e2e9; overflow:auto; margin-bottom:20px; }
.client-tabs button { white-space:nowrap; background:transparent; border:0; padding:12px 18px; border-bottom:3px solid transparent; color:#526c7f; font-weight:650; cursor:pointer; }
.client-tabs button[aria-selected=true] { border-bottom-color:#00847f; color:#00746f; background:#edf7f6; }
.client-toolbar { display:flex; gap:10px; flex-wrap:wrap; margin:12px 0 18px; }
.client-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }.client-edit-form { display:grid; gap:16px; }
.client-requisites-fields>.field { margin-bottom:18px; }.client-table { border-collapse:collapse; width:100%; font-size:13px; margin-bottom:22px; }
.client-table th,.client-table td { border-bottom:1px solid #e0e8ed; padding:12px; text-align:left; vertical-align:top; white-space:pre-wrap; overflow-wrap:anywhere; min-width:95px; }
.client-table th { background:#f2f6f8; }.client-table td { max-width:300px; }.client-table blockquote { margin:8px 0; padding-left:8px; border-left:3px solid #b3d5d1; }
.client-warning { color:#936600; }.client-tab-body h3 { margin-top:24px; }
@media(max-width:650px){.client-summary,.client-form-grid { grid-template-columns:1fr; }.client-tabs button { padding:12px; }}
.client-clickable-row { cursor:pointer; }
.client-clickable-row:hover td { background:#eef7f6; }
.client-clickable-row:focus-visible { outline:2px solid #00847f; outline-offset:-2px; }
.client-row-actions { width:52px; text-align:right; }
.client-row-menu-button { border:1px solid transparent; border-radius:8px; background:transparent; color:#476375; width:36px; height:36px; cursor:pointer; font-size:26px; line-height:1; }
.client-row-menu-button:hover,.client-row-menu-button[aria-expanded=true] { background:#dfeeea; color:#00746f; border-color:#c3ddd6; }
.client-row-menu-button:focus-visible { outline:2px solid #00847f; outline-offset:2px; }
.client-row-menu { position:fixed; inset:auto; margin:0; width:220px; padding:6px; border:1px solid #d5e2e7; border-radius:10px; background:white; box-shadow:0 12px 35px #10263f26; }
.client-row-menu button { display:block; width:100%; text-align:left; padding:10px 12px; border:0; border-radius:6px; background:transparent; color:#203d50; cursor:pointer; font:inherit; font-size:14px; }
.client-row-menu button:hover,.client-row-menu button:focus-visible { background:#edf7f5; color:#00746f; outline:none; }
/* Document generation workspace */
.dg-page { display:grid; gap:20px; }
.dg-page .price-tabs { flex-wrap:wrap; }
.dg-create { display:grid; grid-template-columns:minmax(320px,1fr) minmax(300px,1fr); gap:24px; align-items:start; }
.dg-create .field { margin-bottom:16px; }
.dg-create select,.dg-create input,.dg-create textarea { width:100%; }
.dg-create .price-card { min-width:0; }
.dg-values { max-height:600px; overflow:auto; margin:20px 0; }
.dg-values td { overflow-wrap:anywhere; }
.dg-check-result { padding:12px 0; border-bottom:1px solid #e1e7eb; }
.dg-check { display:flex; gap:10px; align-items:center; padding:8px 0; }
.dg-check input { width:16px; height:16px; min-height:16px; margin:0; padding:0; accent-color:var(--teal-700); }
.dg-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:16px; }
.dg-toolbar > p { margin:0; max-width:720px; font-size:13px; line-height:1.55; }
.dg-tpl-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; align-items:stretch; }
.dg-tpl-grid:has(> :only-child) { grid-template-columns:minmax(0,560px); }
.dg-tpl-card { display:flex; flex-direction:column; gap:16px; padding:24px; border:1px solid #d9e4eb; border-radius:var(--radius); background:var(--surface); box-shadow:0 4px 18px rgba(25,48,67,.035); transition:border-color .15s,box-shadow .15s; }
.dg-tpl-card:hover { border-color:#bfd3dc; box-shadow:0 10px 28px rgba(25,48,67,.07); }
.dg-tpl-card.is-archived { opacity:.72; }
.dg-tpl-card__head { display:grid; grid-template-columns:44px 1fr auto; gap:14px; align-items:start; }
.dg-tpl-card__mark { display:grid; place-items:center; width:44px; height:44px; border-radius:11px; background:var(--teal-50); color:var(--teal-700); font-size:18px; font-weight:800; }
.dg-tpl-card__title .eyebrow { margin:0; }
.dg-tpl-card__title h2 { margin:4px 0 0; font-size:18px; line-height:1.3; letter-spacing:-.01em; }
.dg-tpl-card__lead { margin:0; color:var(--muted); font-size:13px; line-height:1.55; }
.dg-tpl-card__pulls { padding:14px 16px; border-radius:10px; background:var(--canvas); }
.dg-tpl-card__pulls ul { display:grid; gap:6px; margin:8px 0 0; padding:0; list-style:none; font-size:13px; }
.dg-tpl-card__pulls li { position:relative; padding-left:18px; }
.dg-tpl-card__pulls li::before { content:""; position:absolute; top:7px; left:2px; width:7px; height:7px; border-radius:50%; background:var(--teal-600); }
.dg-label { color:var(--muted); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; }
.dg-tpl-card__meta { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:0; }
.dg-tpl-card__meta dt { color:var(--muted); font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
.dg-tpl-card__meta dd { margin:4px 0 0; font-size:13px; font-weight:700; overflow-wrap:anywhere; }
.dg-tpl-card__note { margin:0; padding-top:12px; border-top:1px solid var(--line); color:var(--muted); font-size:12px; line-height:1.5; }
.dg-tpl-card__actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:auto; padding-top:4px; }
.dg-tpl-card__actions .button--primary { flex:1 1 180px; }
.dg-badge { display:inline-flex; align-items:center; width:fit-content; padding:5px 9px; border-radius:999px; font-size:11px; font-weight:800; white-space:nowrap; }
.dg-badge--draft { color:var(--warning); background:var(--warning-bg); }
.dg-badge--approved { color:var(--success); background:var(--success-bg); }
.dg-badge--archived { color:#506272; background:#edf1f3; }
.dg-badge--rec { margin-top:4px; color:var(--teal-700); background:var(--teal-100); }
.dg-empty { display:grid; justify-items:center; gap:8px; padding:44px 24px; border:1px dashed #cfdbe2; border-radius:var(--radius); background:var(--surface); text-align:center; }
.dg-empty h2 { margin:0; font-size:17px; }
.dg-empty p { max-width:480px; margin:0 0 8px; color:var(--muted); font-size:13px; line-height:1.55; }
.modal__panel:has(.dg-tpl-form) { width:min(760px,100%); }
.dg-tpl-form { display:grid; gap:20px; }
.dg-section { display:grid; gap:12px; margin:0; padding:16px 18px 18px; border:1px solid var(--line); border-radius:12px; min-width:0; }
.dg-section .field { margin:0; }
.dg-section__title { padding:0 6px; margin-left:-6px; color:var(--ink); font-size:14px; font-weight:800; }
.dg-section__hint { margin:-4px 0 0; color:var(--muted); font-size:12px; line-height:1.5; }
.dg-toggle { display:grid; grid-template-columns:18px 1fr; gap:4px 12px; align-items:start; padding:12px 0; border-top:1px solid var(--line); cursor:pointer; }
.dg-section > .dg-toggle:first-of-type { border-top:0; padding-top:0; }
.dg-toggle input[type=checkbox] { width:18px; height:18px; min-height:18px; margin:1px 0 0; padding:0; accent-color:var(--teal-700); cursor:pointer; }
.dg-toggle input[type=checkbox]:focus { outline:none; }
.dg-toggle input[type=checkbox]:focus-visible { outline:2px solid var(--teal-600); outline-offset:2px; }
.dg-toggle__text { display:grid; gap:3px; }
.dg-toggle__title { color:var(--ink); font-size:13px; font-weight:700; line-height:1.35; }
.dg-toggle__hint { color:var(--muted); font-size:12px; font-weight:400; line-height:1.45; }
.dg-radio-cards,.dg-choice { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.dg-choice { grid-template-columns:repeat(2,1fr); }
.dg-radio-card { position:relative; display:grid; align-content:start; gap:4px; padding:12px 14px 12px 40px; border:1px solid var(--line); border-radius:10px; background:var(--surface); cursor:pointer; }
.dg-radio-card input[type=radio] { position:absolute; top:13px; left:14px; width:16px; height:16px; min-height:16px; margin:0; padding:0; accent-color:var(--teal-700); }
.dg-radio-card:hover { border-color:#bdcbd4; }
.dg-radio-card:has(input:checked) { border-color:var(--teal-600); background:var(--teal-50); box-shadow:inset 0 0 0 1px var(--teal-600); }
.dg-radio-card:has(input:focus-visible) { outline:3px solid rgba(12,145,135,.25); outline-offset:1px; }
.dg-radio-card__title { font-size:13px; font-weight:700; color:var(--ink); }
.dg-radio-card__hint { font-size:12px; color:var(--muted); line-height:1.4; }
.dg-drop { position:relative; display:grid; place-items:center; gap:4px; min-height:112px; padding:18px; border:1.5px dashed #c3d1da; border-radius:12px; background:var(--canvas); text-align:center; cursor:pointer; transition:border-color .15s,background .15s; }
.dg-drop:hover,.dg-drop.is-over { border-color:var(--teal-600); background:var(--teal-50); }
.dg-drop.is-filled { border-style:solid; border-color:var(--teal-600); background:var(--surface); }
.dg-drop__input { position:absolute; inset:0; width:100%; height:100%; min-height:0; padding:0; border:0; opacity:0; cursor:pointer; }
.dg-drop:has(.dg-drop__input:focus-visible) { outline:3px solid rgba(12,145,135,.25); outline-offset:2px; }
.dg-drop__title { font-size:13px; font-weight:700; color:var(--ink); }
.dg-drop__hint { font-size:12px; color:var(--muted); }
.dg-link { width:fit-content; color:var(--teal-700); font-size:12px; font-weight:700; }
.dg-help { border:1px solid var(--line); border-radius:12px; background:var(--canvas); }
.dg-help > summary { padding:12px 16px; font-size:13px; font-weight:700; cursor:pointer; list-style:none; }
.dg-help > summary::-webkit-details-marker { display:none; }
.dg-help > summary::before { content:"▸"; display:inline-block; margin-right:8px; color:var(--teal-700); transition:transform .15s; }
.dg-help[open] > summary::before { transform:rotate(90deg); }
.dg-help > summary:focus-visible { outline:2px solid var(--teal-600); outline-offset:-2px; border-radius:12px; }
.dg-help__body { padding:0 16px 14px; font-size:12px; line-height:1.6; color:#32495c; }
.dg-help__body ul { margin:0 0 8px; padding-left:18px; }
.dg-help code { padding:1px 6px; border-radius:5px; background:#e6eef1; font:12px/1.5 ui-monospace,Consolas,monospace; color:var(--navy-900); }
.dg-sticky-actions { position:sticky; bottom:-25px; z-index:2; margin:4px -25px -25px; padding:14px 25px; border-top:1px solid var(--line); background:rgba(255,255,255,.96); backdrop-filter:blur(6px); }
.dg-contract__form { display:grid; gap:14px; }
.dg-contract__form .field { margin:0; }
.dg-contract__hint { margin:6px 0 0; font-size:12px; line-height:1.5; }
.dg-contract__output { display:grid; gap:8px; justify-items:start; }
.dg-contract__output:empty { display:none; }
.dg-contract__done { margin:0; color:var(--success); font-weight:700; }
.dg-contract__discount { display:grid; gap:10px; padding:12px 14px; border:1px solid var(--line); border-radius:10px; background:var(--canvas); }
.dg-contract__discount .dg-toggle { padding:0; border-top:0; }
.dg-contract__total { margin:0; font-size:13px; }
.dg-contract__total:empty { display:none; }
.dg-contract__total strong { color:var(--ink); }
.dg-steps { display:grid; gap:22px; }
.dg-steps > h2 { margin:0; }
.dg-step { display:grid; gap:12px; }
.dg-step .field { margin:0; }
.dg-step__head { display:flex; align-items:center; gap:10px; }
.dg-step__head h3 { margin:0; font-size:15px; }
.dg-step__num { display:grid; place-items:center; width:24px; height:24px; border-radius:50%; background:var(--teal-50); color:var(--teal-700); font-size:12px; font-weight:800; }
.dg-segment { display:inline-flex; gap:4px; width:fit-content; padding:4px; border:1px solid var(--line); border-radius:11px; background:#eaf0f2; }
.dg-segment label { position:relative; padding:8px 16px; border-radius:7px; color:var(--muted); font-size:13px; font-weight:700; cursor:pointer; }
.dg-segment input { position:absolute; opacity:0; width:1px; height:1px; min-height:0; padding:0; }
.dg-segment label:has(input:checked) { color:var(--ink); background:var(--surface); box-shadow:0 2px 7px rgba(20,44,63,.08); }
.dg-segment label:has(input:focus-visible) { outline:2px solid var(--teal-600); outline-offset:1px; }
.dg-client-pick { display:grid; grid-template-columns:1fr 1.4fr; gap:10px; }
.dg-basis-note { display:grid; gap:8px; justify-items:start; }
.dg-basis-note:empty { display:none; }
.dg-summary { display:grid; grid-template-columns:auto 1fr; gap:6px 14px; margin:14px 0; padding:12px 14px; border-radius:10px; background:var(--canvas); font-size:12px; }
.dg-summary dt { color:var(--muted); }
.dg-summary dd { margin:0; font-weight:700; color:var(--ink); overflow-wrap:anywhere; }
@media (min-width:1101px) { .dg-preview { position:sticky; top:88px; } }
@media (max-width:900px) { .dg-tpl-grid,.dg-choice,.dg-client-pick { grid-template-columns:1fr; } .dg-tpl-card__meta { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:720px) { .dg-radio-cards { grid-template-columns:1fr; } .dg-sticky-actions { bottom:-19px; margin:4px -19px -19px; padding:12px 19px; } }
@media (max-width:520px) { .dg-tpl-card { padding:18px; } .dg-tpl-card__head { grid-template-columns:40px 1fr; } .dg-tpl-card__head .dg-badge { grid-column:2; justify-self:start; } .dg-tpl-card__actions .button { flex:1 1 100%; } }
.dg-row { display:grid; grid-template-columns:2fr 1fr 1fr 2fr auto; gap:8px; margin:10px 0; }
.dg-company { max-width:800px; }
.dg-preview .button { margin:4px; }
@media(max-width:1100px) { .dg-create { grid-template-columns:1fr; } .dg-row {grid-template-columns:1fr 1fr;} }

/* Access: shared pieces */
.profile-menu .profile-menu__item { margin-bottom: 6px; color: var(--ink); background: var(--canvas); }
.profile-menu .profile-menu__item:hover { background: var(--teal-50); }
.state--locked .state__icon { color: var(--navy-900); background: #e8edf2; }
.field-error { color: var(--danger) !important; font-weight: 600 !important; font-size: 12px; }
[aria-invalid="true"] { border-color: var(--danger); }
.form-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-warning { padding: 11px 13px; border: 1px solid #efd9b3; border-radius: 8px; color: var(--warning); background: var(--warning-bg); font-size: 12px; line-height: 1.5; }
.readonly-note { display: inline-flex; width: fit-content; padding: 4px 10px; border-radius: 999px; color: var(--navy-900); background: #e8edf2; font-size: 12px; font-weight: 700; }
.notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid #d7e6f4; border-radius: 12px; background: #eef5fb; }
.notice p { margin: 0; }
.link-button { padding: 0 4px; border: 0; color: var(--teal-700); background: transparent; font-weight: 700; text-decoration: underline; }
.integration-card__note { margin-top: 12px !important; min-height: 0 !important; font-weight: 600; }
.pill--system { color: #fff; background: var(--navy-800); }
.pill--default { color: var(--teal-700); background: var(--teal-100); }
.pill--sensitive { color: var(--danger); background: var(--danger-bg); }
.pill--self { margin-left: 6px; color: var(--navy-900); background: #e8edf2; }
.pill--role { text-decoration: none; }
a.pill--role:hover { text-decoration: underline; }
.perm-row .pill--new, .role-head .pill--new { color: var(--warning); background: var(--warning-bg); }
.client-row-menu button.is-danger { color: var(--danger); }
.client-row-menu button[aria-disabled="true"] { color: #8c9aa6; cursor: not-allowed; }
.client-row-menu button small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.row-menu { display: inline-block; }
.cell-actions { width: 56px; text-align: right; }
.cell-check { width: 44px; }
.cell-check input, .assign-list input { width: 18px; min-height: 18px; }
.empty-hint { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border: 1px dashed #b9d8d3; border-radius: 12px; background: var(--teal-50); }
.empty-hint p { margin: 0; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.pagination > div { display: flex; flex-wrap: wrap; gap: 8px; }
.pagination select { width: auto; }

/* Confirm dialog (above the regular modal) */
.confirm-dialog { position: fixed; z-index: 1200; inset: 0; display: grid; place-items: center; padding: 24px; }
.confirm-dialog__panel { position: relative; width: min(520px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; padding: 24px; border-radius: 16px; background: var(--surface); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.confirm-dialog__panel h2 { margin: 0 0 12px; font-size: 19px; letter-spacing: -.02em; }
.confirm-dialog__body { display: grid; gap: 10px; font-size: 13px; line-height: 1.55; }
.confirm-dialog__body p { margin: 0; }
.confirm-dialog__actions { flex-wrap: wrap; }
.confirm-list { margin: 0; padding-left: 20px; }
.confirm-strong { font-weight: 700; }

/* My access */
.access-summary__list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.access-summary__list li { padding: 5px 10px; border-radius: 999px; color: var(--teal-700); background: var(--teal-50); font-size: 12px; font-weight: 600; }
.access-summary__list li.muted { color: var(--muted); background: var(--canvas); }
.my-access__modules h4 { margin: 16px 0 6px; font-size: 13px; }
.my-access__modules ul { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }

/* Roles list */
.roles-search { max-width: 420px; }
.role-list td { vertical-align: top; }
.role-card { cursor: pointer; }
.role-card:hover td { background: #f3f9f8; }
.role-card__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.role-card__name { color: var(--ink); font-weight: 750; text-decoration: none; }
.role-card__name:hover { color: var(--teal-700); text-decoration: underline; }
.role-card__desc { max-width: 560px; margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Role editor */
.role-editor { padding-bottom: 90px; }
.role-editor__back { margin: 0; }
.role-editor__back a { color: var(--teal-700); font-weight: 700; text-decoration: none; }
.role-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.role-head__name { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.role-head__title { margin: 0; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.035em; flex: 1 1 320px; min-width: 0; }
.role-head__badges, .role-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.role-head__desc { max-width: 760px; margin: 0; }
.inline-edit { position: relative; display: block; }
.inline-edit__input { min-height: 48px; padding: 4px 40px 4px 10px; border-color: transparent; background: transparent; font-size: inherit; font-weight: 750; letter-spacing: inherit; }
.inline-edit__input:hover { border-color: var(--line); }
.inline-edit__input:focus { background: #fff; }
.inline-edit__icon { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--muted); font-size: 18px; pointer-events: none; }
.inline-edit__textarea { min-height: 60px; }
.role-tabs { margin-bottom: 0; }
.role-tabpanel { display: grid; gap: 14px; outline: none; }
.tab-toolbar { display: flex; justify-content: flex-end; }
.perm-toolbar { position: sticky; z-index: 5; top: 72px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 0; background: var(--canvas); }
.perm-toolbar input[type=search] { flex: 1 1 240px; max-width: 360px; }
.perm-toolbar__only { padding: 0; white-space: nowrap; font-size: 13px; }
.perm-toolbar__only input { width: 18px; min-height: 18px; }
.perm-toolbar__count { color: var(--muted); font-size: 13px; font-weight: 600; }
.perm-toolbar__bulk { display: flex; gap: 8px; margin-left: auto; }
.perm-hint { font-size: 12px; color: var(--warning); }
.perm-hint:not(:empty) { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; background: var(--warning-bg); }
.role-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.role-layout__main { display: grid; gap: 14px; min-width: 0; }
.role-summary { position: sticky; top: 140px; padding: 18px; }
.role-summary h2 { margin: 0 0 6px; font-size: 15px; }
.role-summary p { margin: 0 0 12px; font-size: 12px; }
.perm-matrix { display: grid; gap: 12px; }
.perm-module { margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.perm-module__legend { display: flex; align-items: center; gap: 10px; width: 100%; float: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.perm-module.is-collapsed .perm-module__legend { border-bottom: 0; }
.perm-module__legend + * { clear: both; }
.perm-module > .perm-hint:not(:empty) { margin: 10px 16px 0; }
.perm-module__check { width: 20px; min-height: 20px; flex: none; accent-color: var(--teal-700); }
.perm-module__toggle { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 4px; border: 0; color: var(--ink); background: transparent; font-size: 15px; font-weight: 750; }
.perm-module__chevron::before { content: "▾"; display: inline-block; color: var(--muted); transition: transform .15s; }
.perm-module__toggle[aria-expanded="false"] .perm-module__chevron::before { transform: rotate(-90deg); }
.perm-module__count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.perm-module__body { clear: both; }
.perm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: start; padding: 12px 16px 12px 46px; border-top: 1px solid #edf1f4; }
.perm-row:first-child { border-top: 0; }
.perm-row.is-on { background: #f6fbfa; }
.perm-row__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.perm-row__label { display: inline-flex; align-items: center; gap: 10px; margin-left: -30px; font-size: 14px; font-weight: 650; cursor: pointer; }
.perm-row__label input { width: 20px; min-height: 20px; flex: none; accent-color: var(--teal-700); }
.perm-row__label input:disabled + .perm-row__name { color: #6d7d8b; }
.perm-row__desc { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.perm-row__deps, .perm-row__lock { display: block; margin-top: 4px; color: #4f6475; font-size: 11px; }
.perm-row__lock { color: var(--warning); }
.perm-row > .perm-hint { grid-column: 1 / -1; }
.perm-row mark, .role-card mark { padding: 0 1px; border-radius: 3px; color: inherit; background: #ffe7a3; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #eef2f4; }
.segmented__option { min-width: 64px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.segmented__option[aria-checked="true"] { color: #fff; background: var(--teal-700); }
.segmented__option:disabled { cursor: not-allowed; opacity: .5; }
.savebar { position: sticky; z-index: 25; bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 1px solid #b9d8d3; border-radius: 12px; background: #fff; box-shadow: 0 10px 30px rgba(16,38,63,.18); animation: savebar-in .2s ease-out; }
.savebar__text { font-weight: 700; }
.savebar__actions { display: flex; gap: 8px; }
@keyframes savebar-in { from { transform: translateY(12px); opacity: 0; } }
.has-savebar .wa-fab { bottom: 96px; }
.has-confirm .wa-fab { visibility: hidden; }
.role-source { display: grid; gap: 10px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.role-source legend { padding: 0 6px; font-size: 12px; font-weight: 700; color: #32495c; }
.role-source__option { display: grid; gap: 6px; font-size: 13px; }
.role-source__option label, label.role-source__option { display: flex; align-items: center; gap: 8px; }
.role-source input[type=radio] { width: 18px; min-height: 18px; flex: none; accent-color: var(--teal-700); }
.role-source__desc { margin: 0; font-size: 12px; }
.role-preview { display: grid; gap: 6px; font-size: 13px; line-height: 1.5; }
.role-preview p { margin: 0; }
.role-preview a { color: var(--teal-700); font-weight: 700; }
.role-preview__diff { margin: 0; padding-left: 18px; }
.role-preview__diff .is-gain strong { color: var(--success); }
.role-preview__diff .is-loss strong { color: var(--danger); }
.assign-list { display: grid; gap: 2px; max-height: 340px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.assign-list label { align-items: flex-start; }
.history-feed { display: grid; gap: 6px; }
.history-feed__day { margin: 12px 0 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.history-feed__list { display: grid; gap: 10px; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); list-style: none; }
.history-feed__item p { margin: 0; font-size: 13px; line-height: 1.55; }
.history-feed__meta { color: var(--muted); font-size: 12px !important; }
.history-feed__action { font-weight: 700; }

/* Staff */
.users-page .filter-bar { grid-template-columns: minmax(220px, 1fr) minmax(160px, 240px) minmax(150px, 200px) auto; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell__name { font-weight: 700; }
.avatar--sm { width: 32px; height: 32px; flex: none; border-radius: 9px; font-size: 11px; }
tr.is-muted td { color: #7b8a96; }
.bulk-bar { position: sticky; z-index: 6; top: 84px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid #b9d8d3; border-radius: 12px; background: var(--teal-50); }
.pw-field__row { display: flex; gap: 8px; }
.pw-field__row input { flex: 1; min-width: 0; }
.password-rule { color: var(--muted); }
.password-rule.is-ok { color: var(--success) !important; }
.audit-day th { color: var(--navy-900); background: #eef3f6; }

@media (max-width: 1050px) {
  .role-layout { grid-template-columns: 1fr; }
  .role-summary { position: static; }
}
@media (max-width: 760px) {
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tr { position: relative; margin: 0 0 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .responsive-table td { padding: 4px 0; border: 0; }
  .responsive-table td[data-label]:not(.role-card__main)::before { content: attr(data-label); display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
  .responsive-table td.cell-actions { position: absolute; top: 8px; right: 8px; width: auto; padding: 0; }
  .responsive-table td.cell-check { position: absolute; top: 14px; left: 12px; width: auto; padding: 0; }
  .responsive-table tr:has(.cell-check) { padding-left: 44px; }
  .responsive-table .audit-day th { display: block; border-radius: 8px; }
  .table-wrap:has(.responsive-table) { overflow: visible; }
  .panel:has(.responsive-table) { border: 0; background: transparent; box-shadow: none; }
  .role-card__main { padding-right: 40px !important; }
  .perm-toolbar { top: 64px; }
  .perm-toolbar__bulk { margin-left: 0; width: 100%; }
  .perm-toolbar__bulk .button { flex: 1; }
  .perm-row { grid-template-columns: 1fr; }
  .segmented { display: flex; width: 100%; }
  .segmented__option { flex: 1; min-height: 40px; }
  .savebar { position: fixed; right: 0; bottom: 0; left: 0; border-radius: 14px 14px 0 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .savebar__actions { width: 100%; }
  .savebar__actions .button { flex: 1; }
  .has-savebar .wa-fab { bottom: calc(124px + env(safe-area-inset-bottom)); }
  .has-savebar .dev-notice { display: none; }
  .role-head__actions { width: 100%; }
  .confirm-dialog { padding: 0; align-items: end; }
  .confirm-dialog__panel { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .modal__panel { height: 100vh; max-height: 100vh; border-radius: 0; }
  .users-page .filter-bar { grid-template-columns: 1fr; }
  .bulk-bar { top: 70px; }
}
@media (max-width: 440px) {
  .perm-row { padding-left: 40px; padding-right: 12px; }
  .perm-module__legend { padding: 10px 12px; }
  .pw-field__row { flex-wrap: wrap; }
  .pw-field__row input { flex-basis: 100%; }
  .pw-field__row .button { flex: 1; }
  .confirm-dialog__actions .button { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .savebar { animation: none; }
  .perm-module__chevron::before { transition: none; }
}

/* Requests («Заявки») */
.rq-page .page-head { margin-bottom: 20px; }
.rq-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #eaf0f2; width: fit-content; max-width: 100%; }
.rq-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; white-space: nowrap; }
.rq-tab:hover { color: var(--ink); }
.rq-tab[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: 0 2px 7px rgba(20,44,63,.08); }
.rq-tab__count { min-width: 22px; padding: 2px 7px; border-radius: 999px; color: #506272; background: rgba(255,255,255,.7); font-size: 11px; text-align: center; }
.rq-tab[aria-current="page"] .rq-tab__count { background: var(--canvas); }
.rq-tab--attention .rq-tab__count { color: #fff; background: var(--teal-700); }
.rq-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.rq-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 640px; }
.rq-search { flex: 1 1 260px; }
.rq-filters select { width: auto; min-width: 150px; }
.rq-toggle[aria-pressed="true"] { color: var(--danger); border-color: #efcccc; background: var(--danger-bg); }
.rq-toggle[aria-pressed="true"]::before { content: "✓"; }
.rq-reset { border-color: transparent; color: var(--teal-700); background: transparent; }
.rq-columns-wrap { position: relative; margin-left: auto; }
.rq-columns { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; width: 300px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.rq-columns__title { margin: 0 0 8px; font-size: 13px; font-weight: 750; }
.rq-columns__list { display: grid; gap: 2px; max-height: min(440px, 60vh); margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.rq-columns__item { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px; padding: 3px 4px; border-radius: 8px; }
.rq-columns__item:hover { background: var(--canvas); }
.rq-columns__item.is-hidden .checkbox span { color: var(--muted); }
.rq-columns__item .checkbox { min-height: 34px; cursor: pointer; }
.rq-columns__move { width: 30px; height: 30px; font-size: 14px; }
.rq-columns__move:disabled { opacity: .35; cursor: default; }
.rq-columns__hint { margin: 10px 0; font-size: 11px; line-height: 1.5; }
.rq-columns__footer { display: flex; justify-content: space-between; gap: 8px; }
.rq-table th, .rq-table td { padding: 11px 12px; }
.rq-table th:first-child, .rq-table td:first-child { position: sticky; left: 0; z-index: 1; background: inherit; }
.rq-table thead th:first-child { background: #f7f9fa; }
.rq-table tbody tr { background: var(--surface); }
.rq-table th.rq-actions, .rq-table td.rq-actions { position: sticky; right: 0; z-index: 1; width: 1%; background: inherit; text-align: right; box-shadow: -10px 0 12px -12px rgba(16,38,63,.35); }
.rq-table thead th.rq-actions { background: #f7f9fa; }
.rq-row { cursor: pointer; }
.rq-row:hover, .rq-row:hover td { background: #f6fafa; }
.rq-row:focus-visible { outline: 2px solid var(--teal-600); outline-offset: -2px; }
.rq-row--fresh, .rq-row--fresh td { background: #f1fbf8; }
.rq-row--fresh td:first-child { box-shadow: inset 3px 0 0 var(--teal-600); }
.rq-row--locked td { color: #6d7d8b; }
.rq-row--locked .cell-main { color: #4b5e6e; }
.rq-num { font-weight: 750; white-space: nowrap; }
.rq-badge-new { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 999px; color: #fff; background: var(--teal-700); font-size: 10px; font-weight: 800; vertical-align: 1px; }
.rq-clip { display: -webkit-box; min-width: 140px; max-width: 280px; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
.rq-nowrap { white-space: nowrap; }
.rq-channel { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rq-channel__icon { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 7px; color: var(--teal-700); background: var(--teal-50); font-size: 10px; font-weight: 800; }
.rq-channel--whatsapp .rq-channel__icon { color: #0f7a46; background: #e6f6ec; }
.rq-channel--email .rq-channel__icon { color: var(--navy-800); background: #e8eef5; }
.rq-channel--manual .rq-channel__icon { color: var(--warning); background: var(--warning-bg); }
select.rq-status { width: auto; min-height: 30px; padding: 5px 24px 5px 10px; border: 1px solid transparent; font-size: 11px; cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
select.rq-status:hover { border-color: currentColor; }
select.rq-status:disabled { cursor: wait; opacity: .6; }
.rq-owner--free { color: var(--warning); font-weight: 700; }
.rq-owner--mine { color: var(--teal-700); font-weight: 700; }
.rq-owner--other { white-space: nowrap; }
.rq-due--overdue { color: var(--danger); font-weight: 750; }
.rq-due--overdue small { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.rq-actions__inner { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.rq-claim { min-height: 32px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
.rq-lock { display: inline-flex; align-items: center; gap: 5px; max-width: 190px; color: #8a5a52; font-size: 11px; font-weight: 650; }
.rq-lock span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rq-skeleton { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #edf1f3 25%, #f7f9fa 50%, #edf1f3 75%); background-size: 200% 100%; animation: rq-shimmer 1.2s linear infinite; }
@keyframes rq-shimmer { to { background-position: -200% 0; } }
.rq-dialog .field { margin-bottom: 12px; }
.rq-dialog > .muted { margin: -4px 0 14px; font-size: 13px; }
.rq-notice { margin: 0 0 16px; padding: 10px 13px; border-radius: 9px; color: var(--warning); background: var(--warning-bg); font-size: 12px; font-weight: 650; line-height: 1.5; }
.modal:has(.rq-card) { place-items: stretch; padding: 16px 16px 16px calc(252px + 16px); }
.modal__panel:has(.rq-card) { width: 100%; max-height: none; height: 100%; }
@media (max-width: 1050px) { .modal:has(.rq-card) { padding: 0; } .modal__panel:has(.rq-card) { border-radius: 0; } }
@media (min-width: 1400px) { .rq-card__grid { grid-template-columns: minmax(0, 1.6fr) minmax(340px, 1fr); } }
.rq-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; }
.rq-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; }
.rq-card__actions { display: flex; align-items: center; gap: 6px; }
.rq-card__grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.rq-card__main, .rq-card__side { display: grid; gap: 16px; min-width: 0; }
.rq-section { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rq-section > h3, .rq-section > summary { margin: 0 0 12px; font-size: 14px; font-weight: 750; }
.rq-section > summary { cursor: pointer; margin: 0; }
.rq-history-wrap[open] > summary { margin-bottom: 12px; }
.rq-section > p { margin: 0 0 8px; font-size: 13px; }
.rq-section .form-actions { margin-top: 10px; }
.rq-history-wrap { margin-top: 16px; }
.rq-chat { display: grid; gap: 8px; max-height: 340px; padding: 4px 2px; overflow-y: auto; }
.rq-bubble { justify-self: start; max-width: 85%; padding: 9px 12px; border-radius: 4px 12px 12px 12px; background: var(--canvas); }
.rq-bubble--out { justify-self: end; border-radius: 12px 4px 12px 12px; background: var(--teal-50); }
.rq-bubble p { margin: 0; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.rq-bubble time { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.rq-reply { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.rq-reply > p { margin: 0 0 8px; font-size: 12px; }
.rq-service > .muted { margin: 0 0 10px; font-size: 12px; }
.rq-service .field { margin-bottom: 12px; }
.rq-status-line { display: flex; align-items: center; gap: 6px; }
.rq-outcome { overflow-wrap: anywhere; }
.rq-status-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rq-status-actions .button { min-height: 34px; padding: 0 12px; font-size: 12px; }
.rq-assign .field { margin: 8px 0 0; }
.rq-history { display: grid; gap: 8px; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); list-style: none; }
.rq-history li { display: grid; gap: 2px; font-size: 13px; }
.rq-history small { font-size: 11px; }
.rq-segmented { display: inline-flex; gap: 0; margin: 0 0 14px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #eef2f4; }
.rq-segmented label { position: relative; }
.rq-segmented input { position: absolute; opacity: 0; width: 1px; min-height: 0; }
.rq-segmented span { display: inline-block; padding: 8px 14px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.rq-segmented input:checked + span { color: #fff; background: var(--teal-700); }
.rq-segmented input:focus-visible + span { outline: 2px solid var(--teal-600); outline-offset: 2px; }
.rq-convert__start { margin: 6px 0 12px; }
.rq-convert p.muted { margin: -6px 0 12px; font-size: 12px; }
.rq-picker { margin-bottom: 14px; }
.rq-picker .field { margin-bottom: 8px; }
.rq-picker__results { display: grid; gap: 4px; max-height: 220px; overflow-y: auto; }
.rq-picker__results > .muted { margin: 4px 0; font-size: 12px; }
.rq-picker__item { display: grid; gap: 2px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); text-align: left; cursor: pointer; }
.rq-picker__item small { color: var(--muted); font-size: 11px; }
.rq-picker__item:hover { border-color: #bdcbd4; }
.rq-picker__item.is-selected { border-color: var(--teal-600); background: var(--teal-50); }
.rq-picker__chosen { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.rq-picker__chosen.is-set { color: var(--teal-700); font-weight: 700; }
.client-leads-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }
.client-leads-head h3 { margin: 0; }
.client-lead { align-items: center; }
.client-lead > div { flex: 1; min-width: 0; }

.pill--resolved { color: var(--success); background: var(--success-bg); }
.pill--closed { color: #506272; background: #edf1f3; }
.pill--cancelled { color: var(--danger); background: var(--danger-bg); }
.rq-card-tabs { display:flex; gap:4px; margin-bottom:18px; border-bottom:1px solid var(--line); overflow-x:auto; }
.rq-card-tabs button { padding:12px 16px; border:0; border-bottom:3px solid transparent; color:var(--muted); background:transparent; font-weight:700; white-space:nowrap; }
.rq-card-tabs button[aria-selected="true"] { color:var(--teal-700); border-bottom-color:var(--teal-600); background:var(--teal-50); }
.rq-card-tabpanel { min-height:320px; }
.rq-card-tabpanel > .rq-card__grid > .rq-notice { grid-column:1/-1; margin-bottom:0; }
.rq-timer { display:flex; flex-wrap:wrap; align-items:center; gap:5px 10px; margin-top:14px!important; padding-top:12px; border-top:1px solid var(--line); }
.rq-timer__pause { color:var(--warning); font-weight:700; }
.rq-service-list { display:grid; gap:10px; margin:0; padding:0; list-style:none; }
.rq-service-list li { display:flex; justify-content:space-between; gap:12px; padding-bottom:9px; border-bottom:1px solid var(--line); font-size:13px; }
.rq-service-list span { color:var(--muted); text-align:right; }
.rq-service-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-bottom:24px; padding:18px; border:1px solid var(--line); border-radius:12px; background:var(--canvas); }
.rq-service-form > .field, .rq-service-form > .checkbox { margin:0; }
.rq-service-form > textarea, .rq-service-form > button, .rq-service-form > .form-alert { grid-column:1/-1; }
.rq-discount { margin:0 6px; color:var(--success); font-weight:700; }
.rq-discount + del { display:block; color:var(--muted); font-size:11px; }
.rq-documents-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.rq-documents-head h3 { margin:0; }
.rq-document-add { width:40px; min-height:40px; padding:0; font-size:22px; }
.rq-tab-loading > .state { min-height:260px; }
@media(max-width:650px){.rq-service-form{grid-template-columns:1fr}.rq-service-form > *{grid-column:1!important}.rq-service-list li{display:grid}.rq-service-list span{text-align:left}}

.priority-urgent { color: var(--danger); font-weight: 800; }
@media (max-width: 900px) {
  .rq-card__grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .rq-tabs { flex-wrap: nowrap; width: 100%; overflow-x: auto; }
  .rq-filters { flex-basis: 100%; }
  .rq-filters select, .rq-filters .button { flex: 1 1 140px; }
  .rq-columns-wrap { margin-left: 0; }
  .rq-columns { right: auto; left: 0; width: min(300px, calc(100vw - 32px)); }
  .rq-clip { max-width: 180px; }
  .rq-lock span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rq-skeleton { animation: none; }
}

/* Notifications («Уведомления») and agreed discounts */
.notification-list { display: grid; }
.notification-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-top: 1px solid var(--line); }
.notification-item:first-child { border-top: 0; }
.notification-item > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.notification-item strong { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.notification-item time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.notification-item.is-unread { background: var(--teal-50); box-shadow: inset 3px 0 0 var(--teal-600); }
.notification-item.is-unread strong { font-weight: 800; }
.notification-actions { display: flex; flex: none; gap: 6px; }
.pill--discount { color: var(--warning); background: var(--warning-bg); }
.pill--dc-new { color: var(--warning); background: var(--warning-bg); }
.pill--dc-approved { color: var(--success); background: var(--success-bg); }
.pill--dc-rejected { color: var(--danger); background: var(--danger-bg); }
.dc-period { display: inline-flex; align-items: center; gap: 6px; }
.dc-period input { width: auto; min-width: 140px; }
.dc-table td { vertical-align: middle; }
.dc-amount--down { color: var(--success); font-weight: 750; }
.dc-amount--up { color: var(--danger); font-weight: 750; }
.dc-row--target, .dc-row--target td { background: #fff8e6; }
.dc-row--target td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.dc-approve, .dc-reject { min-height: 32px; padding: 6px 11px; font-size: 12px; }
/* «Все письма» */
.mt-table td { vertical-align: middle; }
.mt-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.mt-emails { overflow-wrap: anywhere; }
.mt-type { display: inline-block; padding: 2px 7px; border-radius: 999px; color: #506272; background: #edf1f3; font-size: 10px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.mt-type--ip { color: var(--navy-800); background: #e8eef5; }
.mt-type--too { color: var(--teal-700); background: var(--teal-50); }
.mt-type--individual { color: var(--warning); background: var(--warning-bg); }
.mt-count { display: block; font-size: 15px; }
.mt-awaiting { display: inline-block; margin-top: 3px; padding: 2px 7px; border-radius: 999px; color: var(--warning); background: var(--warning-bg); font-size: 10px; font-weight: 800; }
.mt-row--awaiting td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.mt-open { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.modal__panel:has(.mt-modal) { width: min(900px, 100%); }
.mt-head { margin-bottom: 12px; }
.mt-head__info p { margin: 0 0 4px; font-size: 13px; }
.mt-head__party { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.mt-leads { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; padding: 0 0 12px; border-bottom: 1px solid var(--line); list-style: none; font-size: 12px; }
.mt-leads li { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.mt-thread { max-height: none; margin: 0; padding: 4px 2px; list-style: none; }
.mt-letter { min-width: min(320px, 85%); }
.mt-letter__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; margin-bottom: 4px; font-size: 12px; }
.mt-letter__lead { color: var(--muted); font-size: 11px; font-weight: 700; }
.mt-files { display: grid; gap: 3px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; }
.mt-files li { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 760px) {
  .notification-item { flex-direction: column; align-items: stretch; }
  .dc-period { flex: 1 1 100%; flex-wrap: wrap; }
}
