[data-ai-usage] { min-width: 0; min-height: 0; height: 100%; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); gap: 10px; --aiu-muted: #aeb6c7; }
.app.is-superadmin-view .superadmin-content .superadmin-view[data-superadmin-view="ai-usage"].active { height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr); overflow: hidden; padding: 0 2px; }
.aiu-heading .headline { font-size: 24px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.aiu-readonly { font-size: 10px; font-weight: 400; letter-spacing: 0; color: #aeb6c7; }
.aiu-tools { display: flex; gap: 6px; }
.aiu-navigation { display: grid; gap: 6px; min-width: 0; }
.aiu-categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 300px); box-sizing: border-box; padding: 4px; gap: 4px; border: 1px solid #343b49; border-radius: 14px; background: #12161e; }
.aiu-categories button { min-height: 44px; border: 0; border-radius: 10px; padding: 8px 18px; background: transparent; color: #aeb6c7; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.aiu-categories button[aria-pressed="true"] { color: #f4f6ff; background: #2a3245; box-shadow: 0 1px 4px #0003; }
.aiu-categories button:hover { color: #f4f6ff; }
.aiu-categories button:focus-visible { outline: 2px solid #adbdff; outline-offset: 1px; }
.aiu-navigation .aiu-tabs[hidden] { display: none; }
.aiu-icon-button { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; padding: 10px; border: 1px solid #343b49; border-radius: 12px; background: #171b23; color: #e9edf8; cursor: pointer; font: inherit; font-size: 22px; }
.aiu-icon-button:hover, .aiu-icon-button[aria-expanded="true"] { background: #2a3245; border-color: #788bc7; }
.aiu-icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[data-ai-filter-count] { position: absolute; right: -3px; top: -3px; font-size: 10px; line-height: 17px; min-width: 17px; border-radius: 10px; background: #b5c4ff; color: #111827; }
.aiu-tabs, .aiu-segments { display: flex; gap: 4px; border-bottom: 1px solid #303744; }
.aiu-tabs { overflow-x: auto; }
.aiu-tabs button { flex-shrink: 0; }
.aiu-whatsapp { display: grid; grid-template-rows: auto auto auto minmax(140px, 1fr); gap: 6px; }
.aiu-metrics.aiu-wa-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.aiu-wa-metrics small { display: none; }
.aiu-wa-notes .aiu-note { margin: 0; font-size: 11px; }
.aiu-wa-notes summary { color: var(--aiu-muted); font-size: 11px; cursor: pointer; min-height: 28px; padding: 5px 0; box-sizing: border-box; }
.aiu-wa-body { min-height: 0; overflow-y: auto; }
.aiu-wa-body > .aiu-trend { height: 100%; box-sizing: border-box; }
.aiu-tabs button, .aiu-segments button { min-width: 0; min-height: 44px; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #aeb6c7; font: inherit; font-size: 13px; cursor: pointer; }
.aiu-tabs button[aria-selected="true"], .aiu-segments button[aria-pressed="true"] { border-bottom-color: #adbdff; color: #f4f6ff; }
.aiu-segments { width: fit-content; max-width: 100%; margin-bottom: 4px; }
.aiu-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
[data-ai-usage] .btn { font-family: inherit; }
.aiu-eyebrow { color: #b7c6ff; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 8px; }
.aiu-filter-popover { position: fixed; inset: auto; margin: 0; box-sizing: border-box; width: 460px; max-width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 14px; overflow-y: auto; border: 1px solid #4c5873; border-radius: 18px; background: #171c26; color: #eef1fa; box-shadow: 0 20px 65px #0008; }
.aiu-filter-popover::backdrop { background: #0003; }
.aiu-filter-popover h2 { font-size: 16px; margin: 0; }
.aiu-filter-popover > .aiu-heading { margin-bottom: 12px; }
.aiu-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0; }
.aiu-filters label { display: grid; gap: 7px; min-width: 0; font-size: 12px; color: var(--aiu-muted); }
.aiu-filters :is(input, select) { box-sizing: border-box; width: 100%; min-width: 0; height: 44px; padding: 8px 10px; color: #f0f2fa; background: #0d1016; border: 1px solid #3d4556; border-radius: 10px; font: inherit; color-scheme: dark; }
.aiu-filters select { appearance: none; -webkit-appearance: none; line-height: normal; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23aeb6c7' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.aiu-filter-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; grid-column: 1 / -1; position: sticky; bottom: -14px; background: #171c26; padding: 10px 0 4px; }
.aiu-status { margin: 0; font-size: 12px; color: var(--aiu-muted); overflow-wrap: anywhere; }
.aiu-status.is-error { color: #ffb8b8; padding: 14px; border: 1px solid #774343; border-radius: 12px; }
[data-ai-results] { display: grid; grid-template-rows: minmax(0, 1fr); min-height: 0; min-width: 0; }
.aiu-tab-panel { min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; }
.aiu-overview { display: grid; align-content: start; gap: 12px; grid-template-rows: auto auto minmax(140px, 1fr); }
.aiu-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; border-bottom: 1px solid #303744; padding: 6px 0 14px; }
.aiu-metric { padding: 4px 12px; display: flex; flex-direction: column; gap: 7px; min-width: 0; border-left: 1px solid #303744; }
.aiu-metric--hero { border: 0; padding-left: 0; }
.aiu-metric > span { font-size: 12px; color: #c6cddd; }
.aiu-metric strong { font-size: clamp(22px, 2.1vw, 32px); line-height: 1.2; letter-spacing: -.04em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.aiu-metric small { font-size: 11px; color: var(--aiu-muted); line-height: 1.5; }
.aiu-token-split { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; font-size: 13px; color: var(--aiu-muted); }
.aiu-token-split strong { color: #edf0fa; }
.aiu-panel { padding: 12px 2px; min-width: 0; }
.aiu-trend { display: grid; min-height: 0; grid-template-rows: auto minmax(75px, 1fr) auto; padding: 8px 0; }
.aiu-trend .aiu-note { margin: 4px 0; }
.aiu-unknown-key { color: #efbf68; }
.aiu-panel h2, .aiu-dialog h2 { font-size: 17px; margin: 0 0 6px; letter-spacing: -.02em; }
.aiu-note { font-size: 12px; color: var(--aiu-muted, #aeb6c7); line-height: 1.6; margin: 6px 0 12px; }
.aiu-chart { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; min-height: 0; min-width: 0; }
.aiu-day { flex: 1 0 32px; display: flex; flex-direction: column; gap: 10px; border: 0; background: none; color: #b7c0d3; padding: 0 2px; cursor: pointer; min-height: 65px; position: relative; font: inherit; }
.aiu-bar-area { flex: 1; min-height: 40px; display: flex; align-items: end; justify-content: center; border-bottom: 1px solid #394254; width: 100%; }
.aiu-bar-area i { display: block; width: 70%; max-width: 72px; border-radius: 6px 6px 0 0; background: linear-gradient(#b4c1ff, #687bc0); }
.aiu-day:hover .aiu-bar-area i { background: #d0d9ff; }
.aiu-day small { font-size: 10px; }
.aiu-day--unknown::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #efbf68; position: absolute; bottom: 15px; left: calc(50% - 2px); }
.aiu-breakdown-view { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.aiu-breakdown-body { min-height: 0; overflow-y: auto; }
.aiu-breakdown { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.aiu-breakdown li { min-width: 0; }
.aiu-breakdown button { padding: 4px 0; width: 100%; display: flex; gap: 8px; align-items: start; justify-content: space-between; text-align: left; border: 0; background: transparent; color: #e9edf8; font: inherit; font-size: 13px; cursor: pointer; min-height: 36px; }
.aiu-breakdown button span { overflow-wrap: anywhere; }
.aiu-breakdown button strong { white-space: nowrap; }
.aiu-breakdown small { color: var(--aiu-muted); font-size: 11px; }
.aiu-meter { height: 4px; background: #262d3c; margin: 4px 0 8px; border-radius: 4px; overflow: hidden; }
.aiu-meter i { display: block; height: 100%; background: #99acee; }
.aiu-audio { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.aiu-audio h3, .aiu-operation h3 { font-size: 14px; margin: 8px 0; }
.aiu-audio dl, .aiu-operation dl { margin: 0; }
.aiu-audio dl > div, .aiu-operation dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 7px 0; font-size: 12px; border-bottom: 1px solid #ffffff08; }
.aiu-audio dt, .aiu-operation dt { color: var(--aiu-muted, #aeb6c7); }
.aiu-audio dd, .aiu-operation dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.aiu-activity-view { display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
[data-ai-activity] { min-height: 0; overflow-y: auto; }
.aiu-table-wrap { position: relative; overflow-x: auto; max-width: 100%; }
.aiu-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.aiu-table th { text-align: left; color: #aeb6c7; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; padding: 12px 10px; }
.aiu-table td { padding: 14px 10px; border-top: 1px solid #ffffff0d; max-width: 180px; overflow-wrap: anywhere; }
.aiu-table small { display: block; color: #aeb6c7; margin-top: 5px; }
.aiu-table .btn { white-space: nowrap; font-size: 12px; }
.aiu-badge { display: inline-block; border-radius: 20px; padding: 5px 9px; background: #252e3d; color: #d5dff1; font-size: 11px; white-space: nowrap; }
.aiu-badge--succeeded { color: #aff0d0; background: #18392f; }
.aiu-badge--unknown, .aiu-badge--started { color: #f3ce8b; background: #3c311e; }
.aiu-badge--failed { color: #ffc1c1; background: #45262c; }
.aiu-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; font-size: 12px; color: #aeb6c7; }
.aiu-pagination span { text-align: center; }
.aiu-pagination button:disabled { opacity: .4; cursor: default; }
.aiu-empty { text-align: center; padding: 30px 12px; color: #aeb6c7; font-size: 13px; }
.aiu-dialog { color: #f2f4fa; background: #141820; border: 1px solid #46516a; border-radius: 20px; padding: 24px; width: min(700px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: 85dvh; box-sizing: border-box; overflow-y: auto; }
.aiu-dialog::backdrop { background: #000a; backdrop-filter: blur(5px); }
.aiu-dialog .aiu-heading { position: sticky; top: -24px; padding: 12px 0; background: #141820; z-index: 1; }
.aiu-operation { border-top: 1px solid #394255; padding: 12px 0 18px; }
.aiu-operation header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.aiu-id { font-size: 12px; color: #b7c6ff; overflow-wrap: anywhere; }
.aiu-id, .aiu-operation dd { user-select: text; -webkit-user-select: text; }
.aiu-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 1000px) { .aiu-metric small { display: none; } .aiu-metric:nth-child(3) small { display: block; } .aiu-metric { padding-inline: 7px; } }
@media (max-width: 600px) {
  [data-ai-usage] { gap: 6px; }
  .aiu-heading { gap: 8px; }
  .aiu-heading .headline { font-size: 21px; }
  .aiu-readonly { font-size: 9px; }
  .aiu-tabs { gap: 0; justify-content: space-between; }
  .aiu-tabs button { padding: 8px 4px; font-size: 11px; flex: 1 0 auto; }
  .aiu-metrics.aiu-wa-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .aiu-wa-metrics .aiu-metric--hero { grid-column: auto; }
  .aiu-wa-metrics .aiu-metric:nth-child(3) { border-left: 1px solid #303744; }
  .aiu-wa-metrics .aiu-metric:nth-child(4) { border-left: 0; }
  .aiu-whatsapp { grid-template-rows: auto auto auto minmax(110px, 1fr); gap: 4px; }
  .aiu-wa-body > .aiu-trend { grid-template-rows: auto minmax(60px, 1fr) auto; padding-block: 0; }
  .aiu-wa-body .aiu-chart { padding-block: 4px; }
  .aiu-wa-body .aiu-day { min-height: 50px; gap: 4px; }
  .aiu-status { font-size: 10px; }
  .aiu-filters :is(input, select) { font-size: 16px; }
  .aiu-filters label:nth-child(3), .aiu-filters label:nth-child(5) { grid-column: 1 / -1; }
  .aiu-filter-actions { grid-column: 1 / -1; }
  .aiu-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 8px; padding-block: 0 8px; }
  .aiu-metric { padding: 4px 8px; gap: 4px; }
  .aiu-metric > span { font-size: 10px; }
  .aiu-metric strong { font-size: 20px; }
  .aiu-metric--hero { grid-column: span 2; }
  .aiu-metric:nth-child(3) { border-left: 0; }
  .aiu-metric:nth-child(3) small { display: block; font-size: 9px; }
  .aiu-token-split { font-size: 11px; gap: 5px 10px; }
  .aiu-token-split small { font-size: 9px; }
  .aiu-overview { gap: 8px; }
  .aiu-trend h2 { font-size: 14px; }
  .aiu-trend .aiu-note { font-size: 10px; }
  .aiu-audio { grid-template-columns: minmax(0, 1fr); }
  .aiu-table, .aiu-table tbody { display: block; }
  .aiu-table thead { display: none; }
  .aiu-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; padding: 10px 0; border-bottom: 1px solid #303744; }
  .aiu-table td { padding: 0; border: 0; max-width: none; font-size: 11px; }
  .aiu-table td:nth-child(1) { grid-area: 1 / 1; }
  .aiu-table td:nth-child(2) { grid-area: 2 / 1; color: #aeb6c7; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .aiu-table td:nth-child(3) { display: none; }
  .aiu-table td:nth-child(4) { grid-area: 1 / 2; justify-self: end; }
  .aiu-table td:nth-child(5) { grid-area: 2 / 2; justify-self: end; }
  .aiu-table td:nth-child(6) { grid-area: 3 / 1; color: #aeb6c7; align-self: center; }
  .aiu-table td:nth-child(7) { grid-area: 3 / 2; justify-self: end; }
  .aiu-table small { display: inline; margin-left: 5px; font-size: 10px; }
  .aiu-table .btn { padding: 7px 10px; font-size: 11px; }
  .aiu-dialog { padding: 16px; width: calc(100vw - 20px); max-width: calc(100vw - 20px); }
  .aiu-pagination { gap: 8px; font-size: 11px; }
}
@media (max-height: 500px) {
  .app.is-superadmin-view .superadmin-content .superadmin-view[data-superadmin-view="ai-usage"].active { overflow-y: auto; }
  [data-ai-usage] { min-height: 350px; }
}

/* Editable AI policies use the same bounded scroll area as the usage reports. */
.aiu-controls { grid-row: 4; padding: 4px 4px 16px; }
.aiuc-scope { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 16px; }
.aiuc-scope form { display: flex; gap: 8px; align-items: end; min-width: 0; }
.aiuc-scope form label { flex: 1; min-width: 0; }
.aiuc-scope [data-company-results] { grid-column: 1 / -1; }
.aiuc-scope [data-company-results]:empty { display: none; }
.aiuc-search-results { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow: auto; }
.aiu-controls label { display: grid; gap: 6px; font-size: 13px; min-width: 0; }
.aiu-controls input:not([type=checkbox]), .aiu-controls select, .aiu-controls textarea { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; border: 1px solid #404754; border-radius: 10px; background: #191d25; color: #f0f2f8; padding: 10px 12px; font: inherit; font-size: 16px; color-scheme: dark; }
.aiu-controls input:focus-visible, .aiu-controls textarea:focus-visible, .aiu-controls select:focus-visible { outline: 2px solid #adbdff; outline-offset: 2px; }
.aiuc-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.aiuc-summary h2 { font-size: 18px; margin: 14px 0 4px; overflow-wrap: anywhere; }
.aiuc-summary h3 { font-size: 15px; margin: 0; }
.aiuc-summary .aiu-badge { flex-shrink: 0; }
.aiuc-main-limit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 16px; margin: 16px 0; }
.aiu-controls .aiuc-pause { display: flex; align-items: center; min-height: 44px; gap: 10px; }
.aiuc-pause input { width: 20px; height: 20px; flex-shrink: 0; accent-color: #aebeff; }
.aiu-controls small { color: #aeb6c7; font-size: 12px; line-height: 1.5; }
.aiuc-meter { border-left: 3px solid #899de4; padding: 10px 14px; background: #171c27; border-radius: 4px 10px 10px 4px; font-size: 14px; line-height: 1.7; }
.aiuc-features { border-block: 1px solid #343b49; margin-block: 16px; }
.aiuc-features summary { cursor: pointer; padding: 16px 0; }
.aiuc-features section { padding: 14px 0 20px; border-top: 1px solid #2c3240; }
.aiuc-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.aiuc-reason { margin: 16px 0; }
.aiuc-save { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 10px; }
.aiuc-history article { border-bottom: 1px solid #343b49; padding: 16px 0; overflow-wrap: anywhere; }
.aiuc-history small { display: block; margin-top: 4px; }
.aiuc-history ul { padding-left: 20px; font-size: 13px; line-height: 1.8; }
.aiu-controls [data-control-status].is-error { color: #ffb8b8; }
.aiu-controls [aria-pressed=true] { border-color: #aab9f1; background: #29334b; }
.aiu-controls [hidden] { display: none !important; }
.aiu-controls button { min-height: 44px; }
@media (max-width: 600px) {
  .aiuc-scope, .aiuc-main-limit { grid-template-columns: minmax(0, 1fr); }
  .aiuc-fields { grid-template-columns: minmax(0, 1fr); }
  .aiuc-summary { align-items: start; }
  .aiuc-summary .aiu-badge { font-size: 10px; }
}

.aiu-controls select { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.aiuc-summary > div, .aiuc-summary h3 { min-width: 0; overflow-wrap: anywhere; }
.aiuc-summary .aiuc-pause { flex-shrink: 0; }

.aiuc-scope > label { overflow: hidden; padding: 3px; margin: -3px; }

.aiuc-model { margin-bottom: 14px; max-width: 460px; overflow: hidden; padding: 3px; margin-left: -3px; }
