/* Archive / Monitoring app — layered on top of site.css + dashboard.css */

/* Make the HTML `hidden` attribute actually hide — even on .btn/.table-filter
   elements whose class sets `display` (which otherwise overrides UA `hidden`). */
[hidden] { display: none !important; }

/* KPI tiles */
.arc-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.arc-tile { background: #fff; border: 1px solid #e6e8ec; border-radius: 12px; padding: 16px; text-align: center; }
.arc-tile-num { font-size: 1.6rem; font-weight: 800; color: #111; }
.arc-tile-label { font-size: .85rem; color: #6b7280; margin-top: 4px; }

/* Filter bar */
.arc-filters { background: #fff; border: 1px solid #e6e8ec; border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.arc-seg { display: inline-flex; border: 1px solid #d8dbe0; border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.arc-seg-btn { border: 0; background: #f6f7f9; padding: 8px 16px; cursor: pointer; font: inherit; color: #374151; }
.arc-seg-btn.active { background: #2563eb; color: #fff; }

.arc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.arc-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #d8dbe0; background: #fff;
    border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: .9rem; color: #374151; }
.arc-chip.active { background: #111827; color: #fff; border-color: #111827; }
.arc-chip.active .cm-dot { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }

.arc-filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.arc-date { font-size: .85rem; color: #6b7280; display: inline-flex; align-items: center; gap: 4px; }
.arc-date input { border: 1px solid #d8dbe0; border-radius: 8px; padding: 6px 8px; font: inherit; }
.arc-filter-row .table-search { flex: 1; min-width: 180px; }

/* Table extras */
.arc-who small { display: block; color: #9aa0a8; font-size: .78rem; }
.arc-content { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-tag { background: #eef2ff; color: #4338ca; border-radius: 6px; padding: 2px 8px; font-size: .8rem; }
.arc-dir { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.arc-dir.in { color: #059669; }
.arc-dir.out { color: #2563eb; }
#arcTable tbody tr { cursor: pointer; }
#arcTable tbody tr:hover { background: #f8fafc; }
.loading-row.err { color: #dc2626; }

/* Conversation drawer */
/* Non-modal LEFT-side details panel: the page behind stays fully interactive
   (no grey backdrop, container is click-through), and the chat docks on the
   physical LEFT. The main content shifts right while it's open (see below). */
.arc-drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.arc-drawer-backdrop { display: none; }
.arc-drawer-panel { position: fixed; top: 0; bottom: 0; left: 0; right: auto; width: min(440px, 94vw);
    pointer-events: auto;
    background: #f0f2f5; display: flex; flex-direction: column; box-shadow: 2px 0 24px rgba(0,0,0,.18); }
/* When the panel is open, push the page content to the right so nothing hides
   behind it (only on wide screens; on phones the panel overlays). */
@media (min-width: 921px) {
    body.arc-drawer-open .hub-wrap { padding-left: min(470px, 96vw); max-width: none; margin: 0 24px 0 0; transition: padding-left .15s ease; }
}
.arc-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; background: #fff; border-bottom: 1px solid #e6e8ec; }
.arc-drawer-head small { display: block; color: #9aa0a8; font-size: .8rem; }
.arc-drawer-close { border: 0; background: transparent; font-size: 1.2rem; cursor: pointer; color: #6b7280; }
.arc-thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }

.bubble { max-width: 78%; padding: 8px 12px; border-radius: 12px; font-size: .92rem; line-height: 1.4; }
.bubble.in  { align-self: flex-start; background: #fff; border: 1px solid #e6e8ec; border-bottom-inline-start-radius: 4px; }
.bubble.out { align-self: flex-end; background: #d9fdd3; border-bottom-inline-end-radius: 4px; }
.bubble-text { white-space: pre-wrap; word-break: break-word; }
.bubble-meta { font-size: .7rem; color: #6b7280; margin-top: 4px; }

/* Reply composer in the conversation drawer */
.arc-reply { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px 12px 4px;
    background: #fff; border-top: 1px solid #e6e8ec; }
.arc-reply textarea { flex: 1; resize: none; border: 1px solid #d8dbe0; border-radius: 10px;
    padding: 8px 10px; font: inherit; font-size: .92rem; max-height: 120px; }
.arc-reply textarea:disabled { background: #f4f6fa; color: #9aa0a8; }
.arc-reply .btn { white-space: nowrap; }
.arc-reply-ch { border: 1px solid #d8dbe0; border-radius: 10px; padding: 8px 6px; font: inherit; font-size: .85rem; background: #fff; }
.arc-reply-to { flex: 1 0 100%; border: 1px solid #d8dbe0; border-radius: 10px; padding: 8px 10px; font: inherit; font-size: .9rem; }
.arc-reply-hint { padding: 2px 14px 10px; font-size: .76rem; color: #6b7280; background: #fff; min-height: 16px; }

@media (max-width: 720px) {
    .arc-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* Per-customer stats card */
.cust-stats { margin-bottom: 16px; }
.cs-card { background: #fff; border: 1px solid #e6e8ec; border-radius: 12px; padding: 16px; }
.cs-head { font-weight: 700; font-size: 1rem; margin-bottom: 12px; }
.cs-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.cs-kpi { background: #f4f6fa; border-radius: 10px; padding: 10px; text-align: center; }
.cs-n { display: block; font-size: 1.5rem; font-weight: 800; color: #2f6df6; }
.cs-l { display: block; font-size: .78rem; color: #6b7280; margin-top: 2px; }
.cs-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.cs-table th, .cs-table td { text-align: right; padding: 7px 10px; border-top: 1px solid #eef1f5; }
.cs-table th { color: #6b7280; font-weight: 600; font-size: .78rem; }
.cs-meta { margin-top: 10px; font-size: .8rem; color: #6b7280; }
.cs-meta em { color: #9aa0a8; }
.cs-loading { padding: 16px; text-align: center; color: #6b7280; }
.cs-merge { margin-top: 12px; padding-top: 12px; border-top: 1px dashed #e6e8ec;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cs-merge-q { font-size: .82rem; color: #6b7280; }
.cs-merge-sel { border: 1px solid #d8dbe0; border-radius: 8px; padding: 6px 8px; font: inherit; max-width: 320px; }
@media (max-width: 720px) { .cs-kpis { grid-template-columns: repeat(2, 1fr); } }
