/* Fixentra AI — staff workspace (agents, managers, administrators). TASD-UX-001-R1.
   Tokens and components come from assets/ui.css (built on the approved brand tokens). */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.page-agent { margin: 0; min-height: 100vh; font: 400 var(--fx-fs-md)/1.5 var(--fx-font); color: var(--fx-text); background: var(--fx-bg); }
a { color: var(--fx-link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { color: var(--fx-text); }
[hidden] { display: none !important; }

/* ---------- application shell ---------- */
.ag-app { display: flex; min-height: 100vh; background: linear-gradient(90deg, var(--fx-navy) 0 248px, transparent 248px); }
.ag-app.collapsed { background: linear-gradient(90deg, var(--fx-navy) 0 72px, transparent 72px); }
@media (max-width: 900px) { .ag-app, .ag-app.collapsed { background: none; } }
.ag-side {
  position: sticky; top: 0; z-index: 60; width: 248px; height: 100vh; flex: none; display: flex; flex-direction: column;
  background: var(--fx-navy); color: #d6def0; transition: width var(--fx-ease);
}
.ag-side :focus-visible { outline-color: var(--fx-cyan); }
.ag-side-brand { display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 12px 0 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.ag-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: #fff; text-decoration: none !important; }
.ag-brand-icon { width: 32px; height: 32px; border-radius: 8px; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16); }
.ag-brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.ag-brand-text strong { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -0.1px; white-space: nowrap; }
.ag-brand-text small { margin-top: 3px; font-size: 9.5px; font-weight: 600; letter-spacing: 1.6px; color: #9fb0d4; white-space: nowrap; }
.ag-collapse { flex: none; width: 30px; height: 30px; border: 0; border-radius: var(--fx-r-sm); background: transparent; color: #9fb0d4; cursor: pointer; display: grid; place-items: center; }
.ag-collapse:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.ag-collapse svg { width: 18px; height: 18px; transition: transform var(--fx-ease); }
.ag-nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.ag-nav-label { margin: 14px 10px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: #8e9fc4; }
.ag-nav-label:first-child { margin-top: 2px; }
.ag-nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--fx-r-md);
  color: #d6def0; font-weight: 500; text-decoration: none !important; white-space: nowrap;
}
.ag-nav a svg { width: 20px; height: 20px; flex: none; }
.ag-nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.ag-nav a[aria-current="page"] { background: rgba(37, 99, 255, 0.28); color: #fff; }
.ag-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--fx-cyan); }
.ag-side-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 12px; color: #9fb0d4; }
.ag-side-foot strong { display: block; color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* collapsed (desktop): icons only */
.ag-app.collapsed .ag-side { width: 72px; }
.ag-app.collapsed .ag-brand-text, .ag-app.collapsed .ag-nav a span, .ag-app.collapsed .ag-nav-label, .ag-app.collapsed .ag-side-foot { display: none; }
.ag-app.collapsed .ag-side-brand { flex-direction: column; justify-content: center; gap: 4px; height: auto; padding: 12px 0; }
.ag-app.collapsed .ag-brand { flex: none; }
.ag-app.collapsed .ag-collapse svg { transform: rotate(180deg); }
.ag-app.collapsed .ag-nav a { justify-content: center; padding: 0; }
.ag-app.collapsed .ag-nav { padding-top: 16px; }

.ag-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ag-top {
  position: sticky; top: 0; z-index: 50; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--fx-border);
}
.ag-menu-btn { display: none; }
.ag-search { flex: 1; max-width: 520px; }
.ag-top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.ag-org-chip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; border-radius: var(--fx-r-pill); background: var(--fx-surface-3); color: var(--fx-text-2); font-size: var(--fx-fs-sm); font-weight: 600; }
.ag-org-chip:empty { display: none; }
.ag-bell-btn { position: relative; }
.ag-bell-btn svg { width: 20px; height: 20px; }
.ag-bell-count { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--fx-danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.ag-notes { width: 380px; max-height: 70vh; overflow-y: auto; }
.ag-notes ul { list-style: none; margin: 0; padding: 0; }
.ag-notes li { display: flex; gap: 10px; padding: 9px 10px; border-radius: var(--fx-r-sm); font-size: var(--fx-fs-sm); }
.ag-notes li.unread { background: var(--fx-primary-soft); }
.ag-notes li .when { display: block; color: var(--fx-text-3); font-size: 11px; margin-top: 2px; }
.ag-notes li a { padding: 0; display: inline; color: var(--fx-link); font-weight: 500; }
.ag-notes .fx-link { font-size: 12px; white-space: nowrap; margin-left: auto; align-self: flex-start; }
.ag-account { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 4px; border: 1px solid transparent; border-radius: var(--fx-r-pill); background: none; cursor: pointer; }
.ag-account:hover { background: var(--fx-surface-3); }
.ag-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--fx-gradient); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.ag-account-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.ag-account-text span { font-weight: 600; font-size: var(--fx-fs-sm); white-space: nowrap; }
.ag-account-text small { font-size: 11px; color: var(--fx-text-3); white-space: nowrap; }
.ag-account > svg { width: 14px; height: 14px; color: var(--fx-text-3); }
.ag-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(11, 31, 75, 0.45); }

