:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #626773;
  --line: #e5e7eb;
  --red: #df000b;
  --red-dark: #b80008;
  --red-soft: #ffe7e8;
  --panel-soft: #fbfbfc;
  --row-hover: #fffafa;
  --gray-chip: #eef0f3;
  --dark-chip: #555b66;
  --shadow: 0 24px 60px rgba(17, 17, 17, 0.08);
  font-family: Arial, Helvetica, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111214;
  --panel: #1b1d21;
  --ink: #f4f5f7;
  --muted: #a9afbb;
  --line: #343842;
  --red: #ff343d;
  --red-dark: #ff5960;
  --red-soft: rgba(255, 52, 61, 0.16);
  --panel-soft: #23262c;
  --row-hover: #2a2023;
  --gray-chip: #2f333b;
  --dark-chip: #8b93a1;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.welcome-screen {
  min-height: 100vh;
  background: #0f1115;
  color: #f7f8fb;
}

.sales-site {
  min-height: 100vh;
  background: #0f1115;
}

.sales-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
}

.sales-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  text-decoration: none;
}

.sales-logo {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.sales-logo img,
.sales-cta img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sales-brand strong {
  display: block;
  font-size: 1.05rem;
}

.sales-brand small {
  color: #c9cfda;
  font-weight: 700;
}

.sales-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sales-link {
  color: #dbe2ee;
  font-weight: 900;
  text-decoration: none;
}

.sales-link:hover,
.sales-link:focus-visible {
  color: #ffffff;
}

.customer-login-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sales-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  align-items: center;
  gap: 56px;
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 96px);
  margin: 0 auto;
  padding: 36px 0 72px;
}

.sales-hero-copy {
  display: grid;
  gap: 18px;
  max-width: 720px;
}

.sales-hero-copy h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(3.2rem, 7vw, 6.4rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.sales-hero-copy p:not(.eyebrow) {
  max-width: 60ch;
  color: #d7dde8;
  font-size: 1.08rem;
  line-height: 1.55;
}

.sales-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.sales-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.sales-hero-visual {
  display: grid;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.sales-preview-top {
  display: flex;
  gap: 7px;
}

.sales-preview-top span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4650;
}

.sales-preview-top span:nth-child(2) {
  background: #f1c45b;
}

.sales-preview-top span:nth-child(3) {
  background: #55c785;
}

.sales-preview-brand {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 12px;
}

.sales-preview-brand img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain;
}

.sales-preview-brand small,
.sales-preview-metrics span,
.sales-preview-list span {
  color: #cfd6e2;
}

.sales-preview-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sales-preview-metrics span,
.sales-preview-list span {
  display: grid;
  min-height: 64px;
  align-content: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
  font-weight: 900;
}

.sales-preview-metrics strong {
  display: block;
  color: #ffffff;
  font-size: 1.5rem;
}

.sales-preview-list {
  display: grid;
  gap: 8px;
}

.customer-access,
.sales-services,
.sales-cta {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.customer-access {
  padding: 0 0 52px;
}

.customer-access-form {
  display: grid;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 24px;
  background: #ffffff;
  color: #111214;
}

.customer-access-form p:not(.eyebrow) {
  color: #626773;
}

.customer-access-form label {
  display: grid;
  gap: 8px;
  color: #4d5564;
  font-weight: 900;
}

.workspace-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.workspace-control input,
.workspace-control select {
  min-height: 46px;
  border: 1px solid #d8dde7;
  border-radius: 6px;
  padding: 0 12px;
  color: #111214;
  background: #ffffff;
  font: inherit;
  font-weight: 800;
}

.sales-services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 20px 0 72px;
}

.sales-services article {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.08);
}

.sales-services span {
  color: #ff5960;
  font-weight: 900;
}

.sales-services h2,
.sales-cta h2,
.customer-access h2 {
  margin: 0;
  letter-spacing: 0;
}

.sales-services p {
  color: #d7dde8;
  line-height: 1.5;
}

.sales-cta {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 56px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 20px;
  background: #ffffff;
  color: #111214;
}

.sales-cta img {
  width: 64px;
  height: 64px;
  border: 1px solid #d8dde7;
  border-radius: 8px;
}

.system-list {
  display: grid;
  gap: 12px;
}

