/*
 * Opennetworks Service Desk — Application Stylesheet
 * Uses tokens from /css/tokens.css exclusively.
 */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, p {
  margin: 0;
}

a {
  color: var(--blue-deep);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* Numbers use tabular-nums */
.num,
.kpi-value,
.nav-count,
.queue-count,
.bell-badge,
.pill,
.sla-badge,
.sla-meter-status,
.sla-meter-foot,
.bar-count,
.cat-count,
.ticket-num,
.ticket-num-cell,
.attention-num,
.tg-count,
time {
  font-variant-numeric: tabular-nums;
}

/* Skip link */
.skip {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 1000;
  padding: 8px 16px;
  background: var(--primary-bg);
  color: var(--on-primary);
  border-radius: var(--r-pill);
  font-weight: 500;
}

.skip:focus {
  top: 12px;
  outline: none;
  box-shadow: var(--focus);
}

/* ---------- Shell Layout ---------- */
.shell {
  display: flex;
  min-height: 100vh;
}

.nav {
  width: 252px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 60% at 0% 0%, var(--navy-glow) 0%, transparent 60%), var(--navy);
  color: var(--on-navy);
  border-right: 1px solid var(--navy-line);
  z-index: 200;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--navy-line);
  color: var(--on-navy);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 104px;
  height: auto;
  display: block;
  flex-shrink: 0;
}

.brand-name {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--on-navy);
  padding-left: 12px;
  border-left: 1px solid var(--navy-line);
}

.nav-items {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--on-navy-muted);
}

.nav-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--navy-line);
  background: transparent;
  color: var(--on-navy-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms ease;
}

.nav-add-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--on-navy-2);
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-navy);
  text-decoration: none;
}

.nav-link:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.nav-link.is-active {
  background: var(--navy-2);
  color: var(--on-navy);
  box-shadow: inset 3px 0 0 var(--blue);
}

.nav-link-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-link-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-navy-2);
  font-size: 12px;
  font-weight: 600;
}

.nav-count.is-breaching {
  background: #D93025;
  color: #FFFFFF;
}

.nav-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--navy-line);
}

.nav-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--on-navy-muted);
  line-height: 1.4;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--on-navy-muted);
}

.status-dot.is-open {
  background: #47A141;
}

.nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(9, 22, 48, 0.45);
  z-index: 190;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 150;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.menu-btn,
.icon-btn.menu-btn {
  display: none;
  flex-shrink: 0;
}

.search {
  position: relative;
  flex: 1;
  max-width: 460px;
  min-width: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 38px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.search-input::placeholder {
  color: var(--faint);
}

.search-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus);
}

.search-kbd {
  position: absolute;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  pointer-events: none;
}

.search-input:focus + .search-kbd {
  display: none;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 320px;
  max-height: 440px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  padding: 8px;
  z-index: 300;
}

.search-group-label {
  padding: 6px 10px 4px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.search-item:hover,
.search-item.is-active {
  background: var(--surface-2);
  text-decoration: none;
}

.search-item-main {
  min-width: 0;
  flex: 1;
}

.search-item-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- Buttons & Inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.btn:focus-visible,
.icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-primary {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-bg-hover);
  border-color: var(--primary-bg-hover);
  color: var(--on-primary);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  color: var(--red-deep);
}

.btn-danger:hover {
  background: var(--red-tint);
  border-color: var(--red-deep);
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--red);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--canvas);
}

.input,
.select,
.textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.textarea {
  height: auto;
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235E6B82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-2);
  color: var(--faint);
  cursor: not-allowed;
}

/* ---------- Popover Menus (Bell & Viewing As) ---------- */
.pop-wrap {
  position: relative;
}

.agent-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px 0 6px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms ease;
}

.agent-picker-btn:hover {
  background: var(--surface-2);
}

.agent-picker-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.pop-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  z-index: 300;
  overflow: hidden;
}