.ag-content { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px 28px 48px; outline: none; }
.ag-head { margin-bottom: 20px; }
.ag-head h1 { font-size: var(--fx-fs-2xl); }
.ag-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- shared blocks used by every staff page (also restyles the admin panes) ---------- */
.ag-muted { color: var(--fx-text-2); }
.ag-small { font-size: var(--fx-fs-xs); }
.ag-card { background: var(--fx-surface); border: 1px solid var(--fx-border); border-radius: var(--fx-r-lg); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--fx-shadow-sm); }
.ag-card > h2:first-child, .ag-card > .ag-card-title:first-child { margin: 0 0 14px; font-size: var(--fx-fs-lg); font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-card h3 { margin: 18px 0 8px; font-size: var(--fx-fs-md); font-weight: 600; }
.ag-card p { margin: 0 0 10px; }
.ag-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 14px; }
.ag-card-head h2 { margin: 0; font-size: var(--fx-fs-lg); font-weight: 600; }
.ag-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--fx-border-strong); border-radius: var(--fx-r-md); background: var(--fx-surface); color: var(--fx-text);
  font-weight: 600; font-size: var(--fx-fs-md); cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.ag-btn:hover { background: var(--fx-surface-2); border-color: var(--fx-text-3); }
.ag-btn.primary { background: var(--fx-primary); border-color: var(--fx-primary); color: #fff; }
.ag-btn.primary:hover { background: var(--fx-primary-hover); }
.ag-btn.ai { background: var(--fx-ai-bg); border-color: var(--fx-ai-border); color: var(--fx-ai); }
.ag-btn.danger { color: var(--fx-danger); border-color: var(--fx-danger-border); }
.ag-btn.danger:hover { background: var(--fx-danger-bg); }
.ag-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ag-link { border: 0; background: none; color: var(--fx-link); cursor: pointer; padding: 0 4px; font-size: var(--fx-fs-xs); font-weight: 600; }
.ag-link:hover { text-decoration: underline; }
.ag-row { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.ag-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.ag-form label { display: block; margin: 12px 0 5px; font-size: var(--fx-fs-sm); font-weight: 600; color: var(--fx-text); }
.ag-form input:not([type=checkbox]):not([type=radio]), .ag-form select, .ag-form textarea, .ag-table select, .ag-table input[type=number], .ag-table input[type=time], .ag-table input:not([type]) {
  width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--fx-border-strong); border-radius: var(--fx-r-md); background: var(--fx-surface); font-size: var(--fx-fs-md);
}
.ag-form label input, .ag-form label select { margin-top: 5px; }
.ag-form input:focus, .ag-form select:focus, .ag-form textarea:focus, .ag-table select:focus, .ag-table input:focus { border-color: var(--fx-primary); box-shadow: 0 0 0 3px rgba(37, 99, 255, 0.18); outline: none; }
.ag-form input:disabled, .ag-form select:disabled { background: var(--fx-surface-3); color: var(--fx-text-3); }
.ag-form textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.ag-form code { font-weight: 400; font-size: 11px; }
.ag-table input[type=number] { width: 130px; }
.ag-table input[type=time] { width: 120px; }
.ag-check { display: inline-block !important; font-weight: 400 !important; margin: 6px 16px 6px 0 !important; cursor: pointer; line-height: 1.45; }
.ag-check input { width: 16px !important; height: 16px; min-height: 0 !important; margin: 0 8px 0 0 !important; vertical-align: -3px; accent-color: var(--fx-primary); }
.ag-perms { display: flex; flex-wrap: wrap; margin: 6px 0; }
table.ag-table { width: 100%; border-collapse: collapse; background: var(--fx-surface); font-size: var(--fx-fs-md); }
.ag-table th, .ag-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--fx-border); vertical-align: middle; }
.ag-table thead th { background: var(--fx-surface-2); color: var(--fx-text-2); font-size: var(--fx-fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.ag-table tbody tr:last-child td { border-bottom: 0; }
.ag-card > table.ag-table, .ag-card > div > table.ag-table { border: 1px solid var(--fx-border); border-radius: var(--fx-r-md); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.ag-table td .ag-row { margin: 0; gap: 6px; }
.ag-table td .ag-btn { height: 30px; padding: 0 10px; font-size: var(--fx-fs-sm); }
.ag-matrix th, .ag-matrix td { text-align: center; font-size: var(--fx-fs-sm); }
.ag-matrix td:first-child, .ag-matrix th:first-child { text-align: left; min-width: 220px; }
.ag-warnrow td { background: #fff7f8; }
.ag-list { list-style: none; margin: 6px 0; padding: 0; }
.ag-list li { padding: 7px 0; border-bottom: 1px solid var(--fx-border); }
.ag-list li:last-child { border-bottom: 0; }
.ag-err { color: var(--fx-danger); margin: 8px 0 0; font-weight: 500; }
.ag-err:empty { display: none; }
.ag-ok { color: var(--fx-success); margin: 8px 0 0; font-weight: 500; }
.ag-ok:empty { display: none; }
.ag-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.ag-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ag-stat { background: var(--fx-surface); border: 1px solid var(--fx-border); border-radius: var(--fx-r-lg); padding: 14px 16px; }
.ag-stat b { display: block; font-size: 26px; line-height: 1.2; }
.ag-stat span { color: var(--fx-text-2); font-size: var(--fx-fs-xs); }
.ag-stat.warn { border-color: var(--fx-danger-border); background: #fff8f9; }
.ag-stat.warn b { color: var(--fx-danger); }
.ag-bell { display: none; }

/* ---------- dashboard ---------- */
.db-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.db-grid > * { margin: 0; }
.db-span-8 { grid-column: span 8; } .db-span-6 { grid-column: span 6; } .db-span-4 { grid-column: span 4; } .db-span-12 { grid-column: span 12; }
.db-kpis-2 { margin-top: 12px; }
.db-ai-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 4px 0 12px; }
.db-ai-figures div { padding: 10px 12px; border-radius: var(--fx-r-md); background: var(--fx-ai-bg); }
.db-ai-figures b { display: block; font-size: 20px; color: var(--fx-text); }
.db-ai-figures span { font-size: var(--fx-fs-xs); color: var(--fx-text-2); }
.db-meter { height: 8px; border-radius: 4px; background: var(--fx-surface-3); overflow: hidden; margin: 6px 0 4px; }
.db-meter i { display: block; height: 100%; background: var(--fx-violet); border-radius: 4px; }

/* ---------- ticket queue ---------- */
.q-views { margin-bottom: 14px; }
.q-toolbar { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(6, minmax(120px, 1fr)); gap: 10px; align-items: end; padding: 14px; margin-bottom: 14px; }
.q-toolbar label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fx-fs-xs); font-weight: 600; color: var(--fx-text-2); }
.q-toolbar .fx-select, .q-toolbar .fx-input { min-height: 34px; padding-top: 6px; padding-bottom: 6px; font-size: var(--fx-fs-sm); }
.q-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; color: var(--fx-text-2); font-size: var(--fx-fs-sm); }
.q-table td.q-subject { min-width: 260px; }
.q-table td.q-subject a { font-weight: 600; color: var(--fx-text); }
.q-table td.q-subject a:hover { color: var(--fx-link); }
.q-table .q-sub { display: block; margin-top: 2px; color: var(--fx-text-3); font-size: var(--fx-fs-xs); }
.q-table tr[data-id] { cursor: pointer; }
.q-table td[data-label="SLA"] { white-space: nowrap; }
.q-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; font-size: var(--fx-fs-sm); color: var(--fx-text-2); }
.q-pager .ag-row { margin: 0; }
/* FIXENTRA-OPS-001: server paging controls, more filters, active filters. */
.q-toolbar { grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(120px, 1fr)); }
.q-more { grid-column: 1 / -1; }
.q-more summary { cursor: pointer; font-size: var(--fx-fs-sm); font-weight: 600; color: var(--fx-link); width: max-content; }
.q-more-grid { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; align-items: end; }
.q-more-note { grid-column: 1 / -1; margin: 0; }
.q-active { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 12px; }
.q-active:empty { display: none; }
.q-chip { height: 28px; gap: 6px; background: var(--fx-primary-soft); border-color: var(--fx-info-border); color: var(--fx-info); }
.q-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.q-controls label { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fx-fs-xs); color: var(--fx-text-2); }
.q-controls .fx-select { min-height: 32px; width: auto; padding: 4px 8px; font-size: var(--fx-fs-sm); }
.q-pages { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.q-pages .fx-btn-sm { min-width: 32px; }
.q-gap { padding: 0 4px; color: var(--fx-text-3); }
#q-results.q-busy { opacity: 0.55; transition: opacity 120ms ease; }
@media (max-width: 1280px) { .q-more-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .q-more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- ticket detail ---------- */
.td-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.td-head h1 { margin: 4px 0 8px; font-size: var(--fx-fs-2xl); line-height: 1.25; font-weight: 700; word-break: break-word; }
.td-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--fx-text-2); font-size: var(--fx-fs-sm); }
.td-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.td-side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; border-radius: var(--fx-r-lg); }
.td-side .fx-tabs { position: sticky; top: 0; z-index: 2; background: var(--fx-surface); padding: 0 8px; border-radius: var(--fx-r-lg) var(--fx-r-lg) 0 0; border: 1px solid var(--fx-border); border-bottom-color: var(--fx-border); }
.td-side [role=tabpanel] { padding-top: 12px; }
.td-desc { white-space: pre-wrap; word-break: break-word; }
.td-request { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0 0; font-size: var(--fx-fs-sm); }
.td-request dt { font-weight: 600; text-transform: capitalize; } .td-request dd { margin: 0; }
.td-thread-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.ag-thread { list-style: none; margin: 0 0 16px; padding: 0; position: relative; }
.ag-thread li { position: relative; border: 1px solid var(--fx-border); border-radius: var(--fx-r-lg); padding: 12px 16px; margin-bottom: 10px; background: var(--fx-surface); }
.ag-thread li.reply.from-requester { border-left: 3px solid var(--fx-border-strong); }
.ag-thread li.reply.from-staff { border-left: 3px solid var(--fx-blue); }
.ag-thread li.note { background: #fffaeb; border-color: #f3dd9b; border-left: 3px solid #d79b00; }
.ag-thread li.event { display: flex; gap: 8px; align-items: baseline; background: none; border: 0; padding: 3px 4px 3px 18px; margin-bottom: 4px; color: var(--fx-text-2); font-size: var(--fx-fs-xs); }
.ag-thread li.event::before { content: ""; position: absolute; left: 4px; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--fx-border-strong); }
.ag-thread .who { font-weight: 600; }
.ag-thread .when { color: var(--fx-text-3); font-size: var(--fx-fs-xs); margin-left: 8px; }
.ag-thread .body { white-space: pre-wrap; word-break: break-word; margin-top: 6px; }
.td-composer .fx-tabs { margin: -4px 0 12px; }
.td-composer textarea { width: 100%; min-height: 150px; }
.td-composer.note-mode textarea { background: #fffdf3; border-color: #e7c766; }
.td-composer .ag-row { justify-content: space-between; }
.td-props .ag-grid2 > div > label:first-child { margin-top: 8px; }
.td-kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; font-size: var(--fx-fs-sm); }
.td-kv dt { color: var(--fx-text-2); } .td-kv dd { margin: 0; word-break: break-word; }
.td-sla-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--fx-border); font-size: var(--fx-fs-sm); }
.td-sla-row:last-of-type { border-bottom: 0; }
.td-sla-row small { display: block; color: var(--fx-text-3); }

