/* ==========================================================================
   e-Laborando Atendimento — Design system
   Identidade: azul-marinho #131629 · laranja #FB5200 · branco · Sora
   ========================================================================== */

@font-face {
  font-family: "Sora";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("../fonts/sora-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("../fonts/sora-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy: #131629;
  --navy-800: #1b1f38;
  --navy-700: #262b4a;
  --navy-600: #383e63;
  --orange: #fb5200;
  --orange-600: #dd4800;
  --orange-100: #ffe6d8;
  --orange-50: #fff4ee;

  --white: #ffffff;
  --g-25: #fbfbfc;
  --g-50: #f6f7f9;
  --g-100: #eef0f4;
  --g-200: #e3e6ec;
  --g-300: #cfd3dc;
  --g-400: #9ba1b0;
  --g-500: #6c7285;
  --g-600: #4e5468;
  --g-700: #353a4e;

  --text: var(--navy);
  --muted: var(--g-500);
  --border: var(--g-200);
  --surface: var(--white);
  --surface-2: var(--g-50);

  --success: #15803d;
  --success-bg: #ecfdf3;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --danger: #c2261d;
  --danger-bg: #fef2f2;
  --info: #1d4ed8;
  --info-bg: #eff6ff;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(19, 22, 41, .05);
  --shadow: 0 1px 3px rgba(19, 22, 41, .06), 0 1px 2px rgba(19, 22, 41, .04);
  --shadow-lg: 0 12px 32px -8px rgba(19, 22, 41, .18), 0 4px 8px -4px rgba(19, 22, 41, .08);
  --focus: 0 0 0 3px rgba(251, 82, 0, .22);

  --sidebar-w: 252px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 64px;
  --font: "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 .75em; }
a { color: var(--navy); text-decoration-color: var(--g-300); text-underline-offset: 3px; }
a:hover { color: var(--orange-600); text-decoration-color: currentColor; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; color: #fff; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 28px; height: 28px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ Layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns .2s ease; }
.app.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--navy); color: #c9cce0;
  display: flex; flex-direction: column;
  border-right: 1px solid #0c0e1d;
  z-index: 40;
}
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--orange); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; flex: none; letter-spacing: -.04em; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; background: #fff; }
.brand-text { color: #fff; font-weight: 600; font-size: 15px; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.brand-text span { display: block; font-size: 11px; font-weight: 400; color: #8f93ad; letter-spacing: .02em; margin-top: 2px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; scrollbar-width: thin; scrollbar-color: var(--navy-600) transparent; }
.nav-group { margin-bottom: 18px; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #6f7393; padding: 0 10px 6px; white-space: nowrap; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin-bottom: 2px;
  color: #c9cce0; text-decoration: none; border-radius: 8px; font-size: 13.5px; white-space: nowrap; position: relative;
}
.nav-link .icon { color: #8f93ad; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link:hover .icon { color: #fff; }
.nav-link.is-active { background: rgba(251, 82, 0, .14); color: #fff; }
.nav-link.is-active .icon { color: var(--orange); }
.nav-link.is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--orange); }
.nav-badge { margin-left: auto; background: var(--orange); color: #fff; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 10px; display: inline-grid; place-items: center; padding: 0 6px; }
.nav-badge:empty, .nav-badge[data-count="0"] { display: none; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-toggle { width: 100%; justify-content: flex-start; color: #8f93ad; background: transparent; border: 0; }
.sidebar-toggle:hover { background: rgba(255,255,255,.06); color: #fff; }

.app.is-collapsed .brand-text, .app.is-collapsed .nav-label, .app.is-collapsed .nav-text, .app.is-collapsed .sidebar-toggle .nav-text { display: none; }
.app.is-collapsed .nav-link { justify-content: center; padding: 10px; }
.app.is-collapsed .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.app.is-collapsed .sidebar-brand { padding: 0; justify-content: center; }
.app.is-collapsed .sidebar-toggle { justify-content: center; }
.app.is-collapsed .nav-label { height: 1px; background: rgba(255,255,255,.06); margin: 4px 8px 10px; padding: 0; }
.app.is-collapsed .nav-label { display: block; font-size: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.mobile-menu { display: none; }
.content { padding: 28px; flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; }
.content.is-full { max-width: none; padding: 0; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header p { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------ User menu */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--g-100); color: var(--navy-600); font-weight: 600; font-size: 12.5px; letter-spacing: .02em;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 17px; }
.avatar.is-accent { background: var(--orange-50); color: var(--orange-600); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; display: none;
}
.dropdown.is-open .dropdown-menu { display: block; animation: pop .14s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown-item:hover { background: var(--g-50); color: var(--text); }
.dropdown-item .icon { color: var(--g-500); }
.dropdown-header { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-header strong { display: block; font-size: 13px; }
.dropdown-header span { font-size: 12px; color: var(--muted); }

.notif-panel { width: 360px; padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--g-100); text-decoration: none; color: var(--text); }
.notif-item:hover { background: var(--g-50); color: var(--text); }
.notif-item.is-unread { background: var(--orange-50); }
.notif-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-top: 6px; flex: none; visibility: hidden; }
.notif-item.is-unread .dot { visibility: visible; }
.notif-item strong { font-size: 13px; font-weight: 600; display: block; }
.notif-item span { font-size: 12px; color: var(--muted); display: block; }
.bell-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); border: 2px solid #fff; display: none; }
.has-unread .bell-dot { display: block; }

/* ------------------------------------------------------------------ Buttons */
.btn {
  --btn-h: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font: 500 13.5px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  user-select: none;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-600); color: #fff; }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-700); color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--g-300); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--g-50); border-color: var(--g-400); color: var(--text); }
.btn-ghost { background: transparent; color: var(--g-600); }
.btn-ghost:hover { background: var(--g-100); color: var(--text); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f3c9c6; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #a11f17; color: #fff; }
.btn-sm { --btn-h: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { --btn-h: 46px; padding: 0 22px; font-size: 14.5px; }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn.is-loading .icon:first-child { animation: spin 1s linear infinite; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }
.btn-group .btn.is-active { background: var(--navy); color: #fff; border-color: var(--navy); position: relative; z-index: 1; }

/* ------------------------------------------------------------------ Forms */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px 18px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 12.5px; font-weight: 500; color: var(--g-700); }
.label .req { color: var(--orange); }
.hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--g-300); border-radius: 8px;
  background: #fff; color: var(--text); font: 400 13.5px var(--font);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.select { appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236c7285' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--g-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--orange); box-shadow: var(--focus); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input-sm, .select.input-sm { height: 34px; font-size: 13px; }
.input-group { position: relative; }
.input-group .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--g-400); pointer-events: none; }
.input-group .input { padding-left: 36px; }
.input-addon { display: flex; }
.input-addon .input { border-radius: 8px 0 0 8px; }
.input-addon .btn { border-radius: 0 8px 8px 0; height: 40px; margin-left: -1px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--orange); margin: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; background: var(--g-300); border-radius: 22px; position: relative; transition: background .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--orange); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }
.form-section { padding: 22px 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section-head { margin-bottom: 14px; }
.form-section-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.color-input { width: 46px; height: 40px; padding: 3px; border: 1px solid var(--g-300); border-radius: 8px; background: #fff; cursor: pointer; }

/* ------------------------------------------------------------------ Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { font-size: 14.5px; }
.card-header p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--g-25); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card + .card { margin-top: 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-wizard { grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.mt { margin-top: 20px; } .mt-sm { margin-top: 10px; } .mb { margin-bottom: 20px; } .mb-sm { margin-bottom: 10px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.kpi-label .icon { width: 15px; height: 15px; color: var(--g-400); }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -.03em; margin-top: 8px; line-height: 1.1; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.is-highlight { background: var(--navy); border-color: var(--navy); color: #fff; }
.kpi.is-highlight .kpi-label, .kpi.is-highlight .kpi-sub { color: #a7abc6; }
.kpi.is-highlight .kpi-label .icon { color: var(--orange); }
.kpi.is-accent::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--orange); }

/* ------------------------------------------------------------------ Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--g-25); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--g-100); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--g-25); }
.table .cell-main { font-weight: 500; color: var(--text); text-decoration: none; }
.table .cell-main:hover { color: var(--orange-600); }
.table .cell-sub { display: block; font-size: 12px; color: var(--muted); }
.table td.actions { text-align: right; white-space: nowrap; }
.table-compact td { padding: 9px 14px; }

/* ------------------------------------------------------------------ Badges & tags */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 500; background: var(--g-100); color: var(--g-600); white-space: nowrap; }
.badge .icon { width: 12px; height: 12px; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-accent { background: var(--orange-50); color: var(--orange-600); }
.badge-dark { background: var(--navy); color: #fff; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--g-200); background: #fff; color: var(--g-700); white-space: nowrap; }
.tag i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }

/* ------------------------------------------------------------------ Alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius); border: 1px solid; font-size: 13.5px; margin-bottom: 18px; }
.alert .icon { margin-top: 1px; }
.alert p:last-child { margin-bottom: 0; }
.alert-success { background: var(--success-bg); border-color: #bbe5c8; color: #14532d; }
.alert-error { background: var(--danger-bg); border-color: #f5c2bf; color: #7f1d1d; }
.alert-warning { background: var(--warning-bg); border-color: #f7dc9c; color: #78350f; }
.alert-info { background: var(--info-bg); border-color: #c9d9fb; color: #1e3a8a; }
.alert-accent { background: var(--orange-50); border-color: var(--orange-100); color: #7a2a00; }
.alert-close { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 0; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: var(--radius); background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastIn .2s ease; }
.toast.is-error { background: #7f1d1d; }
.toast .icon { color: var(--orange); }
.toast.is-error .icon { color: #fca5a5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------------ Modal */
.modal { position: fixed; inset: 0; z-index: 150; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(19, 22, 41, .45); animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-dialog { position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 40px); overflow-y: auto; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: pop .16s ease; }
.modal-dialog.is-wide { max-width: 720px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
.modal-body { padding: 14px 22px 4px; color: var(--g-600); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 22px 20px; }
.modal-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--orange-50); color: var(--orange-600); margin: 22px 22px 0; }
.modal-icon.is-danger { background: var(--danger-bg); color: var(--danger); }

/* ------------------------------------------------------------------ Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--g-500); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; font-size: 13.5px; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; font-family: inherit; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--orange); }
.tab .icon { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ Empty states & skeleton */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--g-100); color: var(--g-500); display: grid; place-items: center; margin: 0 auto 14px; }
.empty-icon .icon { width: 26px; height: 26px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 400px; margin: 0 auto 16px; }
.skeleton { background: linear-gradient(90deg, var(--g-100) 25%, var(--g-50) 50%, var(--g-100) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-block { height: 160px; }

/* Filters bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .input, .filters .select { height: 36px; font-size: 13px; width: auto; }
.filters .input-group { flex: 1; min-width: 200px; }
.filters .input-group .input { width: 100%; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.pagination-links { display: flex; gap: 4px; }

/* Description list */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: -6px; width: 1px; background: var(--g-200); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 2px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--g-300); }
.timeline li.is-accent::after { border-color: var(--orange); }
.timeline time { display: block; font-size: 11.5px; color: var(--muted); }

/* Progress steps (wizard) */
.steps { display: flex; flex-direction: column; gap: 4px; }
.step-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; text-decoration: none; color: var(--g-600); }
.step-link:hover { background: var(--g-50); color: var(--text); }
.step-link.is-current { background: var(--orange-50); color: var(--text); }
.step-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; border: 1.5px solid var(--g-300); color: var(--g-500); background: #fff; flex: none; }
.step-link.is-done .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.step-link.is-current .step-num { border-color: var(--orange); color: var(--orange-600); }
.code-box { display: flex; align-items: center; gap: 8px; background: var(--g-50); border: 1px solid var(--border); border-radius: 8px; padding: 8px 8px 8px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.code-box code { flex: 1; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--g-100); font-size: 13.5px; }
.checklist li:last-child { border-bottom: 0; }
.checklist .icon { margin-top: 2px; }
.st-ok { color: var(--success); } .st-warn { color: var(--warning); } .st-fail { color: var(--danger); }
ol.guide { padding-left: 20px; margin: 0 0 12px; }
ol.guide li { margin-bottom: 8px; }