.pop-menu.agent-menu {
  width: 280px;
}

.pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.pop-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.pop-link-btn {
  border: none;
  background: none;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--blue-deep);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.pop-link-btn:hover {
  background: var(--blue-tint);
}

.pop-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 140ms ease;
}

.notif-item:hover {
  background: var(--surface-2);
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: transparent;
}

.notif-item.is-unread .notif-dot {
  background: var(--blue);
}

.notif-body-wrap {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.notif-text {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.notif-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.agent-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
}

.agent-option:hover {
  background: var(--surface-2);
}

.agent-option.is-selected {
  background: var(--panel-blue);
}

.agent-option-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.agent-option-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.agent-option-role {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Avatars, Pills, SLA Badges ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #FFFFFF;
  font-weight: 600;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Priority pills */
.pill-p1 {
  background: var(--red-tint);
  color: var(--red-deep);
}
.pill-p2 {
  background: var(--amber-tint);
  color: var(--amber-deep);
}
.pill-p3 {
  background: var(--blue-tint);
  color: var(--blue-deep);
}
.pill-p4 {
  background: var(--slate-tint);
  color: var(--muted);
}
.pill-p5 {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

/* State pills */
.pill-state-new {
  background: var(--blue-tint);
  color: var(--blue-deep);
}
.pill-state-in_progress {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.pill-state-in_progress .pill-dot {
  background: var(--blue);
}
.pill-state-on_hold {
  background: var(--amber-tint);
  color: var(--amber-deep);
}
.pill-state-resolved {
  background: var(--green-tint);
  color: var(--green-deep);
}
.pill-state-closed {
  background: var(--slate-tint);
  color: var(--muted);
}
.pill-state-canceled {
  background: var(--slate-tint);
  color: var(--faint);
}
.pill-state-canceled .pill-label {
  text-decoration: line-through;
}

/* Plan pills */
.pill-plan-enterprise,
.pill-plan-premier {
  background: var(--blue-tint);
  color: var(--blue-deep);
}
.pill-plan-business {
  background: var(--green-tint);
  color: var(--green-deep);
}
.pill-plan-standard {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.pill-plan-basic {
  background: var(--slate-tint);
  color: var(--muted);
}

/* SLA badge */
.sla-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px 0 6px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}

.sla-ring {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.sla-ring-track {
  fill: none;
  stroke: currentColor;
  stroke-opacity: 0.22;
  stroke-width: 2.2;
}

.sla-ring-fill {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.sla-kind {
  font-weight: 500;
  opacity: 0.85;
}

.sla-on_track {
  background: var(--green-tint);
  color: var(--green-deep);
}
.sla-at_risk {
  background: var(--amber-tint);
  color: var(--amber-deep);
}
.sla-breached {
  background: var(--red-tint);
  color: var(--red-deep);
}
.sla-paused {
  background: var(--slate-tint);
  color: var(--muted);
}
.sla-met {
  background: var(--green-tint);
  color: var(--green-deep);
  opacity: 0.82;
}
.sla-missed {
  background: var(--red-tint);
  color: var(--red-deep);
  opacity: 0.82;
}

/* Dark variant for SLA badge inside the navy Hero panel */
.sla-badge.is-dark.sla-breached {
  background: rgba(217, 48, 37, 0.24);
  color: #FF9E97;
  border: 1px solid rgba(242, 139, 130, 0.35);
}
.sla-badge.is-dark.sla-at_risk {
  background: rgba(249, 171, 0, 0.2);
  color: #FDD663;
  border: 1px solid rgba(253, 214, 99, 0.35);
}
.sla-badge.is-dark.sla-on_track {
  background: rgba(71, 161, 65, 0.22);
  color: #81C995;
  border: 1px solid rgba(129, 201, 149, 0.35);
}
.sla-badge.is-dark.sla-paused {
  background: rgba(255, 255, 255, 0.1);
  color: var(--on-navy-2);
}

/* ---------- View Container & Typography ---------- */
.view {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px;
}

.view:focus {
  outline: none;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--ink);
  line-height: 1.2;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

/* ---------- Overview: Hero Panel ---------- */
.hero {
  border-radius: var(--r-xl);
  background: radial-gradient(circle at 78% 40%, var(--navy-glow) 0%, var(--navy-deep) 62%);
  color: var(--on-navy);
  padding: 28px 30px;
  margin-bottom: 22px;
  border: 1px solid var(--navy-line);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.hero-greeting {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--on-navy-muted);
  margin-bottom: 6px;
}

.hero-headline {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--on-navy);
  line-height: 1.25;
  margin-bottom: 8px;
}

.hero-hours {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--on-navy-2);
}

.hero-major-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.hero-major-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--r-md);
  background: rgba(217, 48, 37, 0.22);
  border: 1px solid rgba(242, 139, 130, 0.42);
  color: #FFE7E5;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background 140ms ease;
}

.hero-major-banner:hover {
  background: rgba(217, 48, 37, 0.3);
  text-decoration: none;
}

.hero-major-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hero-major-left svg {
  color: #FF8980;
  flex-shrink: 0;
}

.hero-major-left span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-attention-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.hero-attention-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--on-navy-muted);
}

