/* ================================
   Desk – Fresh Layout CSS
   ================================ */

   .panel-header {
  padding: 10px 12px;
  margin: -12px -12px 12px;
  background: rgba(46, 52, 64, 0.06);
  border-bottom: 1px solid var(--line);
}

/* ---- Reset / Base ---- */

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans, system-ui, sans-serif);
  background:
    radial-gradient(1000px 500px at 20% 0%, rgba(94, 129, 172, 0.14), transparent),
    radial-gradient(800px 600px at 80% 10%, rgba(0, 210, 136, 0.10), transparent),
    var(--bg);
  color: var(--text);
}

/* ---- Root ---- */

#desk-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ================================
   Header / Topbar
   ================================ */

.topbar {
  height: 56px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-bottom: 1px solid var(--line);

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 14px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-right {
  position: relative;
}

/* Brand */

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(0, 210, 136, 0.14);
  border: 1px solid rgba(0, 210, 136, 0.35);
  font-weight: 900;
  color: var(--brand);
}

.brand-text {
  font-size: 14px;
  letter-spacing: 0.2px;
}

/* Agent button */

.agent-btn {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
}

.agent-initials {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(94, 129, 172, 0.18);
  border: 1px solid rgba(94, 129, 172, 0.35);
  color: var(--text);

  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}

.agent-btn:hover .agent-initials {
  background: rgba(94, 129, 172, 0.28);
}

.agent-btn:active .agent-initials {
  transform: scale(0.96);
}

.agent-btn:focus-visible {
  outline: none;
}

.agent-btn:focus-visible .agent-initials {
  border-color: rgba(94, 129, 172, 0.55);
  box-shadow: 0 0 0 2px rgba(94, 129, 172, 0.18);
}

/* ================================
   Main Layout
   ================================ */

#desk-layout {
  flex: 1 1 auto;
  min-height: 0;

  display: grid;
  grid-template-columns: 330px 360px 1fr 360px;
  grid-template-rows: 1fr;
  gap: 12px;
  padding: 12px;
}

/* ================================
   Panels (shared)
   ================================ */

.hc-surface,
#desk-layout > section {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  min-height: 0;

  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hc-surface--alt {
  background: var(--panel);
}

.hc-elevated {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hc-divider {
  width: 100%;
  height: 1px;
  background: var(--line);
}

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

.hc-pill,
.hc-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line);
  background: rgba(46, 52, 64, 0.06);
  color: var(--muted);
}

/* ================================
   Individual Panels
   ================================ */

/* Hermes Assist */
#hermes-panel,
#queue-panel,
#chat-panel,
#customer-panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
}

/* Give Hermes + Customer the same inner padding as Queue */
#hermes-panel,
#customer-panel {
  padding: 12px;
}

/* ================================
   Scroll Areas (future-proof)
   ================================ */

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

/* ================================
   Utilities
   ================================ */

.hidden {
  display: none !important;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(46, 52, 64, 0.02);
}

/* ================================
   Shared panel header (flush style)
   Matches queue-header + chat-header
   ================================ */

.panel-header--flush {
  padding: 10px 12px;
  margin: -12px -12px 12px; /* stretch to panel edges like Queue/Chat */
  background: rgba(46, 52, 64, 0.06);
  border-bottom: 1px solid var(--line);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  /* same "real header" min height vibe as chat */
  min-height: 52px;
}

.panel-header-title {
  font-weight: 850;
  letter-spacing: 0.2px;
  font-size: 14px;
  color: var(--text);
  min-width: 0;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-header-subtitle {
  font-size: 12px;
  color: var(--muted);
  min-width: 0;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.panel-header-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* =========================
   Customer Tabs
========================= */

.customer-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 0 8px;
  margin-top: -4px;
  flex-wrap: wrap;
}

.customer-tab {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 650;
  border: 1px solid var(--line);
  background: rgba(46, 52, 64, 0.03);
  color: var(--text);
  cursor: pointer;
}

.customer-tab:hover { filter: brightness(1.03); }

.customer-tab.is-active {
  background: rgba(94, 129, 172, 0.18);
  border-color: rgba(94, 129, 172, 0.42);
}

.customer-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.customer-tab:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

.customer-tickets-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
}

