/* A class that sets `display` must never be able to un-hide something marked `hidden`. */
[hidden] {
  display: none !important;
}

:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --user-bubble: #2563eb;
  --user-bubble-text: #ffffff;
  --assistant-bubble: #eef1f5;
  --assistant-bubble-text: #1a1d23;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app {
  display: flex;
  height: 100vh;
}

.app[hidden] {
  display: none;
}

/* -- sidebar -------------------------------------------------------------------------------- */

.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.sidebar-header-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.customer-label {
  overflow-wrap: anywhere;
}

/* -- login ---------------------------------------------------------------------------------- */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.login-card h1 {
  margin: 0;
  font-size: 20px;
}

.login-hint {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 14px;
}

.login-card label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.login-card input {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--panel);
  color: var(--text);
}

.login-error {
  margin: 0;
  padding: 8px 12px;
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius);
  font-size: 14px;
}

.login-error[hidden] {
  display: none;
}

.login-card .btn-primary {
  margin-top: 8px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 16px 0 8px;
}

.conversation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 2px;
}

.conversation-delete-btn {
  flex: none;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.conversation-delete-btn:hover,
.conversation-delete-btn:focus-visible {
  background: #fde8e8;
  color: #b3261e;
}

.conversation-item-btn {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conversation-item-btn:hover {
  background: var(--bg);
}

.conversation-item-btn.active {
  background: #e8f0fe;
}

.conversation-item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item-updated {
  font-size: 11px;
  color: var(--text-muted);
}

/* -- main chat area --------------------------------------------------------------------- */

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.chat-header h1 {
  font-size: 18px;
  margin: 0;
}

.status-banner {
  margin: 12px 24px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  max-width: 70%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message.role-user {
  align-self: flex-end;
  align-items: flex-end;
}

.message.role-assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.message-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.message-text {
  padding: 10px 14px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.5;
}

.message.role-user .message-text {
  background: var(--user-bubble);
  color: var(--user-bubble-text);
}

.message.role-assistant .message-text {
  background: var(--assistant-bubble);
  color: var(--assistant-bubble-text);
}

.message.thinking .message-text {
  color: var(--text-muted);
  font-style: italic;
}

.message-basis {
  font-size: 11px;
  color: var(--text-muted);
  align-self: center;
}

.message-actions {
  display: flex;
  gap: 8px;
}

.message-sql {
  max-width: 100%;
  overflow-x: auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
}

/* -- suggestions / match options ------------------------------------------------------------ */

.suggestions,
.match-options {
  padding: 0 24px 12px;
}

.suggestions-label,
.match-options-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.suggestion-chips,
.match-options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 13px;
  cursor: pointer;
  max-width: 100%;
  text-align: left;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* -- ask form --------------------------------------------------------------------------- */

.ask-form {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.question-input {
  flex: 1;
  resize: none;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
}

/* -- buttons ---------------------------------------------------------------------------- */

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-link {
  background: none;
  color: var(--text-muted);
  text-decoration: underline;
  padding: 4px 0;
}

/* -- 404 page (error.html) ---------------------------------------------------------------- */

.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.error-page main {
  text-align: center;
}

/* -- roles: navigation, panes, tables, forms --------------------------------------------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane {
  flex: 1;
  min-height: 0;
}

.pane-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 0 24px 24px;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.pane-header h1 {
  font-size: 18px;
  margin: 0;
}

.pane-panel .status-banner {
  margin: 0;
}

.status-note {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #e6f4ea;
  color: #1e6b34;
  font-size: 13px;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.role-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f0fe;
  color: var(--primary);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.nav-btn {
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius);
  background: none;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.nav-btn:hover {
  background: var(--bg);
}

.nav-btn.active {
  background: #e8f0fe;
  color: var(--primary);
  font-weight: 600;
}

.panel-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel-form h2 {
  margin: 0 0 4px;
  font-size: 15px;
}

.panel-form label,
.inline-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.panel-form input,
.inline-label select {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--panel);
  color: var(--text);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 14px;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.table td .btn {
  margin-right: 8px;
}

.status-ok {
  color: #1e6b34;
}

.status-off {
  color: var(--danger);
}

.history-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.history-layout .conversation-list {
  width: 280px;
  flex: none;
}

.history-viewer {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-viewer .messages {
  padding: 0;
}

.conversation-item-owner {
  font-size: 11px;
  color: var(--text-muted);
}

/* -- admin: login toggle, companies, setup card ---------------------------------------------- */

.role-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-radius: var(--radius);
}

.role-toggle-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: var(--radius);
  background: none;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
}

.role-toggle-btn.active {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-banner {
  margin: 0;
  padding: 12px 24px;
  background: #fff4d6;
  color: #7a5a00;
  font-size: 14px;
}

.table-scroll {
  overflow-x: auto;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
}

.status-pill.status-ready {
  background: #e6f4ea;
  color: #1e6b34;
}

.status-pill.status-waiting_for_setup,
.status-pill.status-provisioning {
  background: #fff4d6;
  color: #7a5a00;
}

.status-pill.status-failed,
.status-pill.status-suspended {
  background: #fde8e8;
  color: var(--danger);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card h2 {
  margin: 0;
  font-size: 15px;
}

.card p {
  margin: 0;
}

.card-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.setup-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 14px;
}

.setup-list dt {
  color: var(--text-muted);
}

.setup-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.setup-message {
  margin: 0;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.card > .btn {
  align-self: flex-start;
}

/* -- one-time link page (link.html) ---------------------------------------------------------- */

.link-back {
  text-align: center;
  text-decoration: none;
}

/* -- destructive actions --------------------------------------------------------------------- */

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border: 1px solid var(--danger);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(0.92);
}

.danger-zone {
  border-color: var(--danger);
}

.danger-zone h2 {
  color: var(--danger);
}

/* -- dashboard ------------------------------------------------------------------------------ */
/* Widgets sit on a 12-column grid. dashboard.js sets each widget's --x/--y/--w/--h through the
   CSSOM (allowed by the Content-Security-Policy, unlike style attributes); on narrow screens the
   grid is one column and the positions are ignored. */

.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dash-status {
  margin: 0;
  min-height: 1.2em;
}

.dash-catalog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-catalog-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.dash-catalog-item p {
  margin: 2px 0 0;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 90px;
  gap: 12px;
}

.widget {
  grid-column: var(--x, 1) / span var(--w, 4);
  grid-row: var(--y, 1) / span var(--h, 2);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.widget:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.widget-dragging {
  opacity: 0.85;
  border-color: var(--primary);
  z-index: 1;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.widget-title {
  margin: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.widget-btn {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.widget-btn:hover,
.widget-btn:focus-visible {
  background: var(--bg);
  color: var(--primary);
}

.widget-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 12px;
}

.widget-body p {
  margin: 0 0 4px;
}

.widget-loading .widget-body {
  opacity: 0.6;
}

.widget-number {
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.widget-pair {
  display: flex;
  gap: 32px;
}

.widget-change {
  font-size: 13px;
  font-weight: 600;
}

/* Cost going up is the thing to look at, so it gets the warning colour. */
.change-up {
  color: var(--danger);
}

.change-down {
  color: #1e6b34;
}

.change-flat {
  color: var(--text-muted);
}

.widget-table {
  margin-top: 8px;
  font-size: 12px;
}

.widget-method {
  font-size: 12px;
  color: var(--primary);
  text-decoration: underline dotted;
  cursor: help;
  width: fit-content;
}

.widget-error {
  color: var(--danger);
  font-size: 13px;
}

.widget-foot {
  margin: 0;
  padding: 4px 12px 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.widget-settings {
  position: absolute;
  inset: 41px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  overflow: auto;
  background: var(--panel);
  font-size: 13px;
}

.widget-settings label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.widget-settings input,
.widget-settings select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-weight: normal;
}

.widget-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--border) 50%);
}

@media (max-width: 760px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
  }

  .widget {
    grid-column: 1;
    grid-row: auto;
    min-height: 180px;
  }

  .widget-header {
    cursor: default;
  }

  .widget-resize {
    display: none;
  }
}
/* -- charts (charts.js) ---------------------------------------------------------------------- */
/* The categorical palette is the dataviz reference instance, checked with its validator on this
   white surface (all gates pass; three slots are under 3:1 contrast, so every chart has a legend
   and a table view). A slot follows its entity: a service family is always the same colour. */

.widget-body {
  display: flex;
  flex-direction: column;
}

.widget-chart {
  flex: 1;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  margin-top: 6px;
}

.chart {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-other: #a8a7a0;
  --series-expected: #b7d3f6;
  --chart-grid: #e1e0d9;
  --chart-axis: #c3c2b7;
  --chart-ink: #52514e;
  --chart-muted: #898781;
  position: relative;
}

.chart .s1 { fill: var(--series-1); background: var(--series-1); stroke: var(--series-1); }
.chart .s2 { fill: var(--series-2); background: var(--series-2); }
.chart .s3 { fill: var(--series-3); background: var(--series-3); }
.chart .s4 { fill: var(--series-4); background: var(--series-4); }
.chart .s5 { fill: var(--series-5); background: var(--series-5); }
.chart .s6 { fill: var(--series-6); background: var(--series-6); }
.chart .s7 { fill: var(--series-7); background: var(--series-7); }
.chart .s-other { fill: var(--series-other); background: var(--series-other); }
.chart .s-expected { fill: var(--series-expected); background: var(--series-expected); }

.chart-tools {
  position: absolute;
  top: -4px;
  right: 0;
  z-index: 1;
}

.chart-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0 56px 4px 0;
  padding: 0;
  font-size: 11px;
  color: var(--chart-ink);
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-plot {
  position: relative;
  flex: 1;
  min-height: 90px;
}

.chart-plot svg {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.chart-plot:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.chart-grid {
  stroke: var(--chart-grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-baseline {
  stroke: var(--chart-axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-tick {
  fill: var(--chart-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.chart-value,
.chart-legend-text {
  fill: var(--chart-ink);
  font-size: 11px;
}

.chart-legend-value {
  fill: var(--chart-muted);
}

.chart-center {
  fill: var(--text);
  font-size: 13px;
  font-weight: 600;
}

/* Two classes, so it outranks `.chart .s1`, whose fill would turn the line into a solid shape. */
.chart .chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .chart-area {
  fill-opacity: 0.1;
  stroke: none;
}

.chart-dot {
  stroke: var(--panel);
  stroke-width: 2;
}

.chart-segment {
  stroke: var(--panel);
  stroke-width: 2;
}

.chart-cross {
  stroke: var(--chart-axis);
  stroke-width: 1;
}

.chart-hit {
  fill: transparent;
}

.chart-tooltip {
  position: absolute;
  left: var(--tx, 0);
  top: var(--ty, 0);
  z-index: 2;
  pointer-events: none;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(11, 11, 11, 0.08);
  font-size: 11px;
  color: var(--chart-ink);
  white-space: nowrap;
}

.chart-tooltip strong {
  display: block;
  color: var(--text);
}

.chart-table {
  overflow: auto;
  flex: 1;
}

.stat-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  margin: 8px 0 0;
  font-size: 13px;
}

.stat-list dt {
  color: var(--text-muted);
}

.stat-list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.dash-share-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.dash-grid-readonly .widget-header {
  cursor: default;
}

.dash-grid-readonly .widget-resize {
  display: none;
}

/* Big standalone figures read better with proportional digits. */
.widget-number {
  font-variant-numeric: normal;
}
/* -- reports (reports.js) --------------------------------------------------------------------- */

.reports-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.reports-list .conversation-item-btn.active {
  background: #e8f0fe;
  color: var(--primary);
}

.reports-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.report-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.report-heading h2 {
  margin: 0;
  font-size: 18px;
}

.report-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  font-size: 13px;
}

.report-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.report-form input,
.report-form select,
.tag-settings select,
.tag-settings input {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-weight: normal;
}

.report-notes {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.tag-settings-row {
  display: grid;
  grid-template-columns: 110px 160px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.widget-note {
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .reports-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .tag-settings-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* -- custom widget requests (requests.js) ------------------------------------------------------- */

.message-list,
.request-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.message-item,
.request-item {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.message-item p,
.request-item p {
  margin: 0 0 2px;
}

.message-read p {
  color: var(--text-muted);
}

.request-text,
.wr-request-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#dash-request-form textarea,
#wr-reason {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

#dash-request-form h3 {
  margin: 8px 0 0;
  font-size: 14px;
}

/* -- tables, charts and widgets under a chat answer (chat_visuals.js) ---------------------------- */

.message.message-wide {
  width: 100%;
  max-width: 760px;
}

/* The bubble lines its parts up at the left without stretching them; a chart must stretch, or it
   shrinks to its narrowest. */
.message-extras {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 12px;
  margin-top: 8px;
  max-width: 720px;
}

.chat-visual,
.chat-widget {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
}

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-widget-body {
  height: 240px;
  padding: 0;
}

.chat-chart {
  height: 240px;
  display: flex;
  flex-direction: column;
}


/* -- what an employee can use (Team page) ---------------------------------------------------- */

.access-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 4px 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

.access-choices legend {
  padding: 0 4px;
  font-weight: 600;
}

.access-choices label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
}

/* Chat's "Add to dashboard": tick the dashboards it goes on. */
.chat-dash-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-dash-picker input[type="text"] {
  max-width: 260px;
}

.chat-dash-actions {
  display: flex;
  gap: 8px;
}

.chat-dash-status:empty {
  display: none;
}