.hero-see-all {
  font-size: 13px;
  font-weight: 500;
  color: var(--on-navy);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.hero-see-all:hover {
  text-decoration: underline;
}

.attention-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attention-row {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) minmax(120px, 190px) 34px auto;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  background: var(--navy-2);
  border: 1px solid var(--navy-line);
  border-radius: var(--r-md);
  color: var(--on-navy);
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease;
}

.attention-row:hover {
  background: var(--navy-3);
  text-decoration: none;
}

.attention-row:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.attention-num {
  font-weight: 600;
  color: #8AB4F8;
  font-size: 13.5px;
}

.attention-title {
  font-weight: 500;
  color: var(--on-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attention-company {
  font-size: 13px;
  color: var(--on-navy-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attention-assignee {
  display: flex;
  align-items: center;
  justify-content: center;
}

.unassigned-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px dashed var(--on-navy-muted);
  color: var(--on-navy-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.hero-empty {
  padding: 14px 16px;
  background: var(--navy-2);
  border: 1px solid var(--navy-line);
  border-radius: var(--r-md);
  color: var(--on-navy-2);
  font-size: 14px;
}

/* ---------- Overview: KPI Strip ---------- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 22px;
}

.kpi-cell {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  transition: background 140ms ease;
}

.kpi-cell:last-child {
  border-right: none;
}

a.kpi-cell:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
  margin-bottom: auto;
  padding-bottom: 10px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.3px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Overview: Charts & Grid ---------- */
.overview-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 20px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.trend-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

/* Priority bars, Workload & Categories */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 124px 1fr 38px;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
  transition: background 140ms ease;
}

a.bar-row:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.bar-track {
  height: 10px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  overflow: hidden;
  display: flex;
}

.bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
}

.bar-count {
  text-align: right;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.workload-row {
  display: grid;
  grid-template-columns: minmax(140px, 185px) 1fr 36px;
  align-items: center;
  gap: 12px;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
  transition: background 140ms ease;
}

a.workload-row:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.workload-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.workload-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stack-track {
  height: 10px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  overflow: hidden;
  display: flex;
  gap: 1px;
}

.stack-seg {
  height: 100%;
}

.cat-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px 0;
}

.cat-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
}

.cat-name {
  color: var(--ink);
  font-weight: 500;
}

.cat-count {
  color: var(--muted);
  font-weight: 600;
}

.cat-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.cat-fill {
  height: 100%;
  background: var(--blue);
  border-radius: var(--r-pill);
}

/* ---------- Tables ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.ticket-num {
  font-weight: 600;
  color: var(--blue-deep);
}

/* ---------- Dialogs ---------- */
dialog.dialog {
  width: 100%;
  max-width: 580px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow-pop);
}

dialog.dialog::backdrop {
  background: rgba(9, 22, 48, 0.45);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.dialog-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(85vh - 130px);
  overflow-y: auto;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--line);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(85vh - 130px);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--line);
}

