:root {
  --orange: #f47b24;
  --orange-dark: #b5450c;
  --orange-soft: #fff0e5;
  --ink: #252527;
  --charcoal: #303135;
  --muted: #747477;
  --quiet: #a3a3a5;
  --canvas: #f7f6f3;
  --surface: #ffffff;
  --line: #e5e2dd;
  --line-strong: #d3cec7;
  --green: #20835c;
  --green-soft: #e4f3ed;
  --amber: #a96a06;
  --amber-soft: #fff2d7;
  --red: #b54a42;
  --red-soft: #fce9e7;
  --purple: #6952a2;
  --purple-soft: #eee9fa;
  --shadow: 0 16px 42px rgba(38, 35, 31, .08);
  --radius: 18px;
  font-family: Avenir, "Avenir Next", 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 { width: 100%; min-height: 100%; margin: 0; }
body { min-width: 320px; overflow: hidden; background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(244, 123, 36, .22); outline-offset: 2px; }
img { max-width: 100%; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 10000; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; }
.skip-link:focus { top: 12px; }
.eyebrow { margin: 0; color: var(--orange-dark); font-size: 11px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.form-error { min-height: 20px; margin: 2px 0 0; color: var(--red); font-size: 13px; font-weight: 700; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(440px, .82fr); background: var(--surface); }
.login-brand { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(36px, 6vw, 86px); color: #fff; background: var(--charcoal); }
.login-brand > img { width: 230px; padding: 20px; border-radius: 18px; background: #fff; }
.login-brand h1 { max-width: 620px; margin: 14px 0 0; font-size: clamp(42px, 6vw, 82px); line-height: .96; letter-spacing: -.055em; }
.login-brand .eyebrow { color: #ffb883; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-form { width: min(430px, 100%); }
.login-form > img { display: none; width: 190px; margin-bottom: 40px; }
.login-form h2 { margin: 12px 0 8px; font-size: 38px; letter-spacing: -.04em; }
.login-form > .muted { margin: 0 0 32px; }
label { display: grid; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 800; }
label small { color: var(--muted); font-weight: 500; }
input, textarea, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; color: var(--ink); }
input, select { min-height: 48px; padding: 0 14px; }
textarea { padding: 13px 14px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #aaa8a6; }
.login-form input { margin-bottom: 18px; }

.button { min-height: 44px; padding: 0 18px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; font-size: 13px; font-weight: 850; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.button:hover { border-color: #aaa49d; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .55; }
.button.primary { border-color: var(--orange); background: var(--orange); color: #fff; }
.button.primary:hover { border-color: #db6616; background: #db6616; }
.button.danger { border-color: #ecc1bc; color: var(--red); }
.button.danger:hover { background: var(--red-soft); }
.button.wide { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.text-button { padding: 7px 0; border: 0; background: transparent; color: var(--orange-dark); font-size: 13px; font-weight: 850; }
.text-button:hover { text-decoration: underline; }

.app-shell { height: 100vh; display: grid; grid-template-columns: 278px minmax(0, 1fr); background: var(--canvas); border-top: 3px solid var(--orange); }
.sidebar { position: relative; z-index: 10; min-height: 0; display: flex; flex-direction: column; padding: 28px 22px 18px; overflow: hidden; background: var(--charcoal); color: #fff; }
.sidebar-brand { height: 88px; display: grid; place-items: center; padding: 14px 22px; border-radius: 16px; background: #fff; }
.sidebar-brand img { width: 180px; height: auto; }
.channel-card { display: flex; gap: 11px; align-items: center; margin-top: 22px; padding: 14px 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 13px; background: rgba(255,255,255,.035); }
.channel-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 6px rgba(255,255,255,.06); }
.channel-card.connected .channel-dot { background: #50bd83; }
.channel-card strong, .channel-card small { display: block; }
.channel-card small { margin-bottom: 3px; color: #aeadb0; font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.channel-card strong { font-size: 13px; }
.sidebar-nav { flex: 1; min-height: 0; margin: 28px -6px 0; overflow-y: auto; }
.sidebar-nav > p { margin: 22px 12px 8px; color: #929296; font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.nav-item { width: 100%; min-height: 46px; display: flex; gap: 12px; align-items: center; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: #c2c2c4; text-align: left; font-size: 13px; font-weight: 750; }
.nav-item span { color: #86868a; font-size: 10px; font-weight: 900; }
.nav-item b { min-width: 24px; margin-left: auto; padding: 3px 7px; border-radius: 99px; background: rgba(255,255,255,.09); color: #fff; text-align: center; font-size: 10px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.045); }
.nav-item.active { position: relative; background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -6px; width: 3px; height: 24px; border-radius: 0 3px 3px 0; background: var(--orange); }
.nav-item.active span { color: #ff9e57; }
.sidebar-footer { padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.availability-card { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 10px 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 11px; background: transparent; color: #fff; }
.availability-card > span { display: flex; gap: 8px; align-items: center; }
.availability-card i, .availability-button i { width: 8px; height: 8px; border-radius: 50%; background: #8c8c8f; }
.availability-card.online i, .availability-button.online i { background: #50bd83; box-shadow: 0 0 0 5px rgba(80,189,131,.12); }
.availability-card small { color: #99999d; font-size: 8px; font-style: normal; font-weight: 900; letter-spacing: .11em; }
.availability-card strong { font-size: 11px; }
.profile-wrap { position: relative; }
.profile-toggle { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; margin-top: 10px; padding: 8px; border: 0; border-radius: 10px; background: transparent; color: #fff; text-align: left; }
.profile-toggle:hover { background: rgba(255,255,255,.05); }
.profile-toggle > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); font-weight: 900; }
.profile-toggle strong, .profile-toggle small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-toggle strong { font-size: 12px; }
.profile-toggle small { margin-top: 2px; color: #a6a6a9; font-size: 10px; }
.profile-menu { position: absolute; left: 0; right: 0; bottom: 54px; padding: 6px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: #242528; box-shadow: 0 -14px 32px rgba(0,0,0,.28); }
.profile-menu button { width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: #fff; text-align: left; font-size: 12px; font-weight: 700; }
.profile-menu button:hover { background: rgba(255,255,255,.08); }

.main { min-width: 0; min-height: 0; overflow: hidden; }
.topbar { height: 70px; display: flex; justify-content: space-between; align-items: center; padding: 0 36px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.82); backdrop-filter: blur(12px); }
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb span { margin: 0 10px; color: var(--line-strong); }
.breadcrumb strong { color: var(--ink); }
.topbar-actions { display: flex; gap: 16px; align-items: center; }
.sync-label { color: var(--quiet); font-size: 11px; }
.page { height: calc(100vh - 73px); padding: 36px clamp(24px, 4vw, 58px) 60px; overflow: auto; scroll-behavior: smooth; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 28px; }
.page-heading h1 { margin: 7px 0 5px; font-size: clamp(34px, 4vw, 52px); line-height: 1; letter-spacing: -.055em; }
.page-heading p:last-child { margin: 0; font-size: 15px; }
.heading-actions { display: flex; gap: 10px; align-items: center; }

.metrics-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.metric { min-height: 142px; padding: 24px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric.highlight { border-top: 4px solid var(--orange); background: var(--orange-soft); }
.metric small { display: block; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.metric strong { display: block; margin: 15px 0 6px; font-size: 38px; line-height: 1; letter-spacing: -.04em; }
.metric span { color: var(--quiet); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .7fr); gap: 22px; margin-top: 22px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.card-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.list-row { width: 100%; display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(120px, .8fr) 110px 40px; gap: 18px; align-items: center; min-height: 72px; padding: 13px 18px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #faf9f7; }
.list-row strong, .list-row small { display: block; }
.list-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.list-row small { margin-top: 4px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.arrow { color: var(--orange); font-size: 20px; text-align: right; }

.badge { display: inline-flex; width: fit-content; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 99px; background: #efeeec; color: #656568; font-size: 10px; font-weight: 850; white-space: nowrap; }
.badge.waiting { background: var(--amber-soft); color: var(--amber); }
.badge.assigned { background: var(--orange-soft); color: var(--orange-dark); }
.badge.active { background: var(--green-soft); color: var(--green); }
.badge.closed { background: #ecebea; color: #77777a; }
.badge.manager { background: var(--purple-soft); color: var(--purple); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.deadline { font-size: 11px; font-weight: 800; color: var(--muted); }
.deadline.urgent { color: var(--red); }

.distribution-mini { padding: 8px 20px 18px; }
.distribution-state { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.distribution-state:last-child { border-bottom: 0; }
.distribution-state > span { display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #efede9; color: #5e5d60; font-size: 11px; font-weight: 900; }
.avatar.online { background: var(--green-soft); color: var(--green); }
.distribution-state strong, .distribution-state small { display: block; }
.distribution-state strong { font-size: 12px; }
.distribution-state small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.filters { display: grid; grid-template-columns: minmax(240px, 1fr) 190px 190px auto; gap: 10px; margin-bottom: 18px; }
.filters input, .filters select { min-height: 46px; }
.inbox-shell { height: calc(100vh - 238px); min-height: 520px; display: grid; grid-template-columns: 370px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.conversation-list-pane { min-width: 0; overflow-y: auto; border-right: 1px solid var(--line); background: #fbfaf8; }
.conversation-row { width: 100%; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; padding: 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.conversation-row:hover { background: #fff; }
.conversation-row.selected { background: var(--orange-soft); box-shadow: inset 3px 0 var(--orange); }
.conversation-row.unread .conversation-name { font-weight: 900; }
.conversation-name-line { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.conversation-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 750; }
.conversation-time { color: var(--quiet); font-size: 9px; white-space: nowrap; }
.conversation-preview { margin: 5px 0 8px; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.conversation-preview.has-draft { color: #6f3a14; }
.conversation-draft-label { color: var(--orange-dark); font-weight: 850; }
.conversation-meta { display: flex; gap: 6px; align-items: center; }
.unread-count { min-width: 20px; height: 20px; display: grid; place-items: center; align-self: center; border-radius: 99px; background: var(--orange); color: #fff; font-size: 9px; font-style: normal; font-weight: 900; }
.chat-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.chat-empty { flex: 1; display: grid; place-items: center; padding: 36px; text-align: center; }
.chat-empty-mark { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 18px; border: 1px solid var(--line); border-radius: 50%; color: var(--orange); font-size: 22px; font-weight: 900; }
.chat-empty h2 { margin: 0 0 8px; font-size: 24px; }
.chat-empty p { max-width: 420px; margin: 0; color: var(--muted); font-size: 13px; }
.chat-header { display: flex; justify-content: space-between; gap: 18px; align-items: center; min-height: 78px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.chat-person { min-width: 0; display: flex; gap: 12px; align-items: center; }
.chat-person strong, .chat-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-person strong { font-size: 14px; }
.chat-person small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.mobile-back { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.chat-actions { display: flex; gap: 8px; }
.chat-actions .button { min-height: 38px; padding: 0 12px; }
.chat-context { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #fbfaf8; }
.chat-summary { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.messages { flex: 1; min-height: 0; padding: 22px; overflow-y: auto; background-color: #f8f7f4; background-image: radial-gradient(#dfddd8 0.7px, transparent 0.7px); background-size: 16px 16px; }
.message-day { width: fit-content; margin: 6px auto 20px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.92); color: var(--muted); font-size: 9px; font-weight: 800; }
.message { width: fit-content; max-width: min(72%, 620px); margin: 0 0 12px; padding: 11px 13px 8px; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; background: #fff; box-shadow: 0 4px 13px rgba(38,35,31,.04); }
.message.outbound { margin-left: auto; border-color: #f5c9aa; border-radius: 14px 4px 14px 14px; background: var(--orange-soft); }
.message.ai { border-color: #ddd5ef; background: var(--purple-soft); }
.message p { margin: 0; white-space: pre-wrap; font-size: 13px; line-height: 1.5; }
.message footer { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; color: var(--quiet); font-size: 9px; }
.message.failed footer { color: var(--red); }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); background: #fff; }
.composer textarea { min-height: 46px; max-height: 140px; overflow-y: auto; resize: none; }
.composer .button { min-width: 110px; }
.read-only { padding: 13px 18px; border-top: 1px solid var(--line); background: #fbfaf8; color: var(--muted); text-align: center; font-size: 11px; }

.status-strip { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.status-strip i { width: 9px; height: 9px; border-radius: 50%; background: var(--quiet); }
.status-strip.active i { background: var(--green); }
.status-strip strong { font-size: 12px; }
.roster-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .65fr); gap: 22px; }
.roster-list { padding: 8px 20px 18px; }
.roster-row { display: grid; grid-template-columns: 32px 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.roster-row:last-child { border-bottom: 0; }
.roster-row input { width: 18px; min-height: auto; height: 18px; }
.roster-row strong, .roster-row small { display: block; }
.roster-row strong { font-size: 13px; }
.roster-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.roster-controls { display: flex; gap: 5px; }
.roster-controls button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.roster-controls button:disabled { opacity: .35; }
.info-panel { padding: 22px; }
.info-panel h3 { margin: 0 0 14px; font-size: 18px; }
.info-number { display: block; margin: 8px 0; font-size: 52px; letter-spacing: -.05em; }
.info-panel > p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.info-panel .button { width: 100%; margin-top: 8px; }
.info-panel .button + .button { margin-top: 8px; }

.table-card { overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 12px 18px; border-bottom: 1px solid var(--line); background: #f9f8f6; color: var(--muted); text-align: left; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.table td { padding: 16px 18px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table strong, .table small { display: block; }
.table small { margin-top: 3px; color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-actions button { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 10px; font-weight: 800; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 22px; }
.settings-form { padding: 24px; }
.settings-section + .settings-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 6px; font-size: 17px; }
.settings-section > p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.weekday-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.weekday-picker label { display: block; }
.weekday-picker input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-picker span { min-width: 42px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-size: 10px; }
.weekday-picker input:checked + span { border-color: var(--orange); background: var(--orange-soft); color: var(--orange-dark); font-weight: 900; }
.switch-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-copy strong, .switch-copy small { display: block; }
.switch-copy strong { font-size: 12px; }
.switch-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.switch { position: relative; width: 44px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #d4d2cf; transition: background .15s ease; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.channel-panel { padding: 22px; }
.channel-panel img { width: 150px; margin-bottom: 22px; }
.channel-panel h3 { margin: 0 0 6px; }
.channel-panel p { margin: 0 0 20px; color: var(--muted); font-size: 12px; line-height: 1.55; }

.empty-state { display: grid; place-items: center; min-height: 240px; padding: 34px; text-align: center; }
.empty-state strong { display: block; margin-bottom: 7px; font-size: 17px; }
.empty-state p { max-width: 420px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice { margin-bottom: 18px; padding: 13px 16px; border: 1px solid #edc1bd; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 12px; font-weight: 700; }
.skeleton { position: relative; overflow: hidden; background: #eceae6; color: transparent !important; border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.68), transparent); animation: skeleton 1.3s infinite; }
@keyframes skeleton { to { transform: translateX(100%); } }
.skeleton-card { height: 142px; border-radius: var(--radius); }
.skeleton-line { height: 13px; margin: 13px 18px; }

.mobile-header, .mobile-bottom-nav { display: none; }
.dialog { width: min(540px, calc(100vw - 30px)); max-height: calc(100vh - 30px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: 0 28px 80px rgba(25,24,22,.25); }
.dialog::backdrop { background: rgba(26,25,24,.55); backdrop-filter: blur(5px); }
.dialog-head { position: sticky; top: 0; z-index: 2; min-height: 78px; display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.dialog-head h2 { margin: 6px 0 0; font-size: 22px; }
.dialog-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--muted); font-size: 22px; }
.dialog-body { padding: 22px; }
.form-stack { display: grid; gap: 15px; }
.dialog-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; padding: 15px 22px; border-top: 1px solid var(--line); background: #fff; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 1000; max-width: min(420px, calc(100vw - 44px)); padding: 13px 16px; border-radius: 12px; background: #26272a; color: #fff; box-shadow: 0 18px 45px rgba(0,0,0,.24); font-size: 12px; font-weight: 700; }
.toast.error { background: var(--red); }
.update-prompt { position: fixed; right: 22px; bottom: 22px; z-index: 900; display: flex; gap: 22px; align-items: center; padding: 16px; border: 1px solid #f2b98f; border-top: 4px solid var(--orange); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.update-prompt strong { display: block; margin-top: 4px; font-size: 13px; }
.update-prompt small { display: block; max-width: 280px; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-right: 0; }
  .metric:nth-child(n+4) { border-top: 1px solid var(--line); }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: minmax(220px, 1fr) 170px 170px; }
  .filters .button { grid-column: auto; }
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .login-shell { display: block; min-height: 100dvh; padding: 32px 22px; background: #fff; }
  .login-brand { display: none; }
  .login-panel { min-height: calc(100dvh - 64px); padding: 0; }
  .login-form > img { display: block; }
  .login-form h2 { font-size: 32px; }
  .app-shell { min-height: 100dvh; height: auto; display: block; border-top: 0; }
  .sidebar, .topbar { display: none; }
  .mobile-header { position: fixed; inset: 0 0 auto; z-index: 30; height: 64px; display: flex; justify-content: space-between; align-items: center; padding: max(8px, env(safe-area-inset-top)) 16px 8px; border-top: 3px solid var(--orange); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
  .mobile-header img { width: 118px; height: auto; }
  .availability-button { display: flex; gap: 8px; align-items: center; min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-size: 10px; font-weight: 850; }
  .main { overflow: visible; }
  .page { height: auto; min-height: 100dvh; padding: 88px 14px calc(86px + env(safe-area-inset-bottom)); overflow: visible; }
  .page-heading { align-items: flex-start; margin-bottom: 20px; }
  .page-heading h1 { font-size: 35px; }
  .page-heading p:last-child { font-size: 13px; }
  .heading-actions { align-self: center; }
  .heading-actions .button.secondary-label { width: 42px; padding: 0; font-size: 0; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 15px; }
  .metric { min-height: 116px; padding: 18px; }
  .metric:nth-child(even) { border-right: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metric:nth-child(3) { border-right: 1px solid var(--line); }
  .metric:last-child { grid-column: 1 / -1; border-right: 0; }
  .metric strong { margin-top: 12px; font-size: 32px; }
  .dashboard-grid, .roster-layout, .settings-grid { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
  .card { border-radius: 15px; box-shadow: 0 10px 28px rgba(38,35,31,.06); }
  .list-row { grid-template-columns: minmax(0, 1fr) 92px 22px; gap: 9px; padding: 13px 14px; }
  .list-row > :nth-child(2) { display: none; }
  .filters { grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters > :first-child { grid-column: 1 / -1; }
  .filters .manager-filter { grid-column: 1 / -1; }
  .filters .button { min-width: 0; }
  .inbox-shell { height: calc(100dvh - 238px); min-height: 480px; display: block; margin: 0 -14px; border-right: 0; border-left: 0; border-radius: 0; box-shadow: none; }
  .conversation-list-pane { height: 100%; border-right: 0; }
  .chat-pane { display: none; height: 100%; }
  .inbox-shell.chat-open .conversation-list-pane { display: none; }
  .inbox-shell.chat-open .chat-pane { display: flex; }
  .mobile-back { display: block; }
  .chat-header { min-height: 66px; padding: 10px 12px; }
  .chat-actions .button { min-width: 38px; padding: 0 9px; font-size: 0; }
  .chat-actions .button::first-letter { font-size: 12px; }
  .chat-context { padding: 9px 14px; }
  .messages { padding: 16px 12px; }
  .message { max-width: 86%; }
  .composer { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .composer .button { min-width: 76px; padding: 0 12px; }
  .mobile-bottom-nav { position: fixed; inset: auto 0 0; z-index: 40; min-height: 64px; display: flex; justify-content: space-around; padding: 6px 6px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
  .mobile-nav-item { position: relative; min-width: 54px; display: grid; place-items: center; gap: 2px; padding: 5px 7px; border: 0; border-radius: 10px; background: transparent; color: #858589; }
  .mobile-nav-item b { font-size: 9px; }
  .mobile-nav-item span { font-size: 9px; font-weight: 800; }
  .mobile-nav-item i { position: absolute; top: 1px; right: 4px; min-width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); color: #fff; font-size: 8px; font-style: normal; font-weight: 900; }
  .mobile-nav-item.active { background: var(--orange-soft); color: var(--orange-dark); }
  .table-card { overflow-x: auto; }
  .table { min-width: 720px; }
  .form-grid { grid-template-columns: 1fr; }
  .dialog { width: 100vw; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .toast { right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); max-width: calc(100vw - 28px); }
  .update-prompt { left: 14px; right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); }
}

@media (max-width: 470px) {
  .page-heading { display: block; }
  .heading-actions { margin-top: 14px; }
  .metric { min-height: 108px; padding: 15px; }
  .metric strong { font-size: 29px; }
  .card-head { padding: 18px; }
  .filters { grid-template-columns: 1fr; }
  .filters > * { grid-column: 1 !important; }
  .inbox-shell { height: calc(100dvh - 292px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Navegação orientada a conversas — superfícies brancas e contraste preto. */
:root {
  color-scheme: light;
  --orange-dark: #111112;
  --orange-soft: #f2f2f2;
  --ink: #111112;
  --charcoal: #111112;
  --muted: #66666a;
  --quiet: #96969a;
  --canvas: #ffffff;
  --surface: #ffffff;
  --line: #e5e5e5;
  --line-strong: #cfcfcf;
  --green-soft: #f2f2f2;
  --amber-soft: #f2f2f2;
  --red-soft: #f4f4f4;
  --purple: #111112;
  --purple-soft: #eeeeee;
  --shadow: 0 14px 40px rgba(0, 0, 0, .07);
  --radius: 14px;
  background: #fff;
}

html, body { color-scheme: light; background: #fff; }
body { overflow: hidden; }
input, textarea, select { color-scheme: light; border-color: var(--line-strong); border-radius: 9px; }
.eyebrow { color: #111112; }
.login-shell { background: #fff; }
.login-brand { background: #111112; }
.login-brand .eyebrow { color: #fff; }
.button { border-radius: 9px; box-shadow: none; }
.button.primary { border-color: #111112; background: #111112; color: #fff; }
.button.primary:hover { border-color: #2d2d2f; background: #2d2d2f; }
.text-button { color: #111112; }

.app-shell {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 76px minmax(0, 1fr);
  grid-template-areas:
    "header"
    "main";
  border: 0;
  background: #fff;
}

.app-shell[data-view="inbox"] {
  grid-template-columns: 360px minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "sidebar main";
}

.app-header {
  grid-area: header;
  position: relative;
  z-index: 40;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.header-nav { min-width: 0; display: flex; gap: 4px; align-items: center; }
.header-nav-item {
  min-height: 40px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #66666a;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.header-nav-item:hover { background: #f3f3f3; color: #111112; }
.header-nav-item:active { transform: translateY(1px); }
.header-nav-item.active { background: #111112; color: #fff; }
.header-nav-item b {
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 6px;
  background: #ececec;
  color: #111112;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}
.header-nav-item.active b { background: #fff; }

.header-tools { min-width: 0; display: flex; gap: 12px; align-items: center; margin-left: auto; }
.sync-label { color: var(--quiet); font-size: 10px; white-space: nowrap; }
.refresh-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #111112;
  font-size: 18px;
  transition: background .2s ease, transform .2s ease;
}
.refresh-button:hover { background: #f3f3f3; }
.refresh-button:active { transform: rotate(16deg); }
.refresh-button.loading { animation: refresh-button-spin .8s linear infinite; }
@keyframes refresh-button-spin { to { transform: rotate(360deg); } }
.header-brand {
  width: 138px;
  min-height: 52px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
}
.header-brand:hover .header-logo { opacity: .72; }
.header-brand:active .header-logo { transform: translateY(1px); }
.header-logo { width: 112px; height: auto; margin: 0; transition: opacity .2s ease, transform .2s ease; }

.profile-wrap { position: relative; }
.profile-toggle {
  width: auto;
  min-width: 188px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  color: #111112;
  text-align: left;
  transition: border-color .2s ease, background .2s ease;
}
.profile-toggle:hover, .profile-toggle[aria-expanded="true"] { border-color: var(--line); background: #f7f7f7; }
.profile-toggle > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #111112; color: #fff; font-weight: 900; }
.profile-toggle strong, .profile-toggle small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-toggle strong { font-size: 12px; }
.profile-toggle small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.profile-toggle > b { color: var(--muted); font-size: 12px; }
.profile-menu {
  position: absolute;
  inset: calc(100% + 9px) 0 auto auto;
  width: 238px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #111112;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .14);
}
.profile-menu > p { margin: 6px 10px 5px; color: var(--quiet); font-size: 9px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.profile-menu button { width: 100%; min-height: 40px; display: flex; gap: 9px; align-items: center; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: #111112; text-align: left; font-size: 12px; font-weight: 720; }
.profile-menu button:hover { background: #f2f2f2; }
.profile-menu-divider { display: block; height: 1px; margin: 7px 4px; background: var(--line); }
.manager-mode-switch { display: grid; gap: 5px; margin: 7px 0 9px; }
.manager-mode-switch[hidden] { display: none; }
.profile-menu .manager-mode-switch button { position: relative; min-height: 54px; display: grid; gap: 2px; align-content: center; padding: 8px 34px 8px 11px; border: 1px solid transparent; }
.manager-mode-switch button span, .manager-mode-switch button small { display: block; }
.manager-mode-switch button span { font-size: 12px; font-weight: 850; }
.manager-mode-switch button small { color: #838387; font-size: 9px; font-weight: 650; }
.manager-mode-switch button.active { border-color: #111112; background: #111112; color: #fff; }
.manager-mode-switch button.active::after { content: "✓"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; }
.manager-mode-switch button.active small { color: #c8c8ca; }
.profile-availability i, .availability-button i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #a6a6a6; }
.profile-availability.online i, .availability-button.online i { background: var(--green); box-shadow: none; }

.sidebar {
  grid-area: sidebar;
  position: relative;
  z-index: 10;
  min-width: 0;
  min-height: 0;
  display: none;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #fff;
  color: #111112;
}
.app-shell[data-view="inbox"] .sidebar { display: flex; }
.sidebar-heading { min-height: 86px; display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 19px 18px 13px; }
.sidebar-heading h2 { display: flex; gap: 9px; align-items: center; margin: 5px 0 0; font-size: 24px; letter-spacing: -.035em; }
.sidebar-heading h2 span { min-width: 24px; height: 23px; display: grid; place-items: center; padding: 0 6px; border-radius: 7px; background: #111112; color: #fff; font-size: 9px; font-variant-numeric: tabular-nums; }
.availability-button { min-height: 34px; display: flex; gap: 8px; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #111112; font-size: 9px; font-weight: 850; }
.availability-button:hover { background: #f4f4f4; }

.conversation-filters { display: grid; gap: 8px; padding: 8px 16px 14px; border-bottom: 1px solid var(--line); }
.search-field { position: relative; display: block; }
.search-field > span { position: absolute; left: 12px; top: 50%; z-index: 1; transform: translateY(-52%); color: #777; font-size: 18px; }
.search-field input { min-height: 42px; padding-left: 36px; background: #f6f6f6; border-color: transparent; }
.search-field input:focus { border-color: #111112; background: #fff; }
.conversation-filter-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.conversation-filters select { min-height: 38px; padding: 0 10px; background: #fff; font-size: 10px; }
.filter-button { min-height: 38px; padding: 0 12px; border: 1px solid #111112; border-radius: 8px; background: #111112; color: #fff; font-size: 10px; font-weight: 850; }

.conversation-list-pane { flex: 1; min-height: 0; overflow-y: auto; border: 0; background: #fff; scrollbar-color: #c7c7c7 transparent; scrollbar-width: thin; }
.conversation-row { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 11px; align-items: start; padding: 14px 16px; border-bottom: 1px solid #ededed; background: #fff; color: #111112; transition: background .18s ease, box-shadow .18s ease; }
.conversation-row:hover { background: #f7f7f7; }
.conversation-row.selected { background: #f1f1f1; box-shadow: inset 3px 0 #111112; }
.conversation-row.selected .avatar { background: #111112; color: #fff; }
.conversation-name { font-size: 12px; }
.conversation-time { color: #858585; }
.conversation-title { min-width: 0; display: flex; gap: 7px; align-items: center; }
.conversation-title .conversation-name { min-width: 0; flex: 0 1 auto; }
.conversation-inline-status { display: inline-flex; flex: 0 0 auto; gap: 5px; align-items: center; color: #67676a; font-size: 8px; font-weight: 800; white-space: nowrap; }
.conversation-inline-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #8b8b8e; }
.conversation-inline-status.waiting::before { background: var(--amber); }
.conversation-inline-status.assigned::before { background: var(--orange); }
.conversation-inline-status.active::before { background: var(--green); }
.conversation-meta { color: #89898c; font-size: 9px; }
.conversation-meta strong { color: #5e5e61; font-weight: 800; }
.conversation-preview { margin: 4px 0 7px; color: #707074; }
.conversation-meta { overflow: hidden; }
.conversation-meta .badge { max-width: 118px; overflow: hidden; text-overflow: ellipsis; }
.unread-count { border-radius: 6px; background: #111112; }

.channel-card { display: flex; gap: 11px; align-items: center; margin: 0; padding: 13px 18px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: #fff; color: #111112; }
.channel-dot { box-shadow: 0 0 0 4px #f1f1f1; }
.channel-card small { color: #858589; }
.channel-card strong { color: #111112; font-size: 11px; }

.main { grid-area: main; min-width: 0; min-height: 0; overflow: hidden; background: #fff; }
.page { height: 100%; padding: 34px clamp(24px, 4vw, 56px) 56px; overflow: auto; background: #fff; }
.app-shell[data-view="inbox"] .page { padding: 0; overflow: hidden; }
.page-heading h1 { color: #111112; }
.page-heading .eyebrow { color: #111112; }

.metrics-grid, .card { border-color: var(--line); background: #fff; box-shadow: none; }
.metric.highlight { border-top-color: #111112; background: #fff; }
.list-row:hover, .table th { background: #f6f6f6; }
.arrow { color: #111112; }
.badge { border: 1px solid #dedede; border-radius: 7px; background: #fff; color: #4f4f52; }
.badge.waiting, .badge.assigned, .badge.active, .badge.closed, .badge.manager { background: #fff; color: #111112; }
.badge.waiting::before { background: var(--amber); }
.badge.assigned::before { background: var(--orange); }
.badge.active::before { background: var(--green); }
.badge.closed::before { background: #888; }
.badge.manager::before { background: #111112; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #ececec; color: #111112; }
.avatar.online { background: #111112; color: #fff; }
.weekday-picker input:checked + span { border-color: #111112; background: #111112; color: #fff; }
.switch input:checked + span { background: #111112; }
.notice { border-color: #c7c7c7; background: #f4f4f4; color: #111112; }
.skeleton { background: #e9e9e9; }

.inbox-shell { height: 100%; min-height: 0; display: block; overflow: hidden; border: 0; border-radius: 0; background: #fff; box-shadow: none; }
.chat-pane { width: 100%; height: 100%; background: #fff; }
.chat-loading { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.chat-empty-mark { border-color: #111112; border-radius: 14px; color: #111112; }
.chat-header { min-height: 76px; }
.chat-context { background: #f7f7f7; }
.chat-context-meta { display: flex; gap: 12px; align-items: center; }
.messages { background-color: #f7f7f7; background-image: radial-gradient(#d9d9d9 .7px, transparent .7px); }
.message { border-color: #dedede; box-shadow: none; }
.message.outbound { border-color: #111112; background: #111112; color: #fff; }
.message.outbound footer { color: #c5c5c5; }
.message.ai { border-color: #d7d7d7; background: #ededed; }
.message-author { display: block; margin-bottom: 5px; color: #555559; font-size: 9px; font-weight: 850; letter-spacing: .02em; }
.message.outbound .message-author { color: #fff; }
.message.audio-message { min-width: 245px; }
.voice-message { display: grid; grid-template-columns: 32px minmax(90px, 1fr) auto; gap: 9px; align-items: center; min-height: 38px; }
.voice-message-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; }
.voice-message-icon svg, .composer-action svg, .audio-recorder-cancel svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.voice-message-wave { height: 24px; display: flex; gap: 3px; align-items: center; }
.voice-message-wave i { width: 2px; border-radius: 99px; background: currentColor; opacity: .52; }
.voice-message small { opacity: .72; font-size: 9px; }
.voice-transcription { margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(128, 128, 128, .28); }
.voice-transcription > small { display: block; margin-bottom: 4px; opacity: .68; font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.voice-transcription p { font-size: 11px; line-height: 1.45; }
.read-only { background: #f7f7f7; }
.mobile-back { border-radius: 8px; }
.composer { align-items: center; }
.composer-content { min-width: 0; }
.composer-content textarea { width: 100%; }
.composer-action { width: 46px; height: 46px; display: grid; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid #111112; border-radius: 50%; background: #111112; color: #fff; transition: transform .18s ease, background .18s ease; }
.composer-action:hover { background: #303033; }
.composer-action:active { transform: scale(.96); }
.composer-action:disabled { cursor: wait; opacity: .55; }
.composer-action.sending svg { animation: composer-icon-spin .8s linear infinite; }
.audio-recorder { min-height: 46px; display: flex; gap: 10px; align-items: center; padding: 4px 7px 4px 13px; border: 1px solid #d3d3d3; border-radius: 23px; background: #fff; }
.audio-recorder[hidden] { display: none; }
.audio-recorder-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #d94d43; box-shadow: 0 0 0 4px rgba(217, 77, 67, .1); animation: audio-recording-pulse 1.2s ease-in-out infinite; }
.audio-recorder > strong { min-width: 42px; font-size: 11px; font-variant-numeric: tabular-nums; }
.audio-recorder-wave { min-width: 70px; height: 28px; display: flex; flex: 1; gap: 3px; align-items: center; justify-content: center; overflow: hidden; }
.audio-recorder-wave i { width: 3px; height: 8px; flex: 0 0 auto; border-radius: 99px; background: #77777b; transform-origin: center; transition: transform 80ms linear; }
.audio-recorder-cancel { width: 36px; height: 36px; display: grid; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #bd4038; }
.audio-recorder-cancel:hover { background: #f8eded; }
.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; }
@keyframes audio-recording-pulse { 0%, 100% { opacity: .7; transform: scale(.9); } 50% { opacity: 1; transform: scale(1); } }
@keyframes composer-icon-spin { to { transform: rotate(360deg); } }

.app-shell[data-view="kanban"] .page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 24px;
  overflow: hidden;
}
.app-shell[data-view="kanban"] .page-heading { flex: 0 0 auto; margin-bottom: 20px; }
.kanban-instruction { color: var(--muted); font-size: 11px; font-weight: 650; }
.kanban-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  flex: 0 0 auto;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.kanban-summary > div {
  min-height: 64px;
  display: flex;
  gap: 9px;
  align-items: baseline;
  padding: 14px 17px;
  border-right: 1px solid var(--line);
}
.kanban-summary > div:last-child { border-right: 0; }
.kanban-summary strong { color: #111112; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.kanban-summary span { color: #77777b; font-size: 10px; font-weight: 700; }
.kanban-summary .kanban-summary-skeleton { min-height: 62px; border-radius: 0; }
.kanban-board {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 320px);
  gap: 14px;
  align-items: stretch;
  flex: 1;
  padding: 2px 2px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #bdbdbd transparent;
  scrollbar-width: thin;
}
.kanban-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 14px;
  background: #f6f6f6;
}
.kanban-column.skeleton-column { gap: 12px; padding: 16px; }
.kanban-column.skeleton-column .skeleton-card { min-height: 160px; }
.kanban-column-head {
  min-height: 70px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid #dedede;
  background: #fff;
}
.kanban-column-head > span:nth-child(2) { min-width: 0; }
.kanban-column-head strong, .kanban-column-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-column-head strong { color: #111112; font-size: 12px; }
.kanban-column-head small { margin-top: 3px; color: #7c7c80; font-size: 9px; }
.kanban-column-head > b {
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 7px;
  background: #111112;
  color: #fff;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.kanban-column-body { min-height: 0; display: grid; gap: 10px; align-content: start; flex: 1; padding: 11px; overflow-y: auto; }
.kanban-card {
  width: 100%;
  display: block;
  padding: 14px;
  border: 1px solid #dedede;
  border-radius: 11px;
  background: #fff;
  color: #111112;
  text-align: left;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .035);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.kanban-card:hover { border-color: #111112; box-shadow: 0 10px 26px rgba(0, 0, 0, .08); transform: translateY(-2px); }
.kanban-card:active { transform: translateY(0); }
.kanban-card-top, .kanban-card-footer { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.kanban-card-top time { color: #8a8a8d; font-size: 9px; white-space: nowrap; }
.kanban-customer { display: block; margin-top: 13px; }
.kanban-customer strong, .kanban-customer small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-customer strong { font-size: 14px; letter-spacing: -.015em; }
.kanban-customer small { margin-top: 3px; color: #858589; font-size: 10px; }
.kanban-situation { display: block; margin-top: 13px; padding-top: 11px; border-top: 1px solid #ededed; }
.kanban-situation small { display: block; margin-bottom: 5px; color: #8a8a8d; font-size: 8px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.kanban-situation > span { display: -webkit-box; overflow: hidden; color: #505054; font-size: 11px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.kanban-card-footer { min-height: 20px; margin-top: 13px; color: #7b7b7f; font-size: 9px; font-weight: 700; }
.kanban-card-footer b { padding: 4px 6px; border-radius: 6px; background: #111112; color: #fff; font-size: 8px; }
.kanban-deadline.urgent { color: var(--red); }
.kanban-empty { display: grid; place-items: center; min-height: 150px; padding: 22px; color: #7d7d80; text-align: center; }
.kanban-empty strong, .kanban-empty span { display: block; }
.kanban-empty strong { color: #3f3f42; font-size: 12px; }
.kanban-empty span { max-width: 190px; margin-top: 5px; font-size: 10px; line-height: 1.5; }
.kanban-empty.board-empty { width: 320px; border: 1px solid var(--line); border-radius: 14px; background: #f6f6f6; }

.conversation-row-skeleton {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid #ededed;
}
.conversation-row-skeleton > span:last-child { display: grid; gap: 7px; padding-top: 2px; }
.skeleton-avatar { width: 38px; height: 38px; display: block; border-radius: 50%; }
.skeleton-avatar.large { width: 42px; height: 42px; }
.skeleton-text { width: 58%; height: 9px; display: block; margin: 0; border-radius: 5px; }
.skeleton-text.wide { width: 78%; height: 11px; }
.skeleton-tag { width: 72px; height: 20px; display: block; border-radius: 6px; }
.chat-skeleton { width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.chat-skeleton-header { min-height: 76px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 92px; gap: 12px; align-items: center; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.chat-skeleton-header > span:nth-child(2) { display: grid; gap: 8px; }
.chat-skeleton-header .name { width: 170px; height: 12px; }
.chat-skeleton-header .phone { width: 125px; }
.skeleton-action { width: 92px; height: 38px; display: block; justify-self: end; border-radius: 9px; }
.chat-skeleton-context { min-height: 58px; display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #f7f7f7; }
.chat-skeleton-context .summary { width: min(440px, 62%); height: 10px; }
.chat-skeleton-context .status { width: 112px; height: 28px; }
.chat-skeleton-messages { position: relative; min-height: 0; display: flex; flex: 1; flex-direction: column; padding: 28px 22px; overflow: hidden; background-color: #f7f7f7; background-image: radial-gradient(#d9d9d9 .7px, transparent .7px); background-size: 16px 16px; }
.skeleton-date { width: 130px; height: 24px; display: block; align-self: center; margin-bottom: 34px; border-radius: 12px; }
.skeleton-bubble { height: 70px; display: block; border-radius: 4px 14px 14px 14px; }
.skeleton-bubble.incoming.first { width: min(360px, 55%); }
.skeleton-bubble.incoming.second { width: min(270px, 42%); height: 52px; margin-top: 14px; }
.skeleton-bubble.outgoing { width: min(390px, 58%); height: 82px; align-self: flex-end; margin-top: 24px; border-radius: 14px 4px 14px 14px; }
.chat-skeleton-composer { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); background: #fff; }
.skeleton-input, .skeleton-send { height: 46px; display: block; border-radius: 11px; }

.action-sheet {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(470px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: #111112;
  color-scheme: light;
  box-shadow: -22px 0 70px rgba(0, 0, 0, .16);
}
.action-sheet[open] { animation: action-sheet-enter-right .24s cubic-bezier(.2, .8, .2, 1) both; }
.action-sheet.closing { animation: action-sheet-leave-right .22s ease both; }
.action-sheet::backdrop { background: rgba(17, 17, 18, .42); backdrop-filter: blur(3px); }
.action-sheet-frame { width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; }
.action-sheet-header {
  position: relative;
  z-index: 2;
  min-height: 128px;
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 25px 24px 21px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.action-sheet-header > div { min-width: 0; }
.action-sheet-header h2 { margin: 7px 0 5px; font-size: 25px; line-height: 1.05; letter-spacing: -.035em; }
.action-sheet-header .muted { max-width: 350px; margin: 0; font-size: 11px; line-height: 1.5; }
.action-sheet-close:not(.button) { width: 40px; height: 40px; display: grid; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #626266; font-size: 22px; transition: background .2s ease, color .2s ease, transform .2s ease; }
.action-sheet-close:not(.button):hover { background: #111112; color: #fff; }
.action-sheet-close:not(.button):active { transform: scale(.96); }
.action-sheet-body { min-height: 0; flex: 1; padding: 22px 24px 32px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #bdbdbd transparent; scrollbar-width: thin; }
.action-sheet-footer { position: relative; z-index: 2; display: flex; flex: 0 0 auto; justify-content: flex-end; gap: 9px; padding: 15px 24px calc(15px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -12px 28px rgba(0, 0, 0, .04); }
.action-sheet-footer .button { min-width: 118px; }
.action-sheet-footer .button.primary { min-width: 176px; }
.conversation-preview-overview { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.conversation-preview-overview > span:nth-child(2) { min-width: 0; }
.conversation-preview-overview small, .conversation-preview-overview strong, .conversation-preview-overview > span:nth-child(2) > span { display: block; }
.conversation-preview-overview small { margin-bottom: 5px; color: #88888c; font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.conversation-preview-overview strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-preview-overview > span:nth-child(2) > span { margin-top: 3px; color: #7b7b7f; font-size: 10px; }
.conversation-preview-summary { margin: 18px 0; padding: 15px 16px; border-left: 3px solid #111112; background: #f5f5f5; }
.conversation-preview-summary small, .conversation-preview-history header small { display: block; margin-bottom: 6px; color: #77777b; font-size: 8px; font-weight: 900; letter-spacing: .11em; }
.conversation-preview-summary p { margin: 0; color: #444448; font-size: 12px; line-height: 1.55; }
.conversation-preview-history { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.conversation-preview-history > header { min-height: 58px; display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.conversation-preview-history header strong { display: block; font-size: 13px; }
.conversation-preview-history header b { padding: 5px 7px; border-radius: 7px; background: #eee; color: #555559; font-size: 8px; }
.action-sheet-thread { min-height: 280px; max-height: 58dvh; padding: 18px 14px; overflow-y: auto; background-color: #f7f7f7; background-image: radial-gradient(#d9d9d9 .7px, transparent .7px); background-size: 16px 16px; }
.action-sheet-thread .message { max-width: 88%; }
.conversation-preview-skeleton { display: grid; gap: 18px; }
.preview-skeleton-person { display: grid; grid-template-columns: 42px minmax(0, 1fr) 80px; gap: 12px; align-items: center; }
.preview-skeleton-person > span:nth-child(2), .preview-skeleton-summary { display: grid; gap: 8px; }
.preview-skeleton-thread { min-height: 390px; display: flex; flex-direction: column; padding: 22px 14px; border-radius: 12px; background: #f5f5f5; }
.preview-skeleton-thread .skeleton-bubble.outgoing { margin-left: auto; }
.transfer-list { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.transfer-list > legend { width: 100%; margin-bottom: 7px; color: #77777b; font-size: 9px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.transfer-person { position: relative; display: grid; grid-template-columns: auto 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid #dedede; border-radius: 11px; background: #fff; color: #111112; cursor: pointer; transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.transfer-person:hover { border-color: #111112; transform: translateY(-1px); }
.transfer-person:has(input:checked) { border-color: #111112; background: #f4f4f4; box-shadow: inset 3px 0 #111112; }
.transfer-person.current { cursor: default; opacity: .62; }
.transfer-person.current:hover { border-color: #dedede; transform: none; }
.transfer-person input { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: #111112; }
.transfer-person-copy { min-width: 0; }
.transfer-person-copy strong, .transfer-person-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-person-copy strong { font-size: 12px; }
.transfer-person-copy small { margin-top: 3px; color: #7c7c80; font-size: 9px; }
.transfer-person-state { color: #77777b; font-size: 9px; font-weight: 800; }
.transfer-person:has(input:checked) .transfer-person-state { color: #111112; }
@keyframes action-sheet-enter-right { from { opacity: .7; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes action-sheet-leave-right { from { opacity: 1; transform: translateX(0); } to { opacity: .7; transform: translateX(100%); } }

@media (max-width: 1100px) {
  .app-shell[data-view="inbox"] { grid-template-columns: 320px minmax(0, 1fr); }
  .sync-label { display: none; }
  .header-brand { width: 126px; }
  .header-logo { width: 105px; }
  .profile-toggle { min-width: 156px; }
  .profile-toggle small { display: none; }
}

@media (max-width: 820px) {
  body { overflow: hidden; }
  .app-shell {
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 98px minmax(0, 1fr);
    grid-template-areas: "header" "main";
  }
  .app-header {
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 48px 42px;
    gap: 0;
    padding: 4px 12px 6px;
  }
  .header-brand { grid-row: 1; grid-column: 1; z-index: 1; width: 110px; min-height: 42px; border-right: 0; }
  .header-tools { grid-row: 1; grid-column: 1; z-index: 2; justify-self: end; justify-content: flex-end; }
  .header-nav { grid-row: 2; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .header-nav::-webkit-scrollbar { display: none; }
  .header-nav-item { min-height: 36px; padding: 0 12px; font-size: 11px; }
  .refresh-button, .sync-label { display: none; }
  .header-logo { width: 96px; margin: 0; }
  .profile-toggle { min-width: 0; padding: 4px 6px; }
  .profile-toggle > span { width: 32px; height: 32px; }
  .profile-toggle > div { max-width: 110px; }
  .profile-menu { position: fixed; inset: 58px 12px auto auto; width: min(290px, calc(100vw - 24px)); }
  .sidebar {
    grid-area: main;
    width: 100%;
    display: none;
    border-right: 0;
  }
  .main { grid-area: main; display: block; overflow: hidden; }
  .app-shell[data-view="inbox"] .sidebar { display: flex; }
  .app-shell[data-view="inbox"] .main { display: none; }
  .app-shell[data-view="inbox"].chat-active .sidebar { display: none; }
  .app-shell[data-view="inbox"].chat-active .main { display: block; }
  .sidebar-heading { min-height: 76px; padding: 14px 16px 10px; }
  .sidebar-heading h2 { font-size: 22px; }
  .conversation-filters { padding: 7px 14px 12px; }
  .conversation-row { padding: 14px; }
  .channel-card { padding-bottom: calc(13px + env(safe-area-inset-bottom)); }
  .page { height: 100%; min-height: 0; padding: 26px 16px 44px; overflow: auto; }
  .app-shell[data-view="inbox"] .page { height: 100%; padding: 0; }
  .app-shell[data-view="kanban"] .page { height: 100%; padding: 20px 14px 12px; overflow: hidden; }
  .app-shell[data-view="kanban"] .page-heading { margin-bottom: 14px; }
  .app-shell[data-view="kanban"] .page-heading h1 { font-size: 32px; }
  .kanban-instruction { display: none; }
  .kanban-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
  .kanban-summary > div { min-height: 50px; padding: 10px 12px; }
  .kanban-summary > div:nth-child(2) { border-right: 0; }
  .kanban-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .kanban-summary strong { font-size: 20px; }
  .kanban-board { grid-auto-columns: minmax(278px, 84vw); gap: 10px; padding-bottom: 8px; }
  .inbox-shell, .chat-pane { height: 100%; min-height: 0; margin: 0; }
  .chat-pane { display: flex; }
  .mobile-back { display: grid; place-items: center; }
  .chat-header { min-height: 68px; padding: 10px 12px; }
  .chat-actions { gap: 5px; }
  .chat-actions .button { min-width: auto; min-height: 36px; padding: 0 8px; font-size: 9px; }
  .chat-person { gap: 8px; }
  .chat-person .avatar { width: 34px; height: 34px; }
  .messages { padding: 16px 12px; }
  .message { max-width: 88%; }
  .composer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .composer-action { width: 44px; height: 44px; }
  .audio-recorder { gap: 7px; padding-left: 10px; }
  .audio-recorder-wave { min-width: 42px; gap: 2px; }
  .audio-recorder-wave i { width: 2px; }
  .action-sheet {
    inset: auto 0 0;
    width: 100%;
    height: min(86dvh, 760px);
    max-height: 86dvh;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, .2);
  }
  .action-sheet[open] { animation: action-sheet-enter-bottom .26s cubic-bezier(.2, .8, .2, 1) both; }
  .action-sheet.closing { animation: action-sheet-leave-bottom .22s ease both; }
  .action-sheet-header { min-height: 116px; padding: 28px 18px 16px; }
  .action-sheet-header::before { content: ""; position: absolute; top: 8px; left: 50%; width: 42px; height: 4px; transform: translateX(-50%); border-radius: 99px; background: #d2d2d2; }
  .action-sheet-header h2 { font-size: 22px; }
  .action-sheet-body { padding: 18px 16px 26px; }
  .action-sheet-footer { padding: 11px 14px calc(11px + env(safe-area-inset-bottom)); }
  .action-sheet-footer .button, .action-sheet-footer .button.primary { min-width: 0; flex: 1; }
  .conversation-preview-overview { grid-template-columns: 38px minmax(0, 1fr); }
  .conversation-preview-overview > .badge { grid-column: 2; width: fit-content; }
  .action-sheet-thread { max-height: none; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .roster-layout, .settings-grid { margin-top: 14px; }
  .dialog { color-scheme: light; }
  .toast, .update-prompt { bottom: calc(14px + env(safe-area-inset-bottom)); }
}

@keyframes action-sheet-enter-bottom { from { opacity: .75; transform: translateY(100%); } to { opacity: 1; transform: translateY(0); } }
@keyframes action-sheet-leave-bottom { from { opacity: 1; transform: translateY(0); } to { opacity: .75; transform: translateY(100%); } }

@media (max-width: 470px) {
  .app-shell { grid-template-rows: 96px minmax(0, 1fr); }
  .header-logo { width: 86px; }
  .profile-toggle > div { max-width: 92px; }
  .header-nav-item { padding: 0 10px; }
  .sidebar-heading .eyebrow { font-size: 9px; }
  .conversation-filter-row { grid-template-columns: minmax(0, 1fr) 62px; }
  .page-heading h1 { font-size: 34px; }
}

/* A lista lateral pertence exclusivamente à tela de Conversas. */
@media (min-width: 821px) {
  .app-shell[data-view="inbox"] {
    grid-template-columns: 360px minmax(0, 1fr);
    grid-template-areas:
      "header header"
      "sidebar main";
  }
  .app-shell[data-view="inbox"] .sidebar { display: flex; }
  .app-shell:not([data-view="inbox"]) .sidebar { display: none; }
}

@media (min-width: 821px) and (max-width: 1100px) {
  .app-shell[data-view="inbox"] { grid-template-columns: 320px minmax(0, 1fr); }
}

.stage-chip {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border: 1px solid #dedede;
  border-radius: 6px;
  color: #555559;
  font-size: 8px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}
.stage-chip::before { content: ""; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: #777; }
.stage-chip.stage-hot::before { background: #d84335; }
.stage-chip.stage-cold::before { background: #3576b8; }
.stage-chip.stage-visit::before { background: #7b4db8; }
.stage-chip.stage-proposal::before { background: #dc7a16; }
.stage-chip.stage-won::before { background: #19865e; }
.stage-chip.stage-discarded::before { background: #a5a5a8; }
.conversation-meta { gap: 7px; }

.app-shell[data-view="pipeline"] .page {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 22px;
  overflow: hidden;
}
.app-shell[data-view="pipeline"] .page-heading { flex: 0 0 auto; margin-bottom: 18px; }
.pipeline-summary {
  display: flex;
  flex: 0 0 auto;
  gap: 0;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}
.pipeline-summary > span { min-height: 52px; display: flex; gap: 7px; align-items: baseline; padding: 13px 18px; border-right: 1px solid var(--line); color: #77777b; font-size: 10px; font-weight: 700; }
.pipeline-summary > span:last-child { border-right: 0; }
.pipeline-summary strong { color: #111112; font-size: 22px; letter-spacing: -.04em; }
.pipeline-board {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 285px);
  gap: 11px;
  flex: 1;
  padding: 2px 2px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #bdbdbd transparent;
  scrollbar-width: thin;
}
.pipeline-board.pipeline-skeleton { grid-auto-columns: minmax(250px, 285px); }
.pipeline-board.pipeline-skeleton .skeleton-card { height: 72vh; }
.pipeline-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #dedede; border-top: 3px solid #777; border-radius: 12px; background: #f6f6f6; }
.pipeline-column.stage-hot { border-top-color: #d84335; }
.pipeline-column.stage-cold { border-top-color: #3576b8; }
.pipeline-column.stage-visit { border-top-color: #7b4db8; }
.pipeline-column.stage-proposal { border-top-color: #dc7a16; }
.pipeline-column.stage-won { border-top-color: #19865e; }
.pipeline-column.stage-discarded { border-top-color: #a5a5a8; }
.pipeline-column > header { min-height: 62px; display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 13px; border-bottom: 1px solid #dedede; background: #fff; }
.pipeline-column > header small, .pipeline-column > header strong { display: block; }
.pipeline-column > header small { margin-bottom: 4px; color: #929296; font-size: 7px; font-weight: 900; letter-spacing: .13em; }
.pipeline-column > header strong { font-size: 12px; }
.pipeline-column > header b { min-width: 25px; height: 25px; display: grid; place-items: center; padding: 0 6px; border-radius: 7px; background: #111112; color: #fff; font-size: 9px; }
.pipeline-column-body { min-height: 0; display: grid; gap: 9px; align-content: start; flex: 1; padding: 10px; overflow-y: auto; transition: background .16s ease, box-shadow .16s ease; }
.pipeline-column-body.drag-over { background: #ececec; box-shadow: inset 0 0 0 2px #111112; }
.pipeline-card { overflow: hidden; border: 1px solid #dedede; border-radius: 10px; background: #fff; box-shadow: 0 5px 16px rgba(0, 0, 0, .035); }
.pipeline-card.dragging { opacity: .42; }
.pipeline-open { width: 100%; display: block; padding: 12px; border: 0; background: #fff; color: #111112; text-align: left; }
.pipeline-open:hover { background: #fafafa; }
.pipeline-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 11px; }
.pipeline-card-top time { color: #909094; font-size: 8px; }
.pipeline-open > strong, .pipeline-open > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-open > strong { font-size: 13px; }
.pipeline-open > small { margin-top: 3px; color: #818185; font-size: 9px; }
.pipeline-open > p { display: -webkit-box; margin: 11px 0 0; overflow: hidden; color: #555559; font-size: 10px; line-height: 1.45; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.pipeline-open > b { display: inline-flex; margin-top: 9px; padding: 4px 6px; border-radius: 5px; background: #111112; color: #fff; font-size: 8px; }
.pipeline-mobile-stage { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid #ededed; }
.pipeline-mobile-stage span { color: #858589; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.pipeline-mobile-stage select { width: auto; min-height: 30px; padding: 0 26px 0 8px; border-radius: 7px; font-size: 9px; }
.pipeline-empty { min-height: 110px; display: grid; place-items: center; padding: 20px; color: #909094; font-size: 9px; line-height: 1.5; text-align: center; }

.chat-pane { position: relative; }
.jump-latest { position: absolute; left: 50%; bottom: 78px; z-index: 6; display: inline-flex; gap: 7px; align-items: center; min-height: 34px; padding: 0 13px; border: 1px solid var(--orange-line); border-radius: 99px; background: #fff; color: var(--orange-dark); box-shadow: 0 8px 24px rgba(82, 47, 22, .14); font-size: 10px; font-weight: 850; transform: translateX(-50%); transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.jump-latest:hover { border-color: var(--orange); box-shadow: 0 10px 28px rgba(82, 47, 22, .2); transform: translateX(-50%) translateY(-1px); }
.jump-latest:active { transform: translateX(-50%) translateY(1px); }
.chat-stage-select { display: flex; gap: 6px; align-items: center; }
.chat-stage-select > span { color: #858589; font-size: 8px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.chat-stage-select select { width: auto; min-width: 118px; min-height: 32px; padding: 0 28px 0 9px; background: #fff; font-size: 9px; font-weight: 750; }
.chat-stage-select select:disabled { opacity: .65; }
.message.sending { opacity: .72; }
.message.failed { border-color: #d94d43; box-shadow: 0 0 0 1px rgba(217, 77, 67, .16); }
.message.failed footer { flex-wrap: wrap; align-items: center; color: #efb5b0; }
.message-retry { display: inline-flex; gap: 4px; align-items: center; padding: 3px 6px; border: 1px solid currentColor; border-radius: 5px; background: transparent; color: inherit; font-size: 8px; font-weight: 850; }
.message-retry svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.message-image { display: block; overflow: hidden; color: inherit; text-decoration: none; }
.message-image img { width: min(320px, 100%); max-height: 300px; display: block; border-radius: 8px; object-fit: cover; background: #ededed; }
.message-image span { display: block; margin-top: 6px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; opacity: .75; }
.message-attachment { min-width: 240px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 8px; border: 1px solid currentColor; border-radius: 8px; color: inherit; text-decoration: none; }
.message-attachment-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; }
.message-attachment svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.message-attachment small, .message-attachment strong, .message-attachment em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-attachment small { font-size: 7px; font-weight: 900; letter-spacing: .09em; opacity: .7; }
.message-attachment strong { margin-top: 2px; font-size: 10px; }
.message-attachment em { margin-top: 2px; font-size: 8px; font-style: normal; opacity: .68; }
.message-attachment > b { font-size: 14px; }
.message-attachment + p, .message-image + p { margin-top: 9px; }
.composer { grid-template-columns: auto minmax(0, 1fr) auto; }
.composer-attach { width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border: 1px solid #d2d2d2; border-radius: 50%; background: #fff; color: #111112; }
.composer-attach:hover { border-color: #111112; background: #f4f4f4; }
.composer-attach svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.attachment-drop-overlay { position: absolute; inset: 76px 0 74px; z-index: 8; place-items: center; align-content: center; gap: 8px; border: 2px dashed #111112; background: rgba(255, 255, 255, .94); color: #111112; pointer-events: none; }
.attachment-drop-overlay:not([hidden]) { display: grid; }
.attachment-drop-overlay > span { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: #111112; color: #fff; }
.attachment-drop-overlay svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.attachment-drop-overlay strong { font-size: 18px; }
.attachment-drop-overlay small { color: #737377; font-size: 10px; }
.attachment-preview-list { display: grid; gap: 9px; }
.attachment-preview-item { display: grid; grid-template-columns: 62px minmax(0, 1fr) 32px; gap: 12px; align-items: center; padding: 9px; border: 1px solid #dedede; border-radius: 11px; }
.attachment-preview-visual { width: 62px; height: 62px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: #f1f1f1; }
.attachment-preview-visual img { width: 100%; height: 100%; object-fit: cover; }
.attachment-preview-visual.file { position: relative; color: #111112; }
.attachment-preview-visual.file svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.attachment-preview-visual.file i { position: absolute; right: 4px; bottom: 4px; padding: 2px 3px; border-radius: 3px; background: #111112; color: #fff; font-size: 6px; font-style: normal; font-weight: 900; }
.attachment-preview-copy { min-width: 0; }
.attachment-preview-copy strong, .attachment-preview-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-preview-copy strong { font-size: 11px; }
.attachment-preview-copy small { margin-top: 4px; color: #7d7d81; font-size: 8px; }
.remove-attachment { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 1px solid #dedede; border-radius: 50%; background: #fff; color: #6c6c70; font-size: 18px; }
.remove-attachment:hover { border-color: #d94d43; color: #d94d43; }
.attachment-caption { display: grid; gap: 7px; margin-top: 20px; color: #444448; font-size: 10px; font-weight: 800; }
.attachment-caption textarea { resize: vertical; }

.distribution-calendar { display: flex; gap: 8px; align-items: flex-end; }
.distribution-calendar label { display: grid; gap: 5px; color: #77777b; font-size: 8px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.distribution-calendar input { min-height: 40px; padding: 0 10px; background: #fff; font-size: 11px; }
.distribution-calendar .button { min-height: 40px; }
.distribution-status-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: -10px 0 16px; color: #77777b; font-size: 10px; text-transform: capitalize; }
.distribution-layout { align-items: start; }
.distribution-side { display: grid; gap: 14px; }
.distribution-days { overflow: hidden; }
.distribution-days > header { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.distribution-days > header small, .distribution-days > header strong { display: block; }
.distribution-days > header small { margin-bottom: 5px; color: #89898d; font-size: 8px; font-weight: 900; letter-spacing: .11em; }
.distribution-days > header strong { font-size: 14px; }
.distribution-days > div { max-height: 255px; overflow-y: auto; }
.distribution-day-link { width: 100%; display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 16px; border: 0; border-bottom: 1px solid #ededed; background: #fff; color: #111112; text-align: left; }
.distribution-day-link:hover, .distribution-day-link.active { background: #f3f3f3; }
.distribution-day-link.active { box-shadow: inset 3px 0 #111112; }
.distribution-day-link strong { font-size: 10px; text-transform: capitalize; }
.distribution-day-link small { color: #858589; font-size: 8px; }
.distribution-timeline-card { margin-top: 20px; }
.distribution-timeline { padding: 7px 22px 22px; }
.distribution-timeline-item { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 12px; padding: 12px 0; }
.distribution-timeline-item::before { content: ""; position: absolute; left: 5px; top: 28px; bottom: -12px; width: 1px; background: #dedede; }
.distribution-timeline-item:last-child::before { display: none; }
.distribution-timeline-item > i { width: 11px; height: 11px; margin-top: 2px; border: 3px solid #fff; border-radius: 50%; background: #888; box-shadow: 0 0 0 1px #bbb; }
.distribution-timeline-item.active > i { background: #19865e; }
.distribution-timeline-item.assigned > i { background: #111112; }
.distribution-timeline-item.waiting > i { background: #dc7a16; }
.distribution-timeline-item.closed > i { background: #d84335; }
.distribution-timeline-item strong { display: block; font-size: 11px; }
.distribution-timeline-item p { margin: 4px 0 0; color: #737377; font-size: 9px; line-height: 1.45; }
.distribution-timeline-item time { display: block; margin-top: 4px; color: #a0a0a4; font-size: 8px; }
.distribution-timeline-empty { min-height: 140px; display: grid; place-items: center; align-content: center; text-align: center; }
.distribution-timeline-empty strong, .distribution-timeline-empty span { display: block; }
.distribution-timeline-empty strong { font-size: 12px; }
.distribution-timeline-empty span { margin-top: 5px; color: #858589; font-size: 9px; }

@media (max-width: 820px) {
  .app-shell[data-view="pipeline"] .page { height: 100%; padding: 20px 14px 12px; }
  .app-shell[data-view="pipeline"] .page-heading { margin-bottom: 12px; }
  .app-shell[data-view="pipeline"] .page-heading h1 { font-size: 31px; }
  .pipeline-summary { margin-bottom: 10px; overflow-x: auto; }
  .pipeline-summary > span { min-width: 130px; min-height: 46px; padding: 9px 12px; }
  .pipeline-board { grid-auto-columns: minmax(264px, 82vw); gap: 9px; }
  .chat-context { grid-template-columns: minmax(0, 1fr); }
  .chat-context-meta { justify-content: space-between; }
  .chat-stage-select { flex: 1; }
  .chat-stage-select select { max-width: 150px; }
  .composer { gap: 7px; padding-left: 8px; padding-right: 8px; }
  .composer-attach, .composer-action { width: 42px; height: 42px; }
  .jump-latest { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .attachment-drop-overlay { inset: 68px 0 calc(66px + env(safe-area-inset-bottom)); }
  .distribution-calendar { width: 100%; margin-top: 14px; }
  .distribution-calendar label { flex: 1; }
  .distribution-calendar input { width: 100%; }
  .distribution-status-row { align-items: flex-start; margin-top: 0; }
  .distribution-status-row > span:last-child { text-align: right; }
  .distribution-timeline-card { margin-top: 14px; }
}

@media (max-width: 470px) {
  .chat-stage-select > span { display: none; }
  .chat-stage-select select { min-width: 105px; max-width: 120px; }
  .message-attachment { min-width: 210px; }
  .attachment-preview-item { grid-template-columns: 50px minmax(0, 1fr) 30px; }
  .attachment-preview-visual { width: 50px; height: 50px; }
  .distribution-status-row { display: grid; }
  .distribution-status-row > span:last-child { text-align: left; }
}

/* Assinatura MLB — preto estrutural com detalhes no laranja do logotipo. */
:root {
  --orange-dark: #a9430d;
  --orange-soft: #fff3ea;
  --orange-line: #f4bb92;
  --orange-tint: #fffaf6;
}

.app-header {
  box-shadow: inset 0 3px 0 var(--orange);
}

.header-brand {
  position: relative;
  border-right-color: var(--orange-line);
}

.header-brand::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: 14px;
  width: 2px;
  height: 22px;
  border-radius: 2px;
  background: var(--orange);
}

.header-nav-item:hover {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.header-nav-item.active {
  box-shadow: inset 0 -3px 0 var(--orange);
}

.header-nav-item.active b {
  color: var(--orange-dark);
}

.refresh-button:hover,
.profile-toggle:hover,
.profile-toggle[aria-expanded="true"] {
  border-color: var(--orange-line);
  background: var(--orange-tint);
}

.refresh-button:hover {
  color: var(--orange-dark);
}

.profile-toggle > span {
  background: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
}

.profile-menu > p,
.sidebar-heading .eyebrow,
.page-heading .eyebrow {
  color: var(--orange-dark);
}

.manager-mode-switch button.active {
  box-shadow: inset 3px 0 0 var(--orange);
}

.sidebar-heading {
  box-shadow: inset 3px 0 0 var(--orange);
}

.sidebar-heading h2 span,
.unread-count {
  background: var(--orange);
}

.search-field input:focus,
.conversation-filters select:focus,
.chat-stage-select select:focus {
  border-color: var(--orange);
}

.filter-button,
.button.primary {
  box-shadow: inset 0 -3px 0 var(--orange);
}

.conversation-row:hover {
  background: var(--orange-tint);
}

.conversation-row.selected {
  background: var(--orange-soft);
  box-shadow: inset 3px 0 0 var(--orange);
}

.conversation-row.selected .avatar {
  background: var(--orange);
}

.channel-card {
  border-top-color: var(--orange-line);
}

.page-heading {
  position: relative;
}

.page-heading::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 0;
  width: 46px;
  height: 3px;
  border-radius: 3px;
  background: var(--orange);
}

.metric.highlight {
  border-top-color: var(--orange);
  background: var(--orange-tint);
}

.arrow,
.text-button {
  color: var(--orange-dark);
}

.badge.assigned {
  border-color: var(--orange-line);
  color: var(--orange-dark);
}

.chat-empty-mark {
  border-color: var(--orange-line);
  color: var(--orange-dark);
  box-shadow: inset 0 -3px 0 var(--orange);
}

.chat-context {
  box-shadow: inset 3px 0 0 var(--orange);
}

.message.outbound {
  box-shadow: inset 3px 0 0 var(--orange);
}

.composer-action {
  box-shadow: 0 0 0 3px var(--orange-soft);
}

.composer-action:hover {
  background: var(--orange-dark);
}

.composer-attach:hover {
  border-color: var(--orange);
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.kanban-summary,
.pipeline-summary {
  border-top: 3px solid var(--orange);
}

.kanban-column {
  border-top: 3px solid var(--orange);
}

.kanban-column-head > b,
.pipeline-column > header b {
  background: var(--orange);
}

.kanban-card:hover,
.pipeline-card:hover {
  border-color: var(--orange);
}

.pipeline-column.stage-new,
.pipeline-column.stage-in-service {
  border-top-color: var(--orange);
}

.pipeline-column-body.drag-over {
  background: var(--orange-soft);
  box-shadow: inset 0 0 0 2px var(--orange);
}

.pipeline-open > b,
.kanban-card-footer b {
  box-shadow: inset 0 -2px 0 var(--orange);
}

.action-sheet-header {
  box-shadow: inset 0 3px 0 var(--orange);
}

.conversation-preview-summary {
  border-left-color: var(--orange);
  background: var(--orange-tint);
}

.attachment-drop-overlay {
  border-color: var(--orange);
  color: var(--orange-dark);
}

.attachment-drop-overlay > span {
  background: var(--orange);
}

.distribution-day-link:hover {
  background: var(--orange-tint);
}

.distribution-day-link.active {
  background: var(--orange-soft);
  box-shadow: inset 3px 0 0 var(--orange);
}

.distribution-timeline-item.assigned > i {
  background: var(--orange);
}