/* ------------------------------------------------------------------ Charts */
.chart { width: 100%; min-height: 220px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--g-500); }
.chart .grid-line { stroke: var(--g-100); }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--g-600); margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tooltip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; padding: 7px 10px; border-radius: 7px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow-lg); z-index: 5; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 44px; align-items: center; gap: 12px; font-size: 13px; }
.hbar-track { height: 8px; background: var(--g-100); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--navy); border-radius: 4px; transition: width .5s ease; }
.hbar-row:first-child .hbar-fill { background: var(--orange); }
.hbar-row b { text-align: right; font-weight: 600; }
.split-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--g-100); }
.split-bar span { height: 100%; }

/* ------------------------------------------------------------------ Auth & installer */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
.auth-aside { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(251, 82, 0, .9); opacity: .9; }
.auth-aside::before { content: ""; position: absolute; right: 140px; bottom: 210px; width: 18px; height: 18px; border-radius: 4px; background: var(--orange); }
.auth-aside h1 { font-size: 34px; line-height: 1.15; max-width: 420px; letter-spacing: -.03em; }
.auth-aside h1 em { font-style: normal; color: var(--orange); }
.auth-aside p { color: #a7abc6; max-width: 380px; margin-top: 14px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 22px; margin-bottom: 6px; }
.auth-card > p { color: var(--muted); margin-bottom: 26px; }
.auth-card .field { margin-bottom: 16px; }
.installer { min-height: 100vh; background: var(--g-50); padding: 40px 20px; }
.installer-shell { max-width: 880px; margin: 0 auto; }
.installer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.installer-steps { display: flex; gap: 6px; margin-bottom: 22px; }
.installer-steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--g-200); }
.installer-steps span.is-done { background: var(--navy); }
.installer-steps span.is-current { background: var(--orange); }