.seg-toggle {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  gap: 2px;
}

.filter-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  pointer-events: none;
}

.input-sm,
.select-sm {
  height: 32px;
  font-size: 13px;
}

.pill-muted {
  background: var(--slate-tint);
  color: var(--muted);
}

.pill-blue {
  background: var(--blue-tint);
  color: var(--blue-deep);
}

.board-inline-name-input:hover {
  border-color: var(--line-strong) !important;
  background: var(--surface-2) !important;
}

.board-inline-name-input:focus {
  outline: none;
  border-color: var(--blue) !important;
  background: var(--surface) !important;
  box-shadow: var(--focus);
}

/* ---------- Empty States ---------- */
.empty-state {
  padding: 40px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.empty-text {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
}

.toast.is-error {
  background: var(--red-deep);
  color: #FFFFFF;
}

/* ---------- Phase 2: Tickets List, Board & New Ticket Dialog ---------- */
.page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.seg-group {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  gap: 2px;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.seg-btn:hover {
  color: var(--ink);
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--line);
}

.queue-tabs-scroller {
  position: relative;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.queue-tabs-scroller::before,
.queue-tabs-scroller::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 1px;
  width: 36px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 150ms ease;
}

.queue-tabs-scroller::before {
  left: 0;
  background: linear-gradient(to right, var(--bg) 15%, rgba(248, 250, 252, 0));
}

.queue-tabs-scroller::after {
  right: 0;
  background: linear-gradient(to left, var(--bg) 15%, rgba(248, 250, 252, 0));
}

.queue-tabs-scroller.has-scroll-left::before {
  opacity: 1;
}

.queue-tabs-scroller.has-scroll-right::after {
  opacity: 1;
}

.queue-tabs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  padding-bottom: 2px;
  padding-right: 12px;
}

.queue-tab {
  flex: 0 0 auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease;
}

.queue-tab > span {
  flex-shrink: 0;
  white-space: nowrap;
}

.queue-tab:hover {
  color: var(--ink);
}

.queue-tab.is-active {
  color: var(--blue-deep);
  font-weight: 600;
  border-bottom-color: var(--blue);
}

.queue-count {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.queue-tab.is-active .queue-count {
  background: var(--blue-tint);
  color: var(--blue-deep);
}

.queue-count.is-alert {
  background: var(--red-tint);
  color: var(--red-deep);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.filter-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 180px;
  min-width: 170px;
}

.filter-search .search-icon {
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
}

.filter-search .input {
  padding-left: 34px;
}

.filter-select {
  width: auto;
  min-width: 136px;
  flex: 0 1 auto;
}

.filter-sort-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-sort-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.filter-clear {
  border: none;
  background: none;
  color: var(--blue-deep);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.filter-clear:hover {
  background: var(--blue-tint);
}

/* Ticket table rows */
tr.ticket-row {
  cursor: pointer;
  transition: background 120ms ease;
}

tr.ticket-row:focus-visible {
  outline: none;
  background: var(--panel-blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.ticket-num-cell {
  white-space: nowrap;
}

.ticket-num-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.major-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--red-tint);
  color: var(--red-deep);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.ticket-cell-title {
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
}

.ticket-cell-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

.vip-star {
  display: inline-flex;
  align-items: center;
  color: var(--amber);
}

.vip-star svg {
  fill: currentColor;
}

.assign-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.assign-info {
  min-width: 0;
}

.assign-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.assign-unassigned {
  font-size: 13.5px;
  color: var(--muted);
}

.assign-group {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.updated-cell {
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

/* Customer Tickets Groups (monday-style) */
.ticket-groups-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.tg-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--tg-color, var(--blue));
  border-radius: var(--r-lg);
  overflow: visible;
  min-width: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.tg-section.is-drag-over {
  background: var(--panel-blue);
  box-shadow: 0 0 0 2px var(--blue);
}

.tg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  border-top-right-radius: var(--r-lg);
  flex-wrap: wrap;
}

.tg-section.is-collapsed .tg-head {
  border-bottom: none;
  border-bottom-right-radius: var(--r-lg);
}

.tg-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.tg-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease;
}

.tg-collapse-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.tg-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

.tg-name-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 6px;
  margin-left: -4px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.tg-name-btn:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.tg-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.tg-head-actions,
.tg-head-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.tg-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.tg-color-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.tg-color-swatch:hover {
  transform: scale(1.1);
}

.tg-color-swatch.is-selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--surface);
}