/* ---------- AI panels (Fixentra Copilot / Fixentra Assist) ---------- */
.ag-ai { border-color: var(--fx-ai-border); background: linear-gradient(180deg, #faf8ff 0, #fff 140px); }
.ag-ai > h2:first-child img, .ag-ai .ag-card-head img { width: 22px; height: 22px; border-radius: 6px; }
.ag-ai ul, .ag-ai ol { margin: 6px 0 0; padding-left: 20px; }
.ag-ai li { margin: 4px 0; }
.ag-ai h3 { margin: 16px 0 6px; font-size: var(--fx-fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--fx-text-2); }
.cp-engine { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.cp-recs { width: 100%; border-collapse: collapse; font-size: var(--fx-fs-sm); }
.cp-recs td { padding: 8px 6px; border-bottom: 1px solid var(--fx-border); vertical-align: top; }
.cp-recs tr:last-child td { border-bottom: 0; }
.cp-recs .cp-reason { display: block; color: var(--fx-text-3); font-size: var(--fx-fs-xs); margin-top: 2px; }
.cp-conf { display: inline-block; padding: 1px 7px; border-radius: var(--fx-r-pill); font-size: 11px; font-weight: 600; background: var(--fx-neutral-bg); color: var(--fx-neutral); text-transform: capitalize; }
.cp-conf.high { background: var(--fx-success-bg); color: var(--fx-success); }
.cp-conf.medium { background: var(--fx-info-bg); color: var(--fx-info); }
.cp-conf.low { background: var(--fx-warning-bg); color: var(--fx-warning); }
.cp-cite { display: inline-flex; gap: 4px; margin-left: 4px; }
.cp-cite a { padding: 0 6px; border-radius: 4px; background: var(--fx-info-bg); font-size: 11px; font-weight: 600; }
.cp-draft { white-space: pre-wrap; padding: 10px 12px; border: 1px dashed var(--fx-ai-border); border-radius: var(--fx-r-md); background: #fff; font-size: var(--fx-fs-sm); color: var(--fx-text); }
.cp-usage { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-top: 10px; margin-top: 12px; border-top: 1px solid var(--fx-border); font-size: var(--fx-fs-xs); color: var(--fx-text-3); }

/* ---------- Control Center ---------- */
.cc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.cc-nav { position: sticky; top: 84px; padding: 10px; }
.cc-nav h2 { margin: 12px 8px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--fx-text-3); }
.cc-nav h2:first-child { margin-top: 4px; }
.cc-nav a { display: block; padding: 7px 10px; border-radius: var(--fx-r-sm); color: var(--fx-text); font-weight: 500; font-size: var(--fx-fs-sm); text-decoration: none !important; }
.cc-nav a:hover { background: var(--fx-surface-3); }
.cc-nav a[aria-current="page"] { background: var(--fx-primary-soft); color: var(--fx-primary); font-weight: 600; }
.cc-select { display: none; margin-bottom: 14px; }
.cc-pane-head { margin-bottom: 16px; }
.cc-pane { min-width: 0; }
.cc-pane .ag-card { overflow-x: auto; }
.cc-pane .ag-table td select { min-width: 150px; }
.cc-pane .ag-table td input[data-name] { min-width: 180px; }
.cc-pane-head h2 { margin: 0; font-size: var(--fx-fs-xl); font-weight: 700; }
.cc-pane-head p { margin: 4px 0 0; color: var(--fx-text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .q-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); } .q-toolbar .q-search { grid-column: span 4; } }
@media (max-width: 1180px) {
  .td-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .db-span-8, .db-span-4 { grid-column: span 12; }
}
@media (max-width: 1024px) {
  .td-layout { grid-template-columns: 1fr; }
  .td-side { position: static; max-height: none; overflow: visible; }
  .db-span-6 { grid-column: span 12; }
  .cc-layout { grid-template-columns: 1fr; }
  .cc-nav { display: none; }
  .cc-select { display: block; }
}
@media (max-width: 900px) {
  /* Off-canvas navigation */
  .ag-side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform var(--fx-ease); box-shadow: var(--fx-shadow-lg); }
  .ag-app.nav-open .ag-side { transform: none; }
  .ag-app.collapsed .ag-side { width: 248px; }
  .ag-app.collapsed .ag-brand-text, .ag-app.collapsed .ag-nav a span, .ag-app.collapsed .ag-nav-label, .ag-app.collapsed .ag-side-foot { display: revert; }
  .ag-app.collapsed .ag-nav a { justify-content: flex-start; padding: 0 12px; }
  .ag-collapse { display: none; }
  .ag-menu-btn { display: inline-flex; }
  .ag-top { padding: 0 12px; gap: 8px; }
  .ag-org-chip, .ag-account-text, .ag-account > svg { display: none; }
  .ag-content { padding: 16px 14px 40px; }
  .q-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .q-toolbar .q-search { grid-column: span 2; }
}
@media (max-width: 640px) {
  .ag-grid2 { grid-template-columns: 1fr; }
  .ag-search .fx-input { font-size: 16px; }
  .ag-notes { position: fixed; left: 8px; right: 8px; top: 60px; width: auto; }
  .fx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-kpi-value { font-size: 24px; }
  .db-ai-figures { grid-template-columns: 1fr; }
  .ag-table .hide-sm { display: none; }
  /* Ticket queue as cards */
  .q-table thead { display: none; }
  .q-table, .q-table tbody, .q-table tr, .q-table td { display: block; width: 100%; }
  .q-table tr { padding: 10px 12px; border-bottom: 1px solid var(--fx-border); }
  .q-table td { padding: 2px 0; border: 0; }
  .q-table td.q-subject { min-width: 0; }
  .q-table td[data-label]:not(.q-subject):not(.q-num) { display: inline-flex; width: auto; margin: 4px 6px 0 0; }
  .q-table td.hide-sm { display: inline-flex !important; color: var(--fx-text-2); font-size: var(--fx-fs-xs); }
  .q-table td.hide-sm::before { content: attr(data-label) ": "; white-space: pre; color: var(--fx-text-3); }
  .ag-card { padding: 14px; }
  .td-kv { grid-template-columns: 100px 1fr; }
}