.system-list-status {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.system-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--bg);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.system-card:hover,
.system-card:focus-visible {
  border-color: var(--red);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.system-card-logo {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--red);
  background: var(--panel);
  font-weight: 900;
}

.system-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.system-card-name {
  display: grid;
  gap: 4px;
}

.system-card-name strong {
  font-size: 1.1rem;
}

.system-card-name span,
.system-card-action {
  color: var(--muted);
  font-weight: 900;
}

.system-card-action {
  white-space: nowrap;
}

.login-card {
  display: grid;
  width: min(440px, 100%);
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form h2 {
  margin-bottom: 6px;
}

.login-form p {
  color: var(--muted);
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.login-form input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel);
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  width: 100%;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: grid;
  width: 32px;
  height: 32px;
  min-height: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--red);
  background: rgba(199, 29, 37, 0.08);
}

.password-toggle svg {
  grid-area: 1 / 1;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.password-toggle .eye-closed,
.password-toggle[aria-pressed="true"] .eye-open {
  display: none;
}

.password-toggle[aria-pressed="true"] .eye-closed {
  display: block;
}

.form-error {
  min-height: 20px;
  color: var(--red-dark);
  font-weight: 900;
}

.form-message {
  min-height: 20px;
  color: var(--muted);
  font-weight: 900;
}

.form-message.error {
  color: var(--red-dark);
}

.form-error.success-message {
  color: #15803d;
}

.login-link {
  justify-self: center;
  padding: 2px 0;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
}

.portal-shell {
  min-height: 100vh;
  background: var(--bg);
}

.portal-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 14px clamp(18px, 4vw, 42px);
  background: var(--panel);
}