.tg-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.tg-empty {
  padding: 16px 18px;
  font-size: 13.5px;
  color: var(--muted);
}

.tg-show-more-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--muted);
  border-bottom-right-radius: var(--r-lg);
}

.tg-add-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

tr.ticket-row.is-dragging {
  opacity: 0.45;
}

.internal-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: rgba(126, 87, 194, 0.14);
  color: #5E35B1;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

html[data-theme="dark"] .internal-chip {
  background: rgba(179, 157, 219, 0.18);
  color: #D1C4E9;
}

.row-group-move-select {
  height: 28px;
  padding: 0 26px 0 8px;
  font-size: 12.5px;
  min-width: 124px;
  width: auto;
}

/* Board view */
.board-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 10px;
}

.board-col {
  flex: 1 0 250px;
  min-width: 250px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-top: 4px solid var(--tg-color, var(--blue));
  border-radius: var(--r-lg);
  padding: 12px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 140ms ease, background 140ms ease;
}

.board-col.is-collapsed {
  flex: 0 0 210px;
  min-width: 210px;
  min-height: auto;
}

.board-col.board-col-add {
  flex: 0 0 200px;
  min-width: 200px;
  min-height: auto;
  border: 1px dashed var(--line-strong);
  background: transparent;
  justify-content: center;
  align-items: stretch;
}

.board-add-group-btn {
  width: 100%;
  justify-content: center;
}

.board-col.is-drag-over {
  border-color: var(--blue);
  background: var(--panel-blue);
}

.board-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  cursor: pointer;
}

.board-col-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0;
}

.board-col-title-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.board-col-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-col-collapsed-note {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 4px 2px;
  cursor: pointer;
}

.board-show-more-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.board-col-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.board-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: grab;
  transition: border-color 140ms ease;
}

.board-card.is-no-drag {
  cursor: default;
}

.board-card:hover {
  border-color: var(--line-strong);
}

.board-card.is-dragging {
  opacity: 0.5;
}

.board-card-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.board-card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.board-card-head-row .ticket-num {
  white-space: nowrap;
  flex-shrink: 0;
}

.board-card-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.board-card-top-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.board-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.38;
  text-decoration: none;
}

.board-card-title:hover {
  color: var(--blue-deep);
  text-decoration: none;
}

.board-card-company {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}

.unassigned-circle.is-light {
  border-color: var(--line-strong);
  color: var(--muted);
  width: 24px;
  height: 24px;
}

.card-move-wrap {
  position: relative;
  flex-shrink: 0;
}

.card-move-btn {
  height: 26px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.card-move-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.card-move-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 160px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  padding: 4px;
  z-index: 250;
}

.card-move-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.card-move-opt:hover {
  background: var(--surface-2);
}

/* Dialog forms (New ticket, Hold, Resolve) */
dialog.dialog.dialog-lg {
  max-width: 660px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.field-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.field-head-row .field-label {
  margin-bottom: 0;
}

.group-auto-badge {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--blue-deep);
  background: var(--blue-tint);
  padding: 1px 8px;
  border-radius: var(--r-pill);
}

