:root {
  --navy: #0b1f6b;
  --cyan: #00c9e8;
  --pink: #f5187a;
  --ink: #17233f;
  --muted: #667085;
  --surface: #fff;
  --background: #f5f8fb;
  --danger: #b42318;
  --border: #dce3ec;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--ink); font-family: var(--font); }
a { color: var(--navy); }
button, input { font: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 10; background: var(--surface); padding: .75rem 1rem; }
.skip-link:focus { top: 1rem; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3rem); background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: baseline; text-decoration: none; font-size: 1.5rem; color: var(--navy); }
.brand strong { color: var(--pink); }
.brand small { margin-left: .5rem; padding: .18rem .45rem; border-radius: 999px; background: var(--navy); color: #fff; font-size: .68rem; letter-spacing: .04em; }
.brand--center { margin-bottom: 1.5rem; }
.topbar__user { display: flex; align-items: center; gap: 1rem; }
.topbar__nav { display: flex; gap: 1rem; margin-left: auto; }
.topbar__nav a { font-weight: 700; text-decoration: none; }
.topbar__user form { margin: 0; }
.link-button { border: 0; background: none; color: var(--navy); text-decoration: underline; cursor: pointer; }
.shell { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) 0; }
.page-heading { max-width: 700px; margin-bottom: 2rem; }
.page-heading h1, .auth-card h1 { margin: .25rem 0 .75rem; color: var(--navy); }
.eyebrow { margin: 0; color: var(--pink); font-weight: 700; text-transform: uppercase; font-size: .78rem; letter-spacing: .1em; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.module-card, .auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 16px 38px rgba(11,31,107,.08); }
.module-card { padding: 1.5rem; }
.module-card h2 { color: var(--navy); }
.status-pill { display: inline-block; padding: .3rem .55rem; border-radius: 999px; background: #e7faff; color: #075a6a; font-size: .78rem; font-weight: 700; }
.auth-layout { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { width: min(460px, 100%); margin: 3rem auto; padding: clamp(1.5rem, 5vw, 2.5rem); }
.auth-card form { display: grid; gap: .65rem; }
.auth-card label { margin-top: .5rem; font-weight: 700; }
.auth-card input { width: 100%; min-height: 46px; padding: .75rem; border: 1px solid #98a2b3; border-radius: 10px; }
.auth-card input:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.primary-button, .secondary-button { margin-top: 1rem; min-height: 48px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.primary-button { border: 0; background: var(--pink); color: #fff; }
.primary-button:hover { background: #d70f67; }
.secondary-button { min-height: 38px; margin: 0; padding: .45rem .7rem; border: 1px solid var(--navy); background: #fff; color: var(--navy); }
.password-dialog { width: min(440px, calc(100% - 2rem)); max-height: min(90vh, 640px); padding: 1.5rem; border: 1px solid var(--border); border-radius: 16px; color: var(--ink); box-shadow: 0 24px 64px rgba(11,31,107,.24); }
.password-dialog::backdrop { background: rgba(11,31,107,.48); }
.password-dialog h2 { margin: 0 0 .5rem; color: var(--navy); }
.password-dialog > p { margin: 0 0 1.25rem; color: var(--muted); }
.password-dialog form { display: grid; gap: 1rem; }
.password-dialog label { display: grid; gap: .45rem; font-weight: 700; }
.password-dialog input { width: 100%; min-height: 46px; padding: .7rem; border: 1px solid #98a2b3; border-radius: 10px; background: #fff; }
.password-dialog__actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: .25rem; }
.password-dialog__actions .primary-button { margin: 0; padding: 0 1rem; }
.alert { margin: 1rem 0; padding: .85rem 1rem; border-left: 4px solid var(--danger); background: #fef3f2; color: var(--danger); }
.alert--success { border-color: #067647; background: #ecfdf3; color: #067647; }
.search-form { margin: 0 0 1.5rem; }
.search-form label { display: block; margin-bottom: .5rem; font-weight: 700; }
.search-form > div { display: flex; gap: .5rem; }
.search-form input { flex: 1; min-width: 0; min-height: 46px; padding: .75rem; border: 1px solid #98a2b3; border-radius: 10px; }
.search-form .primary-button { margin: 0; padding: 0 1.2rem; }
.form-section { margin-bottom: 2rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid .primary-button { align-self: end; }
.form-section form:not(.form-grid), .form-section label { display: grid; gap: .45rem; }
.form-section input, .form-section select { min-height: 46px; padding: .7rem; border: 1px solid #98a2b3; border-radius: 10px; background: #fff; }
.form-section fieldset { grid-column: 1 / -1; padding: 1rem; border: 1px solid var(--border); border-radius: 12px; }
.form-section fieldset label { display: flex; align-items: center; grid-template-columns: auto 1fr; margin-top: .55rem; }
.form-section fieldset input { min-height: auto; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.action-row form, .action-row .primary-button { margin: 0; }
.commercial-voucher h2 { overflow-wrap: anywhere; }
.copy-status { min-height: 1.4em; color: #067647; font-weight: 700; }
.commercial-metrics { margin-top: 1.25rem; }
.status-pill--active { background: #ecfdf3; color: #067647; }
.presence-summary { display: flex; align-items: center; gap: .6rem; margin: 0 0 1.5rem; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.presence-summary a { margin-left: auto; }
.presence-summary--available { border-color: #75e0a7; background: #ecfdf3; }
.presence-dot { display: inline-block; width: .75rem; height: .75rem; border-radius: 50%; background: #98a2b3; }
.presence-dot--available { background: #12b76a; box-shadow: 0 0 0 4px rgba(18, 183, 106, .14); }
.presence-card { position: relative; }
.presence-card > .presence-dot { position: absolute; top: 1.6rem; right: 1.6rem; }
.conversation-list { display: grid; gap: .75rem; }
.conversation-row { display: grid; gap: .35rem; padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: 14px; background: #fff; text-decoration: none; }
.conversation-row:hover { border-color: var(--cyan); }
.conversation-row span { color: var(--ink); }
.conversation-row small { color: var(--muted); }
.conversation-row__heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.history-filters { display: flex; align-items: end; gap: 1rem; margin-bottom: 1.5rem; padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.history-filters label { display: grid; gap: .4rem; font-weight: 700; }
.history-filters select { min-height: 44px; min-width: 150px; padding: .65rem; border: 1px solid #98a2b3; border-radius: 10px; background: #fff; }
.history-filters input { min-height: 44px; min-width: min(320px, 60vw); padding: .65rem; border: 1px solid #98a2b3; border-radius: 10px; }
.history-filters .primary-button { margin: 0; padding: 0 1.2rem; }
.assignment-history { margin-bottom: 1rem; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.assignment-history h2 { margin-top: 0; color: var(--navy); font-size: 1.1rem; }
.assignment-history ol { margin-bottom: 0; padding-left: 1.2rem; }
.history-chat-log { height: auto; max-height: none; }
.agent-message small { display: block; margin-top: .2rem; color: var(--muted); font-size: .75rem; }
.agent-message--bot { margin-left: auto; background: #f3eefa; }
.chat-workspace { max-width: 860px; }
.agent-chat-log { height: min(55vh, 560px); overflow-y: auto; padding: 1rem; border: 1px solid var(--border); border-radius: 16px; background: #fff; }
.agent-message { width: min(80%, 620px); margin: 0 0 .8rem; padding: .75rem 1rem; border-radius: 14px; background: #eef3f8; }
.agent-message--agent { margin-left: auto; background: #e7faff; }
.agent-message strong { color: var(--navy); font-size: .82rem; }
.agent-message p { margin: .3rem 0 0; white-space: pre-wrap; }
.agent-chat-form { display: grid; grid-template-columns: 1fr auto; gap: .75rem; margin-top: 1rem; }
.agent-chat-form textarea { min-height: 80px; resize: vertical; padding: .8rem; border: 1px solid #98a2b3; border-radius: 10px; font: inherit; }
.agent-chat-form .primary-button { margin: 0; padding: 0 1.2rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--navy); font-size: .84rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
.empty-state { padding: 2rem; border: 1px dashed #98a2b3; border-radius: 16px; background: var(--surface); text-align: center; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.detail-grid .module-card:last-child { grid-column: 1 / -1; }
dl { display: grid; grid-template-columns: minmax(110px, .45fr) 1fr; gap: .75rem 1rem; }
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; overflow-wrap: anywhere; }
.preserve-lines { white-space: pre-line; }
.file-list { padding-left: 1.2rem; }
.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; }
.work-menu-toggle { display: none; min-width: 44px; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--navy); font-size: 1.25rem; cursor: pointer; }
.work-sidebar { position: fixed; z-index: 5; top: 72px; bottom: 0; left: 0; width: 238px; overflow-y: auto; padding: 1.25rem .85rem; border-right: 1px solid var(--border); background: var(--surface); }
.work-sidebar nav { display: grid; gap: .25rem; }
.work-sidebar a { display: block; padding: .75rem .85rem; border-radius: 10px; color: var(--ink); font-weight: 700; text-decoration: none; }
.work-sidebar a:hover, .work-sidebar a[aria-current="page"] { background: #e7faff; color: var(--navy); }
.work-sidebar-backdrop { display: none; }
.work-layout--admin .shell { width: min(1120px, calc(100% - 2rem - 238px)); margin-left: max(calc(238px + 1rem), calc((100% - 1120px + 238px) / 2)); }
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .topbar__nav { order: 3; width: 100%; }
  .topbar__user > span { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .history-filters { align-items: stretch; flex-direction: column; }
  .detail-grid .module-card:last-child { grid-column: auto; }
}
@media (max-width: 980px) {
  .work-layout--admin { overflow-x: hidden; }
  .work-layout--admin .work-menu-toggle { display: inline-grid; place-items: center; }
  .work-layout--admin .topbar { justify-content: flex-start; }
  .work-layout--admin .topbar__nav { display: none; }
  .work-layout--admin .topbar__user { margin-left: auto; }
  .work-layout--admin .work-sidebar { top: 0; z-index: 12; width: min(300px, calc(100vw - 3rem)); padding-top: 5rem; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 28px rgba(11,31,107,.12); }
  .work-layout--admin.work-menu-open .work-sidebar { transform: translateX(0); }
  .work-layout--admin .work-sidebar-backdrop { position: fixed; inset: 0; z-index: 11; display: block; border: 0; background: rgba(11,31,107,.42); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .work-layout--admin.work-menu-open .work-sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .work-layout--admin .shell { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