.portal-account {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-account div {
  display: grid;
  gap: 3px;
  text-align: right;
}

.portal-account small {
  color: var(--muted);
}

.site-switch-button {
  text-decoration: none;
}

.site-switch-button[hidden] {
  display: none;
}

.account-panel .site-switch-button {
  width: 100%;
}

.account-panel .account-action-button {
  width: 100%;
}

.portal-main {
  display: grid;
  width: min(1120px, 100%);
  gap: 22px;
  margin: 0 auto;
  padding: 28px;
}

.portal-hero {
  display: flex;
  min-height: 170px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(20px, 4vw, 34px);
  background: var(--panel);
}

.portal-hero div {
  display: grid;
  gap: 10px;
}

.portal-hero p:not(.eyebrow) {
  color: var(--muted);
}

.portal-ticket-list {
  display: grid;
  gap: 10px;
}

.portal-metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.portal-filter-card {
  color: var(--ink);
  text-align: left;
}

.portal-filter-card:hover,
.portal-filter-card.is-active {
  border-color: rgba(223, 0, 11, 0.45);
  background: var(--row-hover);
}

.portal-filter-card.is-active span {
  color: var(--red);
}

.portal-ticket-card {
  display: grid;
  width: 100%;
  min-height: 76px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: var(--panel-soft);
  text-align: left;
}

.portal-ticket-card:hover,
.portal-ticket-card.is-active {
  border-color: rgba(223, 0, 11, 0.45);
  background: var(--panel);
}

.portal-ticket-card div:first-child {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.portal-ticket-card strong,
.portal-ticket-card span,
.portal-ticket-card em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-ticket-card span,
.portal-ticket-card small,
.portal-ticket-card em {
  color: var(--muted);
}

.portal-ticket-card em {
  font-style: normal;
  font-weight: 900;
}

.portal-ticket-card .status-pill {
  min-width: 54px;
  justify-content: center;
}

.portal-ticket-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-ticket-detail-panel {
  align-content: start;
}

.portal-detail-header {
  align-items: start;
}

.portal-ticket-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.portal-ticket-summary > div {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}

.portal-ticket-summary span,
.portal-detail-section h4 {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.portal-ticket-summary strong {
  overflow-wrap: anywhere;
}

.portal-detail-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.portal-detail-section p {
  line-height: 1.5;
  white-space: pre-wrap;
}

.portal-response-form {
  display: grid;
  gap: 12px;
}

.portal-response-actions {
  display: flex;
  justify-content: end;
}

.portal-metrics .metric strong {
  overflow-wrap: anywhere;
  font-size: 1.35rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  gap: 18px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  order: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  flex: 0 0 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--panel);
  background: var(--panel);
  font-weight: 900;
}

.brand-logo img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
}

.brand-logo span {
  display: none;
}

.eyebrow,
.section-label {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.2rem;
}

h2 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

h3 {
  font-size: 1.05rem;
}

.nav-list {
  order: 2;
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 900;
}

.nav-item span:first-child {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  font-size: 1.1rem;
  flex: 0 0 26px;
  overflow: hidden;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.nav-item.active,
.nav-item:hover {
  color: var(--red);
  background: var(--red-soft);
}

.sidebar-create {
  order: 3;
  width: 100%;
}

.sidebar-section {
  order: 5;
  display: grid;
  gap: 8px;
}

.mini-stat {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.mini-stat strong {
  color: var(--ink);
}

.account-panel {
  order: 4;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.account-panel span,
.account-panel small {
  display: block;
}

.account-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-panel span {
  font-weight: 900;
}

.account-panel small {
  margin-top: 3px;
  color: var(--muted);
}

.theme-toggle {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--red);
}

.theme-toggle svg {
  grid-area: 1 / 1;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.theme-toggle .theme-moon,
:root[data-theme="dark"] .theme-toggle .theme-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-moon {
  display: block;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  padding: 28px;
}

.dashboard-view,
.tickets-view,
.reports-view,
.ai-chat-view,
.settings-view,
.ticket-detail {
  display: grid;
  gap: 22px;
}

.app-shell[hidden],
.portal-shell[hidden],
.welcome-screen[hidden],
.login-screen[hidden],
.login-form[hidden],
.dashboard-view[hidden],
.tickets-view[hidden],
.reports-view[hidden],
.ai-chat-view[hidden],
.settings-view[hidden],
.ticket-detail[hidden],
.filter-panel[hidden],
.compose-panel[hidden] {
  display: none;
}

.compose-panel.portal-compose .tech-only-field {
  display: none;
}

.topbar,
.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar-actions,
.tool-buttons,
.pager,
.detail-actions,
.compose-actions > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-view .topbar-actions {
  align-items: flex-end;
}

.icon-button,
.ghost-icon,
.primary-button,
.secondary-button,
.outline-button,
.link-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 900;
}

.icon-button,
.ghost-icon {
  width: 42px;
  padding: 0;
  font-size: 1.15rem;
}

.primary-button {
  border-color: var(--red);
  color: var(--panel);
  background: var(--red);
  box-shadow: 0 14px 30px rgba(223, 0, 11, 0.18);
}

.primary-button:hover {
  background: var(--red-dark);
}

.link-button {
  border-color: transparent;
  color: var(--red);
  background: transparent;
}

.outline-button,
.secondary-button {
  color: var(--ink);
}

.danger-button {
  border-color: rgba(197, 31, 38, 0.35);
  color: var(--red);
}

.danger-button:hover {
  border-color: var(--red);
  background: rgba(197, 31, 38, 0.08);
}

.metrics-grid,
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.dashboard-grid {
  grid-template-columns: minmax(240px, 0.75fr) minmax(320px, 1.1fr) minmax(320px, 1.1fr);
}

.metric,
.panel,
.queue-tools,
.filter-panel,
.table-wrap,
.queue-footer,
.detail-card,
.compose-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  min-height: 92px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.85rem;
}

.panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.feature-panel {
  align-content: start;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.type-summary,
.priority-list,
.feature-list,
.ticket-list,
.user-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.dashboard-scope-control {
  display: inline-grid;
  gap: 4px;
  min-width: 230px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.dashboard-scope-control[hidden] {
  display: none;
}

.dashboard-scope-control select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 36px 0 12px;
  color: var(--ink);
  background: var(--panel);
  font: inherit;
}

.type-row,
.priority-item {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--panel);
}

.priority-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  text-align: left;
}

.priority-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.priority-item small {
  grid-column: 2;
  color: var(--muted);
}

.feature-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  min-height: 46px;
  align-items: center;
  border: 1px solid rgba(223, 0, 11, 0.28);
  border-left: 4px solid var(--red);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--ink);
  background: rgba(223, 0, 11, 0.08);
  text-align: left;
}

.feature-item:hover {
  background: rgba(223, 0, 11, 0.14);
}

:root[data-theme="dark"] .feature-item {
  border-color: rgba(255, 52, 61, 0.35);
  border-left-color: var(--red);
  background: rgba(255, 52, 61, 0.16);
}