.priority-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.priority-preview-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.new-caller-box {
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Ticket Detail View (Phase 3) ---------- */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 14px;
}

.detail-back:hover {
  color: var(--ink);
  text-decoration: none;
}

.detail-closed-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--slate-tint);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.detail-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.detail-head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-head-left {
  flex: 1;
  min-width: 240px;
}

.detail-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.detail-title-wrap {
  margin-top: 2px;
}

.detail-title-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.35px;
  line-height: 1.25;
  color: var(--ink);
  margin: 0;
  padding: 3px 6px;
  margin-left: -6px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  cursor: pointer;
}

.detail-title-display:hover:not(.is-readonly) {
  background: var(--surface-2);
  border-color: var(--line);
}

.detail-title-display.is-readonly {
  cursor: default;
}

.detail-title-edit-hint {
  color: var(--faint);
  opacity: 0;
  transition: opacity 150ms ease;
  flex-shrink: 0;
}

.detail-title-display:hover .detail-title-edit-hint {
  opacity: 1;
}

.detail-title-input {
  width: 100%;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--blue);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  box-shadow: var(--focus);
  outline: none;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

a.detail-meta-item {
  color: var(--blue-deep);
  font-weight: 500;
}

/* SLA Card & Two Meters */
.sla-meters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.sla-meter {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sla-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.sla-meter-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.sla-meter-status {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.sla-meter-status.is-on_track,
.sla-meter-status.is-met {
  color: var(--green-deep);
}

.sla-meter-status.is-at_risk {
  color: var(--amber-deep);
}

.sla-meter-status.is-breached,
.sla-meter-status.is-missed {
  color: var(--red-deep);
}

.sla-meter-status.is-paused {
  color: var(--muted);
}

.sla-meter-track {
  height: 8px;
  background: var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.sla-meter-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 200ms ease;
}

.sla-meter-fill.is-on_track,
.sla-meter-fill.is-met {
  background: var(--green);
}

.sla-meter-fill.is-at_risk {
  background: var(--amber);
}

.sla-meter-fill.is-breached,
.sla-meter-fill.is-missed {
  background: var(--red);
}

.sla-meter-fill.is-paused {
  background: var(--muted);
}

.sla-meter-sub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* Action Bar */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.action-bar-left,
.action-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Radio list in dialogs */
.radio-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.radio-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.radio-item:hover {
  background: var(--surface-2);
}

.radio-item input[type="radio"] {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
  margin: 0;
}

/* Description Card */
.desc-body {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}

.desc-empty {
  color: var(--muted);
  font-style: italic;
}

.desc-edit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* Composer */
.composer-card {
  padding: 0;
  overflow: hidden;
}

.composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.composer-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.composer-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.composer-tab:hover {
  color: var(--ink);
  background: var(--surface);
}

.composer-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
  font-weight: 600;
}

.composer-tab.is-note-tab.is-active {
  background: var(--note);
  color: var(--amber-deep);
  border-color: var(--note-line);
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.composer-note-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--amber-deep);
}

.composer-body {
  padding: 16px;
  background: var(--surface);
  transition: background 140ms ease;
}

.composer-body.is-note {
  background: var(--note);
}

.composer-textarea {
  width: 100%;
  min-height: 108px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.composer-body.is-note .composer-textarea {
  border-color: var(--note-line);
}

.composer-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus);
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.composer-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.composer-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  margin: 0;
}

.composer-foot-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.composer-shortcut-hint {
  font-size: 12px;
  color: var(--muted);
}