.customer-tickets-create {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon {
  width: 16px;
  height: 16px;
  display: block;
  color: currentColor;
  stroke-width: 2;
}

.icon use,
.icon path {
  stroke: currentColor;
  fill: none;
}

.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  padding: 10px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 40;
  display: grid;
  gap: 10px;
}

#agent-menu[aria-hidden="true"] {
  display: none;
}

.agent-menu-header {
  display: grid;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.agent-menu-name {
  font-weight: 850;
}

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

.agent-menu-section {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.agent-menu-section + .agent-menu-section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.agent-menu-section-title {
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
}

.menu-item {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(46, 52, 64, 0.03);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.menu-item:hover {
  background: rgba(46, 52, 64, 0.06);
  border-color: rgba(46, 52, 64, 0.10);
}

.menu-item:focus-visible {
  outline: none;
  background: rgba(46, 52, 64, 0.08);
  border-color: rgba(94, 129, 172, 0.45);
}

.menu-item--danger {
  color: var(--danger);
}

.menu-item--danger:hover {
  background: rgba(191, 97, 106, 0.14);
  border-color: rgba(191, 97, 106, 0.28);
}

.menu-item--danger:focus-visible {
  border-color: rgba(191, 97, 106, 0.55);
}

/* Agent menu toggles */
.menu-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;

  height: 36px;
  padding: 0 10px;
  border-radius: 10px;

  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;

  transition: filter 120ms ease, transform 120ms ease;
}

.menu-toggle:hover { filter: brightness(1.05); }
.menu-toggle:active { transform: translateY(1px); }

.menu-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Disabled status toggle (clocked out) */
.menu-toggle:disabled,
.menu-toggle[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  filter: none;
  transform: none;
}

/* Clock toggle can be neutral; optional accent when pressed */
.menu-toggle--clock[aria-pressed="true"] {
  border-color: var(--accent);
}

/* Status colors while clocked in */
.menu-toggle--status.is-active {
  background: rgba(163, 190, 140, 0.12);
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  border-color: rgba(163, 190, 140, 0.35);
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
}

.menu-toggle--status.is-away {
  background: rgba(235, 203, 139, 0.18);
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  border-color: rgba(235, 203, 139, 0.45);
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
}

.btn {
  background: var(--control);
  border: 1px solid rgba(46, 52, 64, 0.14);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 650;
}

.btn:hover { filter: brightness(1.03); }

.btn.ghost {
  background: rgba(46, 52, 64, 0.03);
  border-color: var(--line);
}

.btn.brand {
  background: rgba(0, 210, 136, 0.18);
  border-color: rgba(0, 210, 136, 0.40);
}

.btn.danger {
  background: rgba(191, 97, 106, 0.20);
  border-color: rgba(191, 97, 106, 0.38);
}

.btn.small { padding: 7px 10px; font-size: 12px; border-radius: 10px; }
.btn.tiny { padding: 5px 8px; font-size: 11px; border-radius: 9px; }

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

@media (max-width: 1100px) {
  #desk-layout {
    grid-template-columns: 200px 320px 1fr 320px;
    gap: 10px;
    padding: 10px;
  }
}

@media (max-width: 900px) {
  #desk-layout {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto 1fr;
  }

  #customer-panel {
    display: none;
  }
}







/* ================================
   Chat Panel
   ================================ */

#chat-panel {
  background: var(--bg);
}

.chat-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

#chat-close-btn {
  flex-shrink: 0;
}

/* Header (match queue panel) */
.chat-header {
  flex-shrink: 0;
  padding: 10px 12px;
  margin: -12px -12px 12px; /* stretch to panel edges */
  background: rgba(46, 52, 64, 0.06);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 52px;
}


.chat-title {
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}




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

/* Transcript */
.chat-transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Bubble rows */
.msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.msg-row--inbound { justify-content: flex-start; }
.msg-row--outbound { justify-content: flex-end; }
.msg-row--system { justify-content: center; }