:root[data-theme="dark"] .feature-item:hover {
  background: rgba(255, 52, 61, 0.24);
}

.feature-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feature-item small {
  grid-column: 2;
  color: var(--muted);
}

.feature-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 10px;
  color: #ffffff;
  background: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.team-panel {
  grid-column: 1 / -1;
}

.user-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.user-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: var(--panel);
  background: var(--red);
  font-weight: 900;
}

.user-row div:nth-child(2) {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.user-row span,
.user-row small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  align-items: start;
}

.column {
  display: grid;
  min-height: 300px;
  align-content: start;
  gap: 12px;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
}

.column-count {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  background: var(--line);
  font-weight: 900;
}

.ticket-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(17, 17, 17, 0.04);
  text-align: left;
}

.ticket-card:hover {
  border-color: rgba(223, 0, 11, 0.45);
  box-shadow: 0 16px 34px rgba(17, 17, 17, 0.08);
}

.ticket-card h4 {
  font-size: 0.98rem;
  line-height: 1.3;
}

.ticket-meta,
.ticket-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-state {
  min-height: 110px;
  border: 1px dashed #c6d0d5;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.52);
}

.quick-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  min-width: min(680px, 100%);
  overflow: hidden;
  border-radius: 26px;
  background: var(--panel);
}

.type-filter {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  font-weight: 700;
}

.type-filter:first-child {
  border-left: 0;
}

.type-filter.active {
  color: var(--panel);
  background: var(--red);
}

.type-filter strong {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
}

.queue-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 26px;
}

.search-box {
  display: flex;
  width: min(430px, 100%);
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0 14px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

label input,
label select,
label textarea,
.title-input,
.settings-search input,
.settings-form input,
.settings-form select,
.settings-actions input,
.setting-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel);
}

.settings-home,
.settings-editor {
  display: grid;
  gap: 28px;
}

.settings-home[hidden],
.settings-editor[hidden],
.settings-detail-panel[hidden] {
  display: none;
}

.settings-search {
  display: flex;
  justify-content: center;
}

.settings-search input {
  width: min(560px, 100%);
  min-height: 48px;
  border-radius: 999px;
  padding: 0 18px;
  background: var(--panel);
}

.settings-directory {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 56px 48px;
  align-items: start;
  padding: 6px 0 18px;
}

.settings-group {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.settings-group-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #7187df;
}

.settings-group-icon svg {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.settings-group h3 {
  margin: 0;
  font-size: 1.08rem;
}

.settings-links {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.settings-link {
  width: fit-content;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
}

.settings-link:hover,
.settings-link:focus-visible {
  color: var(--red);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.settings-panel {
  align-content: start;
}

.settings-detail-panel {
  width: min(1120px, 100%);
}

.settings-actions,
.settings-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-actions {
  min-width: min(430px, 100%);
}

.settings-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(190px, 1.2fr) minmax(130px, 0.8fr) minmax(150px, 0.9fr) minmax(160px, 0.9fr) auto auto auto auto;
}

.settings-list {
  display: grid;
  gap: 8px;
}

.category-add-form {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-soft);
}

.category-add-form[hidden] {
  display: none;
}

.category-add-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.category-rules-grid,
.category-row-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.category-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.company-settings-panel {
  width: min(1180px, 100%);
}

.audit-log-panel {
  width: min(1360px, 100%);
}

.audit-log-toolbar {
  display: flex;
  justify-content: end;
}

.audit-log-toolbar input {
  width: min(380px, 100%);
}

.audit-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.audit-log-table {
  width: 100%;
  min-width: 1220px;
  border-collapse: collapse;
  font-size: 13px;
}

.audit-log-table th,
.audit-log-table td {
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.audit-log-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  font-weight: 900;
}

.audit-log-table tbody tr:hover {
  background: var(--row-hover);
}

.audit-action {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--red-dark);
  background: var(--red-soft);
  font-weight: 900;
}

.audit-log-table details {
  max-width: 360px;
}

.audit-log-table summary {
  color: var(--red);
  cursor: pointer;
  font-weight: 900;
}