/* Activity Timeline & Filter Chips */
.activity-filter-chips {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  height: 28px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.filter-chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.filter-chip.is-active {
  background: var(--blue-tint);
  color: var(--blue-deep);
  border-color: transparent;
  font-weight: 600;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.activity-item.is-customer {
  background: var(--surface);
  border-color: var(--line);
}

.activity-item.is-agent {
  background: var(--panel-blue);
  border-color: var(--line);
}

.activity-item.is-note {
  background: var(--note);
  border-color: var(--note-line);
}

.activity-item.is-resolution {
  background: var(--panel-green);
  border-color: var(--line);
}

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
}

.activity-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--ink);
  flex-wrap: wrap;
}

.activity-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.activity-role-chip.is-internal {
  background: var(--amber-tint);
  border-color: var(--note-line);
  color: var(--amber-deep);
}

.activity-role-chip.is-resolution {
  background: var(--green-tint);
  border-color: transparent;
  color: var(--green-deep);
}

.activity-role-chip.is-automation {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.activity-time {
  color: var(--muted);
  font-size: 12.5px;
  flex-shrink: 0;
}

.activity-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.activity-compact-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--muted);
  border-radius: var(--r-sm);
}

.activity-compact-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.activity-compact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  flex-shrink: 0;
}

.activity-compact-text strong {
  color: var(--ink);
  font-weight: 600;
}

/* Side Panel (Details) */
.side-details-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.side-readonly-val {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink);
}

/* Resolution Panel & Related Tickets Panel */
.resolution-panel {
  background: var(--panel-green);
  border-color: var(--line);
}

.resolution-code-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-deep);
  margin-bottom: 6px;
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.related-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  text-decoration: none;
}

.related-item:hover {
  border-color: var(--line-strong);
  text-decoration: none;
}

.related-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.related-item-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Phase 4: Customers & Settings ---------- */
.company-row-link {
  display: inline-block;
  text-decoration: none;
  color: inherit;
}
.company-row-link:hover {
  text-decoration: none;
}
.company-row-link:hover .cell-title {
  color: var(--blue-deep);
  text-decoration: underline;
}

.company-notes-box {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auto-rules-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auto-rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 140ms ease, background 140ms ease;
}

.auto-rule-row:hover {
  border-color: var(--line-strong);
}

.auto-rule-row.is-disabled-rule {
  opacity: 0.72;
  background: var(--surface-2);
}

.auto-rule-row.is-dragging {
  opacity: 0.45;
}

.auto-rule-row.is-drag-over {
  border-color: var(--blue);
  background: var(--blue-tint);
}

.auto-rule-handle-col {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.auto-drag-grip {
  color: var(--faint);
  cursor: grab;
  font-size: 14px;
  letter-spacing: -1px;
  user-select: none;
}

.auto-order-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auto-order-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}

.auto-order-btn:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--ink);
}

.auto-order-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.auto-rule-main {
  flex: 1;
  min-width: 0;
}

.auto-rule-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.auto-rule-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.auto-rule-summary {
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 4px;
}

.auto-rule-meta {
  font-size: 12px;
  color: var(--muted);
}

.auto-rule-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Toggle Switch */
.switch-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 38px;
  height: 22px;
  background: var(--line-strong);
  border-radius: var(--r-pill);
  position: relative;
  transition: background 150ms ease;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(9, 22, 48, 0.25);
  transition: transform 150ms ease;
}

.switch-input:checked + .switch-track {
  background: var(--blue);
}

.switch-input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch-input:focus-visible + .switch-track {
  box-shadow: var(--focus);
}