/* Bubbles */
.msg-bubble {
  max-width: min(680px, 78%);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-bubble--inbound {
  border-top-left-radius: 8px;
}

/* --- Bubble color overrides --- */
/* Agent bubble (outbound) */
.msg-bubble--outbound {
  background: #A3B4D4;
  border-color: color-mix(in srgb, #A3B4D4 70%, rgba(0,0,0,0.2));
  color: #0f172a; /* dark ink for contrast */
}

/* Customer bubble (inbound) */
.msg-bubble--inbound {
  background: #DBE5F8;
  border-color: color-mix(in srgb, #B0BCD2 70%, rgba(0,0,0,0.2));
  color: #0f172a; /* dark ink for contrast */
}


.msg-bubble--system {
  max-width: 90%;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 6px 10px;
}

/* Meta (time, sender) */
.msg-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Composer */
.chat-composer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 10px;
}

/* Fallback composer styles (if you didn't copy Resolve's exact composer) */
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.composer-input {
  flex: 1;
  min-height: 38px;
  max-height: 140px;
  resize: none;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.35;
}

.composer-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.composer-send {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

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

/* Resolve-style composer overrides */
.composer-box {
  position: relative;
  border: 1px solid rgba(46, 52, 64, 0.14);
  background: rgba(46, 52, 64, 0.04);
  border-radius: 18px;
  padding: 10px 44px 10px 12px;
}

.composer-box .composer-input {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.35;
  min-height: 22px;
  max-height: 180px;
  overflow: hidden;
}

.composer-box .composer-send {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(46, 52, 64, 0.06);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.composer-box .composer-send:hover {
  background: rgba(46, 52, 64, 0.09);
  border-color: rgba(46, 52, 64, 0.12);
  color: var(--text);
}

.composer-box .composer-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.composer-box .composer-send:disabled:hover {
  background: rgba(46, 52, 64, 0.06);
  border-color: transparent;
  color: var(--muted);
}

.composer-box .composer-send.armed {
  background: rgba(0, 210, 136, 0.16);
  border-color: rgba(0, 210, 136, 0.22);
  color: var(--text);
}

.composer-box .composer-send.armed:hover {
  background: rgba(0, 210, 136, 0.22);
  border-color: rgba(0, 210, 136, 0.30);
}


/* ================================
   Queue Panel
   ================================ */

#queue-panel {
  padding: 12px;
}

/* Header looks like a real header */
.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 10px 12px;
  margin: -12px -12px 12px; /* stretch to panel edges */
  background: rgba(46, 52, 64, 0.06);
  border-bottom: 1px solid var(--line);
}

.queue-header-title {
  font-weight: 850;
  letter-spacing: 0.2px;
}

.queue-refresh-indicator {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* List spacing */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Each chat is a card with an outline */
.queue-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 10px;
  background: rgba(46, 52, 64, 0.03);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
}

.queue-item:hover {
  background: rgba(46, 52, 64, 0.06);
  border-color: rgba(94, 129, 172, 0.45);
}

.queue-item:active {
  transform: scale(0.99);
}

/* Selected state */
.queue-item.selected {
  border-color: rgba(0, 210, 136, 0.55);
  box-shadow: 0 0 0 2px rgba(0, 210, 136, 0.12);
}

/* Title + meta */
.queue-item-title {
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 4px;
}

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

.queue-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.queue-item-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-item-preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.queue-item-timer {
  flex-shrink: 0;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(46, 52, 64, 0.04);
  color: var(--text);
  white-space: nowrap;
}

/* Timer states */
.queue-item-timer.queue-timer--ok { border-color: rgba(0, 210, 136, 0.28); background: rgba(0, 210, 136, 0.10); }
.queue-item-timer.queue-timer--warn { border-color: rgba(235, 203, 139, 0.30); background: rgba(235, 203, 139, 0.12); }
.queue-item-timer.queue-timer--danger { border-color: rgba(191, 97, 106, 0.35); background: rgba(191, 97, 106, 0.12); }
.queue-item-timer.queue-timer--idle { opacity: 0.85; }

/* =========================
   ACW Popover
========================= */

.acw-popover-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(46, 52, 64, 0.38);

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 16px;
}

.acw-popover {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.acw-popover-header {
  padding: 12px 14px;
  background: rgba(46, 52, 64, 0.06);
  border-bottom: 1px solid var(--line);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.acw-popover-title {
  font-weight: 850;
  font-size: 14px;
  color: var(--text);
}

.acw-popover-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.acw-popover-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.acw-popover-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.acw-popover-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--line);

  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.acw-error {
  font-size: 12px;
  color: var(--danger);
  background: rgba(191, 97, 106, 0.10);
  border: 1px solid rgba(191, 97, 106, 0.25);
  padding: 8px 10px;
  border-radius: 10px;
}