.audit-log-table pre {
  max-width: 360px;
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--panel-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.company-settings-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.company-list {
  display: grid;
  gap: 8px;
}

.company-list-item {
  display: grid;
  gap: 5px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: var(--ink);
  background: var(--panel-soft);
  text-align: left;
}

.company-list-item:hover,
.company-list-item.active {
  border-color: var(--red);
  background: var(--red-soft);
}

.company-list-item span,
.company-list-item small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-list-item small {
  font-weight: 900;
}

.company-form {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-soft);
}

.company-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 12px;
  row-gap: 12px;
  align-items: start;
}

.company-form-grid > label {
  min-width: 0;
}

.company-field-wide,
.company-field-full {
  grid-column: 1 / -1;
}

.company-logo-section {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.company-logo-preview {
  display: grid;
  width: 144px;
  height: 96px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--panel);
}

.company-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.company-logo-controls {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.company-logo-controls span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-logo-actions,
.company-form-actions,
.company-form-actions > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.company-form-actions {
  justify-content: space-between;
}

.company-upload-button {
  display: inline-flex;
  min-height: 41px;
  align-items: center;
  justify-content: center;
}

.compact-settings-list {
  max-height: 420px;
  overflow: auto;
}

.category-settings-list {
  max-height: min(560px, 62vh);
  overflow: auto;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--panel-soft);
}

.status-setting-row {
  grid-template-columns: minmax(0, 1fr) minmax(110px, auto) auto auto auto;
}