.switch-input:disabled + .switch-track {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Automation Editor Sections */
.auto-section-box {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.auto-section-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.auto-rows-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auto-editor-row {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.auto-cond-grid {
  display: grid;
  grid-template-columns: 185px 150px 1fr auto;
  gap: 8px;
  align-items: start;
}

.auto-action-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cond-multiselect {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cond-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.cond-chip.is-checked {
  background: var(--blue-tint);
  border-color: var(--blue);
  color: var(--blue-deep);
  font-weight: 500;
}

.cond-chip input {
  margin: 0;
}

.placeholder-bar {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.placeholder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.placeholder-chip {
  padding: 4px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--blue-deep);
  font-size: 12px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.placeholder-chip:hover {
  background: var(--blue-tint);
  border-color: var(--blue);
}

/* SLA & Hours Tab */
.workday-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workday-chip {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.workday-chip.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #FFFFFF;
  font-weight: 600;
}

.workday-chip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.holiday-readonly-list,
.holiday-custom-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.holiday-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13.5px;
}

/* Categories Tree */
.cat-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cat-tree-group {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.cat-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.cat-top-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.cat-top-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cat-sub-list {
  display: flex;
  flex-direction: column;
}

.cat-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 10px 28px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.cat-sub-row:last-child {
  border-bottom: none;
}

.cat-sub-empty {
  padding: 10px 16px 10px 28px;
  font-size: 13px;
  color: var(--muted);
}

/* Reply Templates List */
.templates-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.template-main {
  flex: 1;
  min-width: 0;
}

.template-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.template-body {
  font-size: 13.5px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.45;
}

.template-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- Responsive Rules ---------- */
@media (max-width: 1100px) {
  .kpi-strip {
    grid-template-columns: repeat(3, 1fr);
  }
  .kpi-cell:nth-child(3) {
    border-right: none;
  }
  .kpi-cell:nth-child(1),
  .kpi-cell:nth-child(2),
  .kpi-cell:nth-child(3) {
    border-bottom: 1px solid var(--line);
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }
  .nav.is-open {
    transform: translateX(0);
  }
  .menu-btn,
  .icon-btn.menu-btn {
    display: inline-flex;
  }
  .topbar {
    padding: 0 16px;
  }
  .view {
    padding: 20px 16px;
  }
  .attention-row {
    grid-template-columns: 90px minmax(0, 1fr) auto;
  }
  .attention-company,
  .attention-assignee {
    display: none;
  }
}

.tf-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.nav button:focus-visible,
.nav a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #8AB4F8;
}

@media (max-width: 640px) {
  .tf-add-form {
    grid-template-columns: 1fr;
  }
  .board-template-grid {
    grid-template-columns: 1fr !important;
  }
  .status-label-row {
    flex-wrap: wrap;
  }
  .topbar {
    gap: 8px;
    padding: 0 12px;
  }
  .btn-new-ticket .btn-label {
    display: none;
  }
  .btn-new-ticket {
    padding: 0 10px;
  }
  .agent-picker-name {
    display: none;
  }
  .agent-picker-btn {
    padding: 0 8px 0 5px;
  }
  .hero {
    padding: 20px 16px;
    border-radius: var(--r-lg);
  }
  .hero-headline {
    font-size: 22px;
  }
  .attention-row {
    grid-template-columns: 82px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 12px;
  }
  .attention-num {
    font-size: 12px;
  }
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-cell {
    padding: 14px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .kpi-cell:nth-child(2n) {
    border-right: none;
  }
  .kpi-cell:nth-child(5),
  .kpi-cell:nth-child(6) {
    border-bottom: none;
  }
  .bar-row {
    grid-template-columns: 112px 1fr 30px;
    gap: 8px;
  }
  .workload-row {
    grid-template-columns: 130px 1fr 28px;
    gap: 8px;
  }
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .board-grid {
    flex-direction: column;
    align-items: stretch;
  }
  .board-col,
  .board-col.is-collapsed,
  .board-col.board-col-add {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }
  .sla-meters-grid,
  .side-field-row,
  .auto-cond-grid {
    grid-template-columns: 1fr;
  }
  .auto-rule-row,
  .template-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

.stale-server-banner {
  background: var(--amber-tint);
  color: var(--amber-deep);
  border-bottom: 1px solid var(--amber);
  padding: 10px 24px;
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
}
.stale-server-banner[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Inline email images rewritten to V4 signed Cloud Storage URLs */
.email-inline-img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin: 8px 0;
  display: block;
}