/* ------------------------------------------------------------------ Inbox */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; height: calc(100vh - var(--topbar-h)); background: #fff; }
.inbox-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.inbox-list-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.inbox-filters { display: flex; gap: 6px; }
.inbox-filters .select { height: 32px; font-size: 12.5px; padding-left: 10px; }
.inbox-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.pill { height: 28px; padding: 0 11px; border-radius: 14px; border: 1px solid var(--g-200); background: #fff; font: 500 12px var(--font); color: var(--g-600); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pill:hover { border-color: var(--g-400); color: var(--text); }
.pill.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.pill b { font-weight: 600; }
.conv-items { overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: 11px; padding: 13px 14px; border-bottom: 1px solid var(--g-100); cursor: pointer; text-align: left; width: 100%; background: #fff; border-left: 3px solid transparent; font: inherit; color: inherit; }
.conv-item:hover { background: var(--g-25); }
.conv-item.is-active { background: var(--orange-50); border-left-color: var(--orange); }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: 11.5px; color: var(--muted); flex: none; }
.conv-preview { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.conv-meta { display: flex; gap: 5px; align-items: center; margin-top: 7px; flex-wrap: wrap; }
.conv-unread { background: var(--orange); color: #fff; font-size: 11px; font-weight: 600; min-width: 19px; height: 19px; border-radius: 10px; display: inline-grid; place-items: center; padding: 0 5px; }
.conv-item.has-unread .conv-name { color: var(--text); }
.conv-item.has-unread .conv-preview { color: var(--g-700); font-weight: 500; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--g-50); }
.chat-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 12px 18px; background: #fff; border-bottom: 1px solid var(--border); min-height: 64px; }
.chat-head-info { flex: 1 1 200px; min-width: 0; }
.chat-head-info strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-info span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chat-banner { display: flex; align-items: center; gap: 10px; padding: 9px 18px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.chat-banner.is-bot { background: var(--info-bg); color: #1e3a8a; }
.chat-banner.is-waiting { background: var(--orange-50); color: #7a2a00; }
.chat-banner.is-closed { background: var(--g-100); color: var(--g-600); }
.chat-banner.is-window { background: var(--warning-bg); color: #78350f; }
.chat-banner .btn { margin-left: auto; }
.messages { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { align-self: center; font-size: 11.5px; color: var(--g-500); background: #fff; border: 1px solid var(--border); padding: 3px 10px; border-radius: 10px; margin: 12px 0 8px; }
.msg { max-width: min(72%, 560px); display: flex; flex-direction: column; margin-top: 6px; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg-author { font-size: 11px; color: var(--muted); margin: 0 4px 3px; display: inline-flex; align-items: center; gap: 4px; }
.msg-author .icon { width: 12px; height: 12px; }
.bubble { padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; position: relative; box-shadow: var(--shadow-sm); }
.msg.in .bubble { background: #fff; border: 1px solid var(--g-200); border-top-left-radius: 4px; }
.msg.out .bubble { background: var(--navy); color: #fff; border-top-right-radius: 4px; }
.msg.out.bot .bubble { background: #e8eaf3; color: var(--navy); }
.msg.out.failed .bubble { background: var(--danger-bg); color: #7f1d1d; border: 1px solid #f5c2bf; }
.bubble-options { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.bubble-options span { font-size: 12px; padding: 5px 9px; border-radius: 7px; background: rgba(255,255,255,.7); border: 1px solid rgba(19,22,41,.08); color: var(--navy-600); display: flex; align-items: center; gap: 6px; }
.bubble-reply { font-size: 12px; padding: 6px 9px; margin-bottom: 6px; border-left: 3px solid var(--orange); background: rgba(19,22,41,.05); border-radius: 4px; color: inherit; opacity: .85; }
.msg.out .bubble-reply { background: rgba(255,255,255,.1); }
.bubble img { max-width: 100%; max-height: 300px; border-radius: 8px; display: block; margin-bottom: 4px; }
.bubble a.file { display: inline-flex; align-items: center; gap: 8px; color: inherit; font-weight: 500; }
.msg-meta { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin: 3px 4px 0; }
.msg-meta .icon { width: 14px; height: 14px; }
.msg-meta .st-read { color: #2563eb; }
.msg-meta .st-failed { color: var(--danger); }
.msg-tools { opacity: 0; transition: opacity .15s; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { opacity: 1; }
.msg-tools button { background: none; border: 0; padding: 0 2px; cursor: pointer; color: var(--g-500); font: inherit; font-size: 11px; display: inline-flex; align-items: center; gap: 3px; }
.msg-tools button:hover { color: var(--orange-600); }
.composer { background: #fff; border-top: 1px solid var(--border); padding: 12px 16px; position: relative; }
.composer-reply { display: none; align-items: center; gap: 10px; font-size: 12.5px; background: var(--g-50); border-left: 3px solid var(--orange); padding: 7px 10px; border-radius: 6px; margin-bottom: 8px; }
.composer-reply.is-on { display: flex; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; resize: none; min-height: 42px; max-height: 180px; border: 1px solid var(--g-300); border-radius: 10px; padding: 10px 12px; font: 400 13.5px/1.45 var(--font); color: var(--text); }
.composer textarea:focus { outline: none; border-color: var(--orange); box-shadow: var(--focus); }
.composer .btn-icon { --btn-h: 42px; }
.composer-hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; }
.qr-menu { position: absolute; left: 16px; right: 16px; bottom: calc(100% - 4px); background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; display: none; z-index: 10; }
.qr-menu.is-open { display: block; }
.qr-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; font: inherit; cursor: pointer; border-bottom: 1px solid var(--g-100); }
.qr-item:hover, .qr-item.is-active { background: var(--orange-50); }
.qr-item b { font-size: 12.5px; color: var(--orange-600); margin-right: 8px; }
.qr-item span { font-size: 12px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-empty { flex: 1; display: grid; place-items: center; }

.side { border-left: 1px solid var(--border); overflow-y: auto; background: #fff; }
.side-section { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.side-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.side-profile { text-align: center; padding: 22px 18px; border-bottom: 1px solid var(--border); }
.side-profile strong { display: block; margin-top: 10px; font-size: 15px; }
.side-profile span { font-size: 12.5px; color: var(--muted); }
.side-dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; font-size: 12.5px; }
.side-dl dt { color: var(--muted); }
.side-dl dd { margin: 0; text-align: right; word-break: break-word; }
.note { background: #fffaf0; border: 1px solid #f6e7c4; border-radius: 8px; padding: 9px 11px; font-size: 12.5px; margin-bottom: 8px; white-space: pre-wrap; }
.note small { display: block; color: var(--muted); margin-top: 4px; }
.mini-lead { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; font-size: 12.5px; text-decoration: none; color: var(--text); }
.mini-lead:hover { border-color: var(--g-400); color: var(--text); }
.inbox-back { display: none; }

/* ------------------------------------------------------------------ Kanban */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: 60vh; }
.kanban-col { flex: 0 0 280px; background: var(--g-100); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kanban-head { padding: 12px 14px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.kanban-head i { width: 8px; height: 8px; border-radius: 50%; }
.kanban-head .count { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 12px; background: #fff; border-radius: 10px; padding: 1px 8px; }
.kanban-cards { padding: 0 10px 10px; overflow-y: auto; flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.kanban-cards.is-over { background: rgba(251, 82, 0, .06); outline: 2px dashed var(--orange-100); outline-offset: -4px; border-radius: 10px; }
.kcard { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: grab; box-shadow: var(--shadow-sm); text-decoration: none; color: var(--text); display: block; }
.kcard:hover { border-color: var(--g-300); color: var(--text); }
.kcard.is-dragging { opacity: .5; }
.kcard strong { font-size: 13px; display: block; }
.kcard .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kcard .k-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.kcard .select { height: 28px; font-size: 11.5px; margin-top: 8px; display: none; }
.kanban-empty { font-size: 12px; color: var(--g-400); text-align: center; padding: 18px 0; }

/* ------------------------------------------------------------------ Flow editor */
.flow-editor { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.step-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 260px); overflow-y: auto; padding: 4px; }
.step-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.step-card:hover { border-color: var(--g-400); }
.step-card.is-active { border-color: var(--orange); box-shadow: var(--focus); }
.step-card.is-start { border-left: 3px solid var(--orange); }
.step-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--g-100); color: var(--navy-600); flex: none; }
.step-ico .icon { width: 16px; height: 16px; }
.step-ico.t-menu, .step-ico.t-question { background: #eef2ff; color: #4338ca; }
.step-ico.t-condition, .step-ico.t-goto { background: #fef3c7; color: #92400e; }
.step-ico.t-handoff, .step-ico.t-create_lead { background: var(--orange-50); color: var(--orange-600); }
.step-ico.t-end { background: var(--g-200); color: var(--g-700); }
.step-card-body { min-width: 0; flex: 1; }
.step-card-body strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-card-body span { font-size: 11.5px; color: var(--muted); }
.step-links { font-size: 11px; color: var(--g-500); display: flex; align-items: center; gap: 3px; margin-top: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.option-row, .rule-row { display: grid; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--g-25); }
.option-row { grid-template-columns: 1.3fr 1fr 1fr auto; }
.rule-row { grid-template-columns: 1fr 1fr 1fr 1fr auto; }
.option-extra { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.var-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.var-chip { font: 500 11.5px ui-monospace, Menlo, monospace; padding: 3px 7px; border-radius: 5px; background: var(--g-100); border: 0; cursor: pointer; color: var(--navy-600); }
.var-chip:hover { background: var(--orange-50); color: var(--orange-600); }
.editor-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.issues { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.issues li { display: flex; gap: 8px; padding: 5px 0; }

/* Simulator */
.simulator { position: fixed; right: 20px; bottom: 20px; width: 370px; height: min(640px, calc(100vh - 100px)); background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); display: none; flex-direction: column; z-index: 120; overflow: hidden; }
.simulator.is-open { display: flex; animation: pop .16s ease; }
.sim-head { background: var(--navy); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.sim-head strong { flex: 1; font-size: 13.5px; }
.sim-head .btn-ghost { color: #c9cce0; }
.sim-head .btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.sim-body { flex: 1; overflow-y: auto; padding: 14px; background: #efe9e1; display: flex; flex-direction: column; gap: 6px; }
.sim-msg { max-width: 85%; padding: 8px 11px; border-radius: 10px; font-size: 13px; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.sim-msg.bot { background: #fff; align-self: flex-start; border-top-left-radius: 3px; }
.sim-msg.user { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 3px; }
.sim-msg.sys { align-self: center; background: rgba(255,255,255,.8); font-size: 11.5px; color: var(--g-600); }
.sim-buttons { display: flex; flex-direction: column; gap: 4px; align-self: flex-start; width: 85%; }
.sim-buttons button { background: #fff; border: 0; border-radius: 8px; padding: 8px; color: #027eb5; font: 500 12.5px var(--font); cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.sim-buttons button:hover { background: #f5f5f5; }
.sim-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.sim-vars { font-size: 11px; padding: 8px 12px; background: var(--g-50); border-top: 1px solid var(--border); color: var(--g-600); max-height: 74px; overflow-y: auto; }

/* ------------------------------------------------------------------ Responsivo */
@media (max-width: 1280px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox .side { display: none; }
  .inbox.show-side .side { display: block; position: fixed; right: 0; top: var(--topbar-h); bottom: 0; width: 320px; box-shadow: var(--shadow-lg); z-index: 35; }
}
@media (max-width: 1100px) {
  .grid-sidebar, .grid-wizard { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .flow-editor { grid-template-columns: 1fr; }
  .step-list { max-height: 320px; }
}
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .app, .app.is-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; }
  .app.is-mobile-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.is-mobile-open::after { content: ""; position: fixed; inset: 0; background: rgba(19,22,41,.4); z-index: 35; }
  .app.is-collapsed .brand-text, .app.is-collapsed .nav-text { display: initial; }
  .mobile-menu { display: inline-flex; }
  .sidebar-footer { display: none; }
  .topbar { padding: 0 14px; }
  .content { padding: 18px 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .col-8, .col-6, .col-4, .col-3 { grid-column: span 12; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .inbox { grid-template-columns: 1fr; }
  .inbox .chat { display: none; }
  .inbox.is-chat .inbox-list { display: none; }
  .inbox.is-chat .chat { display: flex; }
  .inbox-back { display: inline-flex; }
  .msg { max-width: 88%; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .option-row, .rule-row, .option-extra { grid-template-columns: 1fr; }
  .simulator { right: 8px; left: 8px; width: auto; bottom: 8px; }
  .kcard .select { display: block; }
  .table th:nth-child(n+4), .table td:nth-child(n+4):not(.actions) { display: none; }
  .hbar-row { grid-template-columns: 1fr 44px; }
  .hbar-row .hbar-track { grid-column: 1 / -1; grid-row: 2; }
  .page-header { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