.status-color-control {
  display: inline-grid;
  min-width: 104px;
  grid-template-columns: auto 36px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.status-color-control input {
  width: 36px;
  min-width: 36px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  background: var(--panel);
}

.category-setting-row {
  grid-template-columns: minmax(130px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(160px, 1.2fr) minmax(280px, 1.4fr) auto;
}

.category-row-flags {
  min-width: 0;
}

.user-setting-row {
  grid-template-columns: minmax(130px, 1fr) minmax(190px, 1.2fr) minmax(130px, 0.8fr) minmax(150px, 0.9fr) minmax(160px, 0.9fr) auto auto auto auto auto auto auto auto;
}

.user-setting-row.is-inactive {
  opacity: 0.82;
}

.user-setting-row.is-archived {
  border-style: dashed;
}

.archive-toggle {
  margin-left: auto;
}

.removed-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.check-label input {
  width: auto;
  min-width: 0;
  margin: 0;
}

.field-hint {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-portal-hint {
  grid-column: 1 / -1;
  margin-top: -8px;
}

.table-wrap {
  overflow: auto;
}

.ticket-table {
  width: 100%;
  min-width: 1460px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.ticket-table th,
.ticket-table td {
  height: 45px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0 12px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  overflow: visible;
  background: var(--panel-soft);
  font-weight: 700;
}

.ticket-table th[data-sort] {
  padding: 0;
}

.ticket-table th:first-child,
.ticket-table td:first-child {
  width: 44px;
  text-align: center;
}

.select-column {
  padding: 0 12px;
}

.sort-header {
  display: flex;
  width: 100%;
  min-height: 45px;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 0;
  padding: 0 18px 0 12px;
  overflow: hidden;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 900;
  text-align: left;
}

.sort-header:hover,
.ticket-table th.is-sorted .sort-header {
  color: var(--red);
  background: var(--row-hover);
}

.sort-indicator {
  min-width: 10px;
  margin-left: auto;
  color: var(--red);
  text-align: right;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  z-index: 3;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  position: absolute;
  top: 8px;
  right: 3px;
  bottom: 8px;
  width: 2px;
  border-radius: 999px;
  background: var(--red);
  content: "";
  opacity: 0;
}

.ticket-table th:hover .column-resizer::after,
body.is-column-resizing .column-resizer::after {
  opacity: 0.55;
}

body.is-column-resizing {
  cursor: col-resize;
  user-select: none;
}

.ticket-table tbody tr[data-ticket-row] {
  cursor: pointer;
}

.ticket-table tbody tr[data-ticket-row]:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: -2px;
}

.ticket-table tbody tr.feature-request-row {
  background: rgba(223, 0, 11, 0.1);
}

:root[data-theme="dark"] .ticket-table tbody tr.feature-request-row {
  background: rgba(255, 52, 61, 0.18);
}

.ticket-table tbody tr.feature-request-row td:first-child {
  box-shadow: inset 4px 0 0 var(--red);
}

.ticket-table tbody tr:hover {
  background: var(--row-hover);
}

.ticket-table tbody tr.feature-request-row:hover {
  background: rgba(223, 0, 11, 0.16);
}

:root[data-theme="dark"] .ticket-table tbody tr.feature-request-row:hover {
  background: rgba(255, 52, 61, 0.26);
}

.title-cell {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.id-button {
  border: 0;
  color: var(--ink);
  background: transparent;
}

.id-button:hover {
  color: var(--red);
  text-decoration: underline;
}

.status-pill,
.chip {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill,
.dark-chip {
  color: var(--status-text, var(--panel));
  background: var(--status-bg, var(--dark-chip));
}

.red-chip {
  color: var(--panel);
  background: var(--red);
}

.priority-chip {
  color: var(--priority-chip-text, var(--panel));
  background: var(--priority-chip-bg, var(--dark-chip));
}

.priority-level-1 {
  --priority-chip-bg: var(--red);
  --priority-chip-text: #ffffff;
  --priority-border: var(--red);
  --priority-text: var(--red-dark);
  --priority-bg: var(--red-soft);
}

.priority-level-2 {
  --priority-chip-bg: #d96b00;
  --priority-chip-text: #ffffff;
  --priority-border: #d96b00;
  --priority-text: #9a4900;
  --priority-bg: #fff1e4;
}

.priority-level-3 {
  --priority-chip-bg: #ffd34d;
  --priority-chip-text: #3e3100;
  --priority-border: #d4a600;
  --priority-text: #6f5600;
  --priority-bg: #fff8d9;
}

.priority-level-4 {
  --priority-chip-bg: #2f6fbd;
  --priority-chip-text: #ffffff;
  --priority-border: #2f6fbd;
  --priority-text: #23528b;
  --priority-bg: #eaf3ff;
}

.priority-level-5 {
  --priority-chip-bg: #2e7d4f;
  --priority-chip-text: #ffffff;
  --priority-border: #2e7d4f;
  --priority-text: #1f633c;
  --priority-bg: #eaf7ef;
}

:root[data-theme="dark"] .priority-level-2 {
  --priority-text: #ffad63;
  --priority-bg: rgba(217, 107, 0, 0.18);
}

:root[data-theme="dark"] .priority-level-3 {
  --priority-chip-bg: #e0b52d;
  --priority-chip-text: #211a00;
  --priority-text: #f2d666;
  --priority-bg: rgba(224, 181, 45, 0.18);
}

:root[data-theme="dark"] .priority-level-4 {
  --priority-text: #8fc2ff;
  --priority-bg: rgba(47, 111, 189, 0.2);
}

:root[data-theme="dark"] .priority-level-5 {
  --priority-text: #8ee3ab;
  --priority-bg: rgba(46, 125, 79, 0.2);
}

.gray-chip {
  color: var(--ink);
  background: var(--gray-chip);
}

.queue-footer {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  padding: 0 22px;
  color: var(--ink);
  font-size: 13px;
}

.queue-footer label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-footer select {
  width: 76px;
  padding: 7px;
}

.detail-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.detail-title-block {
  display: grid;
  gap: 6px;
}

.detail-title-block p,
.summary-strip span {
  color: var(--muted);
  font-size: 13px;
}

#detailTitle {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: clamp(22px, 4vw, 28px);
}

.summary-strip {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(360px, 1.7fr) minmax(150px, 0.7fr) minmax(170px, 0.75fr);
  gap: 22px;
  align-items: end;
}

.summary-strip > div {
  display: grid;
  gap: 7px;
}

.detail-select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 900;
}

.priority-select {
  border-color: var(--priority-border, var(--line));
  color: var(--priority-text, var(--ink));
  background: var(--priority-bg, var(--panel));
}

.status-select {
  border-color: var(--dark-chip);
}

.category-cascade {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.category-cascade label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.category-cascade select {
  width: 100%;
  min-width: 0;
}

.compose-category-cascade {
  grid-column: 1 / -1;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-card {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tabs {
  display: flex;
  gap: 34px;
  padding: 24px 42px 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 46px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--red);
}

.tab-panel {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 56px 46px;
}

.ticket-detail {
  height: calc(100dvh - 56px);
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.accordion-section {
  display: grid;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 26px;
  margin-bottom: 22px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  margin: 0;
}

.detail-grid div {
  display: grid;
  gap: 7px;
}

.detail-grid .wide {
  grid-column: 1 / -1;
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

dd {
  margin: 0;
}

.description-box {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 16px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline article {
  display: grid;
  gap: 4px;
  border-left: 4px solid var(--red);
  padding: 10px 14px;
  background: var(--bg);
}

.journey-entry-header,
.journey-edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.journey-entry-header strong {
  min-width: 0;
}

.journey-edit-button {
  border: 0;
  padding: 0;
  color: var(--red);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.journey-edit-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.journey-note-body {
  display: grid;
  gap: 8px;
}

.timeline p {
  margin: 2px 0 0;
  white-space: pre-wrap;
}

.muted-note {
  color: var(--muted);
}

.timeline span,
.empty-panel p {
  color: var(--muted);
}

.journey-email-state {
  margin-left: 8px;
  color: var(--red);
  font-style: normal;
  font-weight: 900;
}

.journey-form {
  display: grid;
  gap: 12px;
}

.journey-edit-form {
  display: grid;
  gap: 10px;
}

.journey-edit-form textarea {
  min-height: 108px;
  resize: vertical;
}

.journey-edit-actions {
  justify-content: end;
}

.journey-edit-actions .primary-button,
.journey-edit-actions .secondary-button {
  min-height: 36px;
}

.journey-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.note-box textarea {
  min-height: 120px;
  resize: vertical;
}

.empty-panel {
  display: grid;
  min-height: 240px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.attachment-panel {
  display: grid;
  gap: 18px;
}

.attachment-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.attachment-toolbar h2 {
  margin: 0 0 4px;
}

.attachment-picker-label {
  cursor: pointer;
}

.attachment-list {
  display: grid;
  gap: 10px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-soft);
}

.attachment-item > div:last-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.attachment-item a {
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.attachment-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.attachment-file-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 6px;
  color: var(--panel);
  background: var(--red);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
}

.attachment-empty {
  min-height: 150px;
}

.compose-attachments {
  display: grid;
  gap: 8px;
  min-width: min(420px, 100%);
}

.compose-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compose-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: var(--panel-soft);
  font-weight: 900;
}

.compose-attachment-chip em {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: normal;
}

.compose-attachment-chip button {
  min-width: 24px;
  min-height: 24px;
  border: 0;
  color: var(--red);
  background: transparent;
  font-weight: 900;
}

.portal-attachment-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
}

.ai-panel,
.ai-results {
  display: grid;
  gap: 18px;
}

.ai-panel {
  min-height: 260px;
  align-content: center;
  justify-items: start;
}

.ai-panel p,
.ai-result-header p {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.5;
}

.ai-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ai-grid article,
.ai-draft {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-soft);
}

.ai-grid p,
.ai-draft p,
.ai-grid li {
  color: var(--ink);
  line-height: 1.5;
}

.ai-grid ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.ai-draft p {
  white-space: pre-wrap;
}

.report-list {
  display: grid;
  gap: 12px;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}

.report-row div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.report-row span {
  color: var(--muted);
  font-size: 13px;
}

.report-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-chip);
}

.report-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

.chat-shell {
  display: grid;
  max-width: 100%;
  min-width: 0;
  min-height: min(720px, calc(100vh - 150px));
  grid-template-rows: auto minmax(320px, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.chat-messages {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px;
  background: var(--panel-soft);
}

.chat-message {
  display: grid;
  gap: 6px;
  min-width: 0;
  max-width: min(720px, 88%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chat-message.is-user {
  justify-self: end;
  border-color: #25272e;
  color: var(--panel);
  background: #25272e;
}

.chat-message span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.chat-message.is-user span {
  color: rgba(255, 255, 255, 0.72);
}

.chat-message p {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.is-pending p {
  color: var(--muted);
}

.chat-message.is-error {
  border-color: #ffd0d3;
  color: var(--red-dark);
  background: #fff3f4;
}

.chat-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding-top: 4px;
}

.chat-citations strong,
.chat-citations a {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
}

.chat-citations strong {
  color: var(--muted);
  background: var(--gray-chip);
}

.chat-citations a {
  max-width: min(260px, 100%);
  min-width: 0;
  overflow: hidden;
  color: var(--red-dark);
  background: var(--red-soft);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-citations a:hover {
  text-decoration: underline;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.chat-form textarea {
  min-height: 74px;
  max-height: 180px;
  resize: vertical;
}

.chat-form .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.compose-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  width: min(680px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  box-shadow: var(--shadow);
}

.compose-panel form {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.close-ticket-panel {
  width: min(520px, calc(100vw - 36px));
}

.close-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.close-panel-header h2 {
  margin: 4px 0 0;
}

.form-switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.form-switch-row input {
  width: auto;
  min-width: 0;
}

.compose-top {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(150px, 180px) auto;
  align-items: end;
  gap: 14px;
}

.title-input {
  font-size: 22px;
}

.feature-request-notice {
  margin: -6px 0 0;
  border: 1px solid color-mix(in srgb, var(--red) 32%, var(--line));
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--red-soft);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.feature-request-notice[hidden] {
  display: none;
}

.compose-strip,
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.form-grid {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-section {
  display: grid;
  gap: 16px;
}

.compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

@media (max-width: 1100px) {
  .sales-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 46px;
  }

  .sales-hero-copy h1 {
    max-width: 13ch;
  }

  .sales-hero-visual {
    max-width: 620px;
  }

  .sales-services {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    position: static;
    min-height: auto;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 18px;
  }

  .nav-list {
    display: flex;
    grid-column: 1 / -1;
    overflow-x: auto;
  }

  .sidebar-create,
  .sidebar-section {
    display: none;
  }

  .account-panel {
    grid-column: 1 / -1;
  }

  .board {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-form,
  .category-add-grid,
  .user-setting-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-settings-layout {
    grid-template-columns: 1fr;
  }

  .company-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .queue-header,
  .queue-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .quick-filters {
    min-width: 0;
  }

  .portal-header,
  .portal-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-account {
    justify-content: space-between;
  }

  .portal-account div {
    text-align: left;
  }

  .ticket-detail {
    height: auto;
    min-height: calc(100dvh - 36px);
    overflow: visible;
  }

  .detail-card {
    min-height: 0;
  }

  .tab-panel {
    overflow-y: visible;
  }
}

@media (max-width: 720px) {
  .welcome-screen {
    padding: 0;
  }

  .sales-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .sales-actions {
    flex-wrap: wrap;
  }

  .sales-hero {
    gap: 30px;
    width: min(100% - 32px, 1180px);
    padding: 28px 0 46px;
  }

  .sales-hero-copy h1 {
    font-size: clamp(2.7rem, 15vw, 4.2rem);
  }

  .sales-hero-actions,
  .workspace-control,
  .sales-cta {
    grid-template-columns: 1fr;
  }

  .sales-hero-actions > *,
  .workspace-control > *,
  .sales-cta > * {
    width: 100%;
  }

  .sales-preview-metrics,
  .sales-cta {
    grid-template-columns: 1fr;
  }

  .customer-access,
  .sales-services,
  .sales-cta {
    width: min(100% - 32px, 1180px);
  }

  .main-content {
    padding: 18px;
  }

  .topbar,
  .compose-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-grid,
  .dashboard-grid,
  .board,
  .summary-strip,
  .filter-panel,
  .compose-strip,
  .form-grid,
  .compose-top,
  .report-row,
  .chat-form,
  .ai-grid,
  .detail-grid,
  .settings-form,
  .category-add-grid,
  .company-form-grid,
  .company-logo-section,
  .setting-row,
  .status-setting-row,
  .category-setting-row,
  .user-setting-row {
    grid-template-columns: 1fr;
  }

  .company-field-wide,
  .company-field-full {
    grid-column: auto;
  }

  .company-logo-preview {
    width: 100%;
  }

  .portal-main {
    padding: 18px;
  }

  .portal-ticket-card {
    grid-template-columns: 1fr;
  }

  .portal-ticket-meta {
    justify-content: space-between;
  }

  .portal-ticket-summary {
    grid-template-columns: 1fr;
  }

  .company-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .company-form-actions > div {
    width: 100%;
  }

  .settings-actions {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
  }

  .quick-filters {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    border-radius: 8px;
  }

  .tabs {
    gap: 12px;
    overflow-x: auto;
    padding: 18px 18px 0;
  }

  .tab-panel {
    padding: 22px 18px;
  }

  .chat-shell {
    min-height: calc(100vh - 120px);
  }

  .chat-message {
    max-width: 100%;
  }

  .compose-actions > div,
  .compose-actions button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
