.admin-page-frame[data-admin-template="dashboard-summary"] .metrics-row,
.admin-page-frame[data-admin-template="data-table"] .metrics-row {
    margin-top: 4px;
}

.admin-shell[data-admin-emphasis="summary-first"] .admin-page-frame {
    gap: 18px;
}

.admin-shell[data-admin-emphasis="data-first"] .admin-page-frame {
    gap: 12px;
}

.admin-shell[data-admin-emphasis="form-first"] .admin-page-frame,
.admin-shell[data-admin-emphasis="detail-first"] .admin-page-frame {
    gap: 14px;
}

.admin-page-frame[data-admin-template="data-table"] .panel-card,
.admin-page-frame[data-admin-template="settings"] .panel-card,
.admin-page-frame[data-admin-template="detail-workspace"] .panel-card {
    overflow: hidden;
}

.admin-page-frame[data-admin-template="settings"] .panel-card,
.admin-page-frame[data-admin-template="detail-workspace"] .panel-card {
    display: grid;
    gap: 12px;
}

.admin-shell[data-admin-template="data-table"] .admin-results-region,
.admin-shell[data-admin-template="data-table"] .admin-table-shell,
.admin-shell[data-admin-template="data-table"] .pagination,
.admin-shell[data-admin-template="data-table"] .admin-filter-bar,
.admin-shell[data-admin-template="data-table"] .admin-action-bar {
    width: 100%;
}

@keyframes export-row-attention-pulse {
    0%,
    100% {
        background-color: color-mix(in srgb, var(--panel) 86%, rgba(245, 158, 11, 0.12));
        box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.08);
    }

    50% {
        background-color: color-mix(in srgb, var(--panel) 78%, rgba(20, 184, 166, 0.16));
        box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.16);
    }
}

.admin-page-frame[data-admin-section="exports"] .admin-table tbody tr.export-row-attention {
    cursor: pointer;
}

.admin-page-frame[data-admin-section="exports"] .admin-table tbody tr.export-row-attention > td {
    animation: export-row-attention-pulse 4.2s ease-in-out infinite;
}

.admin-page-frame[data-admin-section="exports"] .admin-table tbody tr.export-row-attention:focus-visible > td {
    box-shadow: inset 0 0 0 2px var(--accent);
}

@media (prefers-reduced-motion: reduce) {
    .admin-page-frame[data-admin-section="exports"] .admin-table tbody tr.export-row-attention > td {
        animation: none;
        background-color: color-mix(in srgb, var(--panel) 84%, rgba(245, 158, 11, 0.12));
    }
}

.admin-page-frame[data-admin-template="settings"] .collection-dashboard-grid,
.admin-page-frame[data-admin-template="detail-workspace"] .project-detail-hero,
.admin-page-frame[data-admin-template="detail-workspace"] .project-detail-copy-grid,
.admin-page-frame[data-admin-template="detail-workspace"] .project-detail-report-images-grid {
    margin-top: 0;
}

.token-field {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    line-height: 1.7;
}

td.token-field,
.admin-table .token-field:not(input):not(textarea):not(code) {
    max-width: 38ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-shell .content-grid,
.admin-shell .compact-grid,
.admin-shell .panel-grid,
.admin-shell .admin-page-frame,
.admin-shell .admin-card,
.admin-shell .admin-card-content,
.admin-shell .admin-section-block,
.admin-shell .admin-section-block-content,
.admin-shell .admin-table-shell,
.admin-shell .admin-filter-bar,
.admin-shell .admin-action-bar,
.admin-shell .collection-dashboard-grid,
.admin-shell .collection-tab-shell,
.admin-shell .collection-tab-panel,
.admin-shell .collection-tab-panel > [data-collection-tab-panel],
.admin-shell .collection-side-stack,
.admin-shell .collection-settings-groups,
.admin-shell .collection-status-card,
.admin-shell .collection-status-card .content-group,
.admin-shell .custom-filter-form,
.admin-shell .custom-secondary-grid,
.admin-shell .project-form-layout,
.admin-shell .project-form-card,
.admin-shell .project-report-image-manager,
.admin-shell .project-report-image-grid,
.admin-shell .project-report-image-item,
.admin-shell .project-detail-copy-grid,
.admin-shell .project-detail-report-images-grid,
.admin-shell .project-detail-hero,
.admin-shell .project-analytics-grid,
.admin-shell .project-analytics-grid-metrics,
.admin-shell .project-ranking-card,
.admin-shell .token-status-grid,
.admin-shell .token-status-grid-compact,
.admin-shell .overview-health-grid,
.admin-shell .overview-runtime-grid,
.admin-shell .overview-ops-grid,
.admin-shell .overview-domain-grid,
.admin-shell .overview-summary-grid,
.admin-shell .overview-project-management-grid,
.admin-shell .overview-project-summary-grid,
.admin-shell .overview-hero-grid,
.admin-shell .overview-kpi-grid,
.admin-shell .overview-shortcut-grid,
.admin-shell .sync-action-grid,
.admin-shell .sync-rule-glance,
.admin-shell .settings-modal-grid,
.admin-shell .product-edit-grid,
.admin-shell .product-edit-preview,
.admin-shell .promotion-order-product,
.admin-shell .promotion-order-status,
.admin-shell .promotion-order-stack,
.admin-shell .admin-form-section,
.admin-shell .admin-form-section-body,
.admin-shell .admin-split-panel,
.admin-shell .admin-split-panel-main,
.admin-shell .admin-split-panel-aside,
.admin-shell .promotion-order-product {
    min-width: 0;
}

.admin-shell .admin-card > *,
.admin-shell .admin-section-block > *,
.admin-shell .admin-table-shell > *,
.admin-shell .admin-filter-bar > *,
.admin-shell .admin-action-bar > *,
.admin-shell .admin-form-section > *,
.admin-shell .admin-split-panel > * {
    min-width: 0;
}

.table-text-wrap {
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: normal;
}

.token-break {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.table-text-ellipsis {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.token-field-masked {
    filter: blur(7px);
    transition: filter 160ms ease;
}

.token-field-masked:focus {
    filter: blur(0);
}

.order-analysis-launcher {
    display: grid;
    gap: 12px;
    width: 100%;
    margin-top: 18px;
    text-align: left;
}

.order-analysis-launcher-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.order-analysis-launcher-head h2 {
    margin: 2px 0 0;
    color: var(--text-strong);
    font-size: 16px;
    line-height: 1.25;
}

.order-analysis-view-folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.order-analysis-view-folder {
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 6px 10px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--panel) 88%, rgba(20, 184, 166, 0.08));
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-soft);
}

.order-analysis-view-folder::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 12px;
    width: 74px;
    height: 12px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
    background: color-mix(in srgb, var(--panel) 92%, rgba(14, 165, 233, 0.12));
}

.order-analysis-view-folder:hover,
.order-analysis-view-folder:focus-visible {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.order-analysis-view-folder .icon {
    grid-row: span 4;
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.order-analysis-view-folder strong,
.order-analysis-view-folder span,
.order-analysis-view-folder small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-analysis-view-folder strong {
    color: var(--text-strong);
    font-size: 14px;
}

.order-analysis-view-folder span,
.order-analysis-view-folder small,
.order-analysis-launcher-empty {
    color: var(--muted);
    font-size: 12px;
}

.order-analysis-view-folder div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.order-analysis-view-folder div span {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--field-bg);
    color: var(--text);
    font-weight: 700;
}

.order-analysis-launcher-empty {
    margin: 0;
}

.collection-dashboard-grid {
    display: grid;
    grid-template-columns: var(--admin-template-balance-columns);
    gap: 12px;
    align-items: start;
}

.collection-blacklist-grid {
    grid-template-columns: minmax(0, 1fr);
}

.collection-tab-shell {
    display: grid;
    gap: 14px;
}

.collection-tab-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 3px 2px 8px;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
}

.collection-tab-button {
    flex: 0 0 auto;
    display: grid;
    gap: 3px;
    min-width: 132px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--panel-soft) 82%, transparent);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    scroll-snap-align: start;
}

.collection-tab-button:hover,
.collection-tab-button:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.collection-tab-button.is-active {
    border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--panel)) 0%, var(--panel) 100%);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 12%, transparent);
}

.collection-tab-button span {
    font-weight: 700;
    line-height: 1.2;
}

.collection-tab-button small {
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.35;
}

.collection-tab-panel,
.collection-tab-panel > [data-collection-tab-panel] {
    display: grid;
    gap: 12px;
}

.collection-tab-panel-head {
    display: none;
}

.collection-data-table {
    min-width: calc(72 * var(--admin-table-char-width));
    table-layout: auto;
}

.collection-data-table-rules {
    min-width: calc(62 * var(--admin-table-char-width));
}

.collection-data-table-blacklist-keywords {
    min-width: calc(58 * var(--admin-table-char-width));
}

.collection-data-table-blacklist-hits {
    min-width: calc(74 * var(--admin-table-char-width));
}

.collection-col-check {
    width: var(--admin-check-column-width);
}

.collection-col-keyword {
    width: calc(14 * var(--admin-table-char-width));
}

.collection-col-rate,
.collection-col-sort-mode,
.collection-col-status,
.collection-col-status-wide,
.collection-col-order {
    width: calc(7 * var(--admin-table-char-width));
}

.collection-col-time,
.collection-col-updated,
.collection-col-run {
    width: calc(10 * var(--admin-table-char-width));
}

.collection-col-note,
.collection-col-product {
    width: calc(18 * var(--admin-table-char-width));
}

.collection-col-action {
    width: var(--admin-action-column-width-dense);
}

.collection-col-action-wide {
    width: var(--admin-action-column-width-wide);
}

.collection-data-table th,
.collection-data-table td {
    padding-top: 8px;
    padding-bottom: 8px;
    vertical-align: middle;
}

.collection-grid-title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    line-height: 1.35;
}

.collection-grid-note {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.collection-grid-muted {
    color: var(--muted);
    font-size: 0.76rem;
}

.collection-grid-stack {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.collection-monitor-shell {
    display: grid;
    gap: 12px;
    contain: layout paint;
    content-visibility: auto;
    contain-intrinsic-size: 720px;
}

.collection-side-stack,
.collection-settings-groups {
    display: grid;
    gap: 12px;
}

.collection-run-monitor-status {
    margin-top: 0;
}

.collection-status-card,
.collection-status-card .content-group,
.collection-side-stack .panel-card,
.collection-settings-groups .content-group {
    min-width: 0;
}

.collection-status-grid,
.collection-summary-grid,
.collection-meta-grid {
    display: grid;
    gap: 10px;
}

.collection-status-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 4px;
}

.collection-status-runid {
    grid-column: 1 / -1;
}

.collection-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.collection-summary-item {
    align-content: start;
}

.collection-summary-item .admin-stat-item-value {
    font-size: 1.5rem;
    line-height: 1;
}

.collection-meta-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 10px;
}

.collection-endpoint-list {
    display: grid;
    gap: 8px;
}

.collection-endpoint-row {
    gap: 6px;
    align-content: start;
}

.collection-endpoint-row .admin-info-list-label {
    color: var(--muted);
    font-size: 0.8rem;
}

.collection-endpoint-row .admin-info-list-value code {
    display: block;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.collection-inline-note {
    margin: 0;
}

.admin-page-frame[data-admin-section="collection_settings"] .panel-card,
.admin-page-frame[data-admin-section="collection_settings"] .metric-panel {
    backdrop-filter: none;
}

.admin-page-frame[data-admin-section="collection_settings"] .collection-results-card,
.admin-page-frame[data-admin-section="collection_settings"] .collection-monitor-shell {
    contain: layout paint;
    content-visibility: auto;
    contain-intrinsic-size: 720px;
}

.admin-page-frame[data-admin-section="collection_settings"] .admin-table-tight {
    table-layout: auto;
}

.admin-page-frame[data-admin-section="collection_settings"] .admin-table th {
    backdrop-filter: none;
}

.admin-page-frame[data-admin-section="collection_settings"] .admin-table tbody tr {
    transition: none;
}

.admin-page-frame[data-admin-section="collection_settings"] .admin-table th,
.admin-page-frame[data-admin-section="collection_settings"] .admin-table td {
    overflow-wrap: break-word;
    word-break: normal;
}

.collection-monitor-table {
    min-width: calc(73 * var(--admin-table-char-width));
}

@media (max-width: 720px) {
    .collection-tab-list {
        margin-inline: -2px;
        padding-bottom: 10px;
    }

    .collection-tab-button {
        min-width: 118px;
        padding: 9px 12px;
    }
}

.admin-page-frame[data-admin-section="commission_rules"] .commission-rules-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.admin-page-frame[data-admin-section="analytics"] .analytics-events-card {
    align-self: start;
    height: auto;
}

.admin-page-frame[data-admin-section="credentials"] .credentials-shell {
    grid-template-columns: minmax(0, 1fr) 360px;
}

.admin-page-frame[data-admin-section="credentials"] .credentials-side .token-status-grid-compact {
    grid-template-columns: 1fr;
}

.admin-page-frame[data-admin-section="credentials"] .credentials-side .token-status-card strong,
.admin-page-frame[data-admin-section="credentials"] .credentials-side .token-status-card p,
.admin-page-frame[data-admin-section="credentials"] .credentials-side .token-field,
.admin-page-frame[data-admin-section="credentials"] .credentials-side textarea {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.report-submission-queue-table {
    min-width: calc(68 * var(--admin-table-char-width));
    table-layout: auto;
    --admin-action-column-width: var(--admin-action-column-width-dense);
}

.report-submission-queue-table .queue-trade-id,
.report-submission-queue-table .queue-upstream-message {
    min-width: calc(12 * var(--admin-table-char-width));
    overflow-wrap: break-word;
    word-break: normal;
}

.report-submission-queue-table .queue-reporter-name,
.report-submission-queue-table .queue-channel-name {
    min-width: calc(6 * var(--admin-table-char-width));
}

.report-submission-queue-table .queue-uid {
    min-width: calc(6 * var(--admin-table-char-width));
}

.report-submission-queue-table .queue-status-cell,
.report-submission-queue-table .queue-action-cell {
    white-space: nowrap;
}

.token-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.custom-secondary-grid {
    align-items: start;
}

.custom-filter-form {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
}

.custom-admin-table {
    min-width: calc(98 * var(--admin-table-char-width));
    table-layout: auto;
    --admin-action-column-width: var(--admin-action-column-width-wide);
}

.custom-admin-table th:nth-child(1),
.custom-admin-table td:nth-child(1) {
    width: var(--admin-check-column-width);
    min-width: var(--admin-check-column-width);
    padding-left: 8px;
    padding-right: 8px;
}

.custom-admin-table th,
.custom-admin-table td {
    vertical-align: top;
    padding-top: 8px;
    padding-bottom: 8px;
}

.custom-admin-table th {
    white-space: nowrap;
}

.custom-admin-table tbody tr {
    transition: background 160ms ease;
}

.custom-admin-table tbody tr:hover {
    background: var(--table-row-hover);
}

.custom-admin-table td:nth-child(2),
.custom-admin-table td:nth-child(3),
.custom-admin-table td:nth-child(4),
.custom-admin-table td:nth-child(6),
.custom-admin-table td:nth-child(7),
.custom-admin-table td:nth-child(8),
.custom-admin-table td:nth-child(9),
.custom-admin-table td:nth-child(10) {
    min-width: calc(8 * var(--admin-table-char-width));
}

.custom-admin-table th:nth-child(5),
.custom-admin-table td:nth-child(5) {
    min-width: calc(15 * var(--admin-table-char-width));
}

.custom-admin-table th:nth-child(6),
.custom-admin-table td:nth-child(6) {
    min-width: calc(14 * var(--admin-table-char-width));
}

.custom-admin-table td:nth-child(5) .table-readonly-cell strong {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.custom-admin-table td:nth-child(11) {
    min-width: calc(12 * var(--admin-table-char-width));
}

.custom-admin-table td:nth-child(12) {
    min-width: calc(9 * var(--admin-table-char-width));
}

.custom-admin-table td:last-child {
    min-width: var(--admin-action-column-width-wide);
}

.input-full {
    width: 100%;
    min-width: 0;
}

.custom-cell-textarea {
    min-width: calc(14 * var(--admin-table-char-width));
}

.custom-cell-mechanism {
    min-width: calc(14 * var(--admin-table-char-width));
}

.table-readonly-cell {
    display: grid;
    gap: 4px;
    align-content: start;
}

.table-readonly-cell strong {
    line-height: 1.28;
}

.table-link {
    color: var(--text-strong);
    text-decoration: none;
    transition: color 160ms ease, opacity 160ms ease;
}

.table-link:hover,
.table-link:focus-visible {
    color: var(--accent);
}

.table-readonly-cell span {
    color: var(--muted);
}

.table-stack-tight {
    display: grid;
    gap: 2px;
}

.mechanism-trigger {
    width: 100%;
    display: grid;
    gap: 6px;
    padding: 6px 8px;
    text-align: left;
    color: var(--text);
    background: var(--panel-muted);
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
}

.mechanism-text {
    display: -webkit-box;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.42;
    color: var(--muted);
}

.mechanism-edit-link {
    display: inline-flex;
    align-items: center;
    color: var(--accent);
    font-size: 0.78rem;
}

.custom-reward-cell,
.custom-status-cell,
.custom-expire-cell,
.custom-updated-cell {
    display: grid;
    gap: 4px;
    align-content: start;
}

.custom-expire-cell {
    min-width: calc(12 * var(--admin-table-char-width));
    gap: 4px;
}

.custom-expire-note {
    margin: 0;
    line-height: 1.55;
}

.button-recover {
    width: 100%;
    justify-content: center;
    min-height: 34px;
    white-space: nowrap;
}

.admin-modal-dialog-custom-edit {
    width: min(860px, calc(100vw - 40px));
}

.custom-modal-form {
    gap: 18px;
}

.custom-modal-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
}

.custom-modal-actions form,
.custom-modal-actions .button {
    width: 100%;
}

.custom-reward-cell .checkbox-row-inline {
    margin: 0;
}

.custom-updated-cell strong {
    font-size: 0.8rem;
    line-height: 1.2;
}

.custom-row-form {
    display: none;
}

.project-admin-table {
    min-width: calc(93 * var(--admin-table-char-width));
    table-layout: auto;
    --admin-action-column-width: var(--admin-action-column-width-wide);
}

.project-admin-table th:nth-child(1),
.project-admin-table td:nth-child(1) {
    width: var(--admin-check-column-width);
    min-width: var(--admin-check-column-width);
    padding-left: 8px;
    padding-right: 8px;
}

.channel-dictionary-table th:nth-child(1),
.channel-dictionary-table td:nth-child(1) {
    width: var(--admin-check-column-width);
    min-width: var(--admin-check-column-width);
    padding-left: 8px;
    padding-right: 8px;
}

.channel-dictionary-table td:last-child,
.channel-dictionary-table th:last-child {
    width: var(--admin-action-column-width-dense);
    min-width: var(--admin-action-column-width-dense);
}

.users-admin-table th:nth-child(1),
.users-admin-table td:nth-child(1) {
    width: var(--admin-check-column-width);
    min-width: var(--admin-check-column-width);
    padding-left: 8px;
    padding-right: 8px;
}

.project-report-image-manager {
    display: grid;
    gap: 10px;
}

.project-form-layout {
    gap: 16px;
}

.project-form-card {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--section-accent, var(--accent));
    box-shadow: var(--shadow);
}

.project-form-section-standard {
    --section-accent: var(--accent);
}

.project-form-section-money {
    --section-accent: var(--success);
}

.project-form-section-rules {
    --section-accent: var(--warning);
}

.project-form-section-targeting {
    --section-accent: var(--info);
}

.project-form-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.project-form-card-head h3,
.project-form-history-card h3 {
    margin: 0;
}

.project-form-card-head > p {
    max-width: 360px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.project-form-card .input,
.project-form-card select.input,
.project-form-card textarea.input {
    background-color: #fff;
    color: #111827;
    border-color: #d1d5db;
}

.project-form-card .input::placeholder,
.project-form-card textarea.input::placeholder {
    color: #6b7280;
}

.project-form-card .input[readonly],
.project-form-card textarea.input[readonly] {
    background-color: #f8fafc;
    color: #374151;
}

.project-form-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.project-form-section-grid-single {
    grid-template-columns: 1fr;
}

.project-form-flag-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.project-form-flag-grid .checkbox-row {
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--text);
}

.project-range-editor,
.project-items-editor,
.channel-assignment-builder,
.project-link-mode-panel,
.project-cayla-mode-panel,
.project-range-channel-assignment {
    display: grid;
    gap: 12px;
}

.project-link-mode-panel[hidden],
.project-cayla-mode-panel[hidden],
.project-items-editor[hidden],
.project-rule-quick-list[hidden],
.project-inline-dialog[hidden] {
    display: none !important;
}

.project-range-editor-head,
.project-rule-preset-list {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
}

.project-link-mode-switch,
.project-cayla-mode {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, max-content));
    gap: 10px 12px;
    min-width: 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.project-link-mode-switch > span,
.project-cayla-mode > span {
    grid-column: 1 / -1;
    color: var(--text);
    font-weight: 700;
}

.project-range-editor-head {
    justify-content: space-between;
}

.project-range-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
}

.channel-assignment-builder {
    grid-template-columns: minmax(220px, 1.5fr) minmax(140px, 1fr) minmax(140px, 1fr) auto;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-muted);
}

.channel-assignment-builder[data-compact="true"] {
    grid-template-columns: minmax(220px, 1.5fr) minmax(140px, 1fr) auto;
}

.channel-assignment-builder .field-block-wide {
    grid-column: auto;
}

.project-range-channel-assignment {
    padding: 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    background: var(--panel-soft);
}

.project-rule-presets {
    position: relative;
    display: grid;
    justify-items: end;
    gap: 8px;
    min-width: 0;
}

.project-field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.project-field-heading > label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.project-rule-preset-list,
.project-rule-toolbar,
.project-items-dialog-actions,
.project-inline-dialog-actions,
.project-item-summary-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.project-rule-quick-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 4;
    display: grid;
    width: min(360px, calc(100vw - 48px));
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
}

.project-rule-chip {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: flex-start;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-muted);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.project-rule-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.segmented-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-muted);
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 700;
}

.segmented-option input {
    margin: 0;
}

.project-inline-dialog {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: grid;
    place-items: center;
    padding: 24px;
}

.project-inline-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
}

.project-inline-dialog-panel {
    position: relative;
    display: grid;
    width: min(820px, 100%);
    max-height: calc(100dvh - 48px);
    gap: 14px;
    overflow: auto;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 0 24px 72px rgba(15, 23, 42, 0.24);
}

.project-inline-dialog-panel-wide {
    width: min(1040px, 100%);
}

.project-inline-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.project-inline-dialog-head h3 {
    margin: 2px 0 0;
}

.project-rule-designer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.project-items-summary-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-muted);
}

.project-item-summary-list {
    display: grid;
    gap: 8px;
}

.project-item-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
}

.project-item-summary-main {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.project-item-summary-main strong,
.project-item-summary-main span {
    overflow-wrap: anywhere;
}

.project-item-summary-main span {
    color: var(--muted);
    font-size: 12px;
}

.project-report-image-upload {
    padding: 12px;
    border-radius: 16px;
    background: var(--panel-soft);
    border: 1px dashed var(--line-strong);
}

.project-report-image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.project-report-image-item {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px;
    border-radius: 16px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

.project-report-image-item.is-pending-delete {
    opacity: 0.6;
    border-color: rgba(220, 38, 38, 0.18);
    background: rgba(254, 242, 242, 0.9);
}

.project-report-image-item-thumb {
    display: block;
    width: 88px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel-bg);
}

.project-report-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-report-image-item-body,
.project-report-image-item-meta {
    display: grid;
    gap: 6px;
}

.project-report-image-item-meta strong,
.project-report-image-item-meta span {
    line-height: 1.45;
    word-break: break-word;
}

.project-report-image-item-meta span {
    color: var(--muted);
}

.project-report-image-item-controls {
    display: grid;
    gap: 8px;
}

.project-report-image-action-row {
    display: flex;
    gap: 8px;
}

.project-report-image-action-row .button {
    flex: 1 1 auto;
    justify-content: center;
}

.bulk-field {
    min-width: 156px;
}

.bulk-checkbox-row {
    min-height: 36px;
    padding-top: 14px;
}

.product-edit-form {
    display: grid;
    gap: 8px;
}

.product-edit-form-modal {
    gap: 10px;
}

.product-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 8px;
    border-radius: 14px;
    background: var(--panel-muted);
    border: 1px solid var(--line);
}

.product-edit-grid-modal {
    gap: 8px;
}

.field-inline-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.field-inline-controls .input {
    flex: 1 1 auto;
}

.field-inline-controls-wide {
    align-items: stretch;
}

.button-inline-control {
    flex: 0 0 auto;
    min-width: 90px;
    padding: 0 10px;
    white-space: nowrap;
}

.button-inline-control .icon,
.metric-inline .icon {
    width: 0.92rem;
    height: 0.92rem;
}

.project-cayla-orders-table {
    min-width: calc(99 * var(--admin-table-char-width));
    --admin-action-column-width: var(--admin-action-column-width-wide);
}

.project-cayla-orders-table th,
.project-cayla-orders-table td {
    vertical-align: middle;
}

.project-cayla-col-order-no {
    width: calc(20 * var(--admin-table-char-width));
}

.project-cayla-col-project {
    width: calc(16 * var(--admin-table-char-width));
}

.project-cayla-col-product {
    width: calc(8 * var(--admin-table-char-width));
}

.project-cayla-col-title {
    width: calc(13 * var(--admin-table-char-width));
}

.project-cayla-col-reported-title {
    width: calc(13 * var(--admin-table-char-width));
}

.project-cayla-col-uid {
    width: calc(8 * var(--admin-table-char-width));
}

.project-cayla-col-count {
    width: calc(6 * var(--admin-table-char-width));
}

.project-cayla-col-money {
    width: calc(9 * var(--admin-table-char-width));
}

.project-cayla-col-created {
    width: calc(12 * var(--admin-table-char-width));
}

.project-cayla-col-image {
    width: var(--admin-action-column-width-wide);
}

.project-cayla-orders-table td:nth-child(1) strong {
    display: inline-block;
    font-size: 0.96rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.project-cayla-orders-table td:nth-child(2) {
    white-space: nowrap;
}

.project-cayla-orders-table td:nth-child(2),
.project-cayla-orders-table td:nth-child(4),
.project-cayla-orders-table td:nth-child(5) {
    overflow-wrap: break-word;
    word-break: normal;
}

.project-cayla-orders-table td:nth-child(9) .status-pill {
    min-width: calc(11 * var(--admin-table-char-width));
    justify-content: center;
}

.project-cayla-image-preview {
    min-height: 380px;
}

.product-edit-preview {
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 16px;
    background: var(--panel-muted);
    border: 1px solid var(--line);
}

.product-edit-preview img {
    width: 100%;
    max-height: 210px;
    object-fit: contain;
    border-radius: 14px;
    background: var(--panel-soft);
}

.row-disabled td {
    background: var(--disabled-bg);
}

.row-disabled .input,
.row-disabled .textarea,
.row-disabled select {
    color: var(--disabled-text);
    background: var(--disabled-bg);
    border-color: var(--line);
}

.row-disabled .subtext,
.row-disabled .custom-updated-cell strong,
.row-disabled .mechanism-text,
.row-disabled .mechanism-edit-link {
    color: var(--disabled-text);
}

.row-expired td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.row-expired .input,
.row-expired .textarea,
.row-expired select,
.row-expired .mechanism-trigger {
    background: var(--panel-muted);
    border-color: var(--line);
}

.row-expired .button-recover {
    color: var(--accent);
    border-style: solid;
    border-color: var(--line-strong);
}

.row-disabled .table-readonly-cell strong {
    color: var(--muted-strong);
}

.project-reminder-card {
    margin-bottom: 2px;
}

.project-reminder-card .section-note {
    max-width: 62ch;
}

.project-reminder-item {
    gap: 6px;
    padding: 12px 14px;
    border-color: rgba(245, 158, 11, 0.22);
    background:
        linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.02)),
        var(--panel-muted);
}

.project-reminder-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.project-reminder-meta {
    color: var(--muted-strong);
}

.project-reminder-copy {
    color: var(--text-strong);
    line-height: 1.6;
}

.project-reminder-copy-soft {
    color: var(--muted);
}

.project-analytics-grid {
    margin-bottom: 2px;
}

.project-ranking-card {
    gap: 10px;
}

.project-ranking-card .content-group-summary {
    padding: 0;
}

.project-ranking-summary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.project-ranking-card .analytics-list {
    margin-top: 2px;
}

.project-analytics-grid-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.25;
}

.metric-inline-soft {
    color: var(--muted);
}

.history-admin-table {
    min-width: calc(85 * var(--admin-table-char-width));
    table-layout: auto;
}

.history-admin-table th,
.history-admin-table td {
    padding-top: 9px;
    padding-bottom: 9px;
}

.history-admin-table th:nth-child(1),
.history-admin-table td:nth-child(1) {
    width: var(--admin-check-column-width);
    min-width: var(--admin-check-column-width);
    padding-left: 8px;
    padding-right: 8px;
}

.history-admin-table th:nth-child(2),
.history-admin-table td:nth-child(2) {
    width: 36%;
    min-width: calc(33 * var(--admin-table-char-width));
}

.history-admin-table th:nth-child(3),
.history-admin-table td:nth-child(3) {
    width: calc(7 * var(--admin-table-char-width));
    min-width: calc(7 * var(--admin-table-char-width));
}

.history-admin-table th:nth-child(4),
.history-admin-table td:nth-child(4) {
    width: 22%;
    min-width: calc(17 * var(--admin-table-char-width));
}

.history-admin-table th:nth-child(5),
.history-admin-table td:nth-child(5) {
    width: calc(12 * var(--admin-table-char-width));
    min-width: calc(12 * var(--admin-table-char-width));
}

.history-admin-table th:nth-child(6),
.history-admin-table td:nth-child(6) {
    width: calc(11 * var(--admin-table-char-width));
    min-width: calc(11 * var(--admin-table-char-width));
}

.history-admin-table .product-cell {
    gap: 12px;
}

.history-admin-table .product-cell img {
    width: 56px;
    height: 56px;
}

.history-admin-table .product-meta strong {
    margin-bottom: 6px;
    line-height: 1.4;
}

.history-admin-table .product-meta span {
    display: block;
    line-height: 1.5;
}

.promotion-orders-table-shell {
    gap: 10px;
}

.promotion-orders-table {
    min-width: calc(110 * var(--admin-table-char-width));
    --admin-action-column-width: var(--admin-action-column-width-wide);
}

.promotion-orders-table th,
.promotion-orders-table td {
    padding: 9px 10px;
}

.promotion-orders-table th:nth-child(1),
.promotion-orders-table td:nth-child(1) {
    width: var(--admin-check-column-width);
    min-width: var(--admin-check-column-width);
}

.promotion-orders-table th:nth-child(2),
.promotion-orders-table td:nth-child(2) {
    width: calc(8 * var(--admin-table-char-width));
}

.promotion-orders-table th:nth-child(3),
.promotion-orders-table td:nth-child(3) {
    width: calc(15 * var(--admin-table-char-width));
}

.promotion-orders-table th:nth-child(4),
.promotion-orders-table td:nth-child(4) {
    width: calc(11 * var(--admin-table-char-width));
}

.promotion-orders-table th:nth-child(5),
.promotion-orders-table td:nth-child(5) {
    width: calc(20 * var(--admin-table-char-width));
}

.promotion-orders-table th:nth-child(6),
.promotion-orders-table td:nth-child(6) {
    width: calc(14 * var(--admin-table-char-width));
}

.promotion-orders-table th:nth-child(7),
.promotion-orders-table td:nth-child(7) {
    width: calc(14 * var(--admin-table-char-width));
}

.promotion-orders-table th:nth-child(8),
.promotion-orders-table td:nth-child(8) {
    width: calc(10 * var(--admin-table-char-width));
}

.promotion-orders-table th:nth-child(9),
.promotion-orders-table td:nth-child(9) {
    width: calc(12 * var(--admin-table-char-width));
}

.promotion-orders-table th:nth-child(10),
.promotion-orders-table td:nth-child(10) {
    width: var(--admin-action-column-width-wide);
}

.promotion-orders-table .inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.2;
}

.promotion-order-stack {
    display: grid;
    gap: 4px;
    align-content: start;
}

.promotion-order-stack strong {
    line-height: 1.28;
}

.promotion-order-stack span {
    color: var(--muted);
    line-height: 1.36;
}

.promotion-order-product {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
}

.promotion-order-product-media {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--panel-muted);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
}

.promotion-order-product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.promotion-order-product-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 6px;
    color: var(--muted-strong);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--panel-muted) 88%, transparent), color-mix(in srgb, var(--panel-muted) 76%, transparent)),
        linear-gradient(135deg, color-mix(in srgb, var(--neutral-soft) 68%, transparent), transparent 78%);
}

.promotion-order-product-placeholder svg {
    width: 100%;
    height: 100%;
    display: block;
}

.promotion-order-product-placeholder .placeholder-frame {
    fill: color-mix(in srgb, var(--panel) 72%, var(--accent-soft));
    stroke: var(--line-strong);
    stroke-width: 1.6;
}

.promotion-order-product-placeholder .placeholder-surface {
    fill: color-mix(in srgb, var(--panel) 78%, var(--accent-soft));
}

.promotion-order-product-placeholder .placeholder-outline {
    stroke: var(--accent-strong);
    stroke-width: 2.2;
}

.promotion-order-product-placeholder .placeholder-accent {
    stroke: var(--accent-strong);
    stroke-width: 2.2;
}

.promotion-order-product-placeholder .placeholder-dot {
    fill: var(--accent);
}

.promotion-order-product-body {
    min-width: 0;
    display: grid;
    gap: 4px;
    align-content: start;
}

.promotion-order-product-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.38;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
}

.promotion-order-product-shop {
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.35;
}

.promotion-order-product-reported-name {
    display: block;
    max-width: 100%;
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.38;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.promotion-order-product-reported-label {
    font-weight: 600;
}

.promotion-order-product-reported-value {
    overflow-wrap: anywhere;
    word-break: break-all;
}

.promotion-order-status {
    display: grid;
    gap: 5px;
    align-content: start;
}

.promotion-order-status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.promotion-order-status .status-pill {
    padding: 5px 8px;
    font-size: 0.78rem;
}

.promotion-order-status-text {
    color: var(--muted);
    line-height: 1.4;
}

.promotion-orders-table .table-text-ellipsis,
.promotion-orders-table .muted,
.promotion-orders-table .promotion-order-status-text {
    line-height: 1.45;
}

.admin-ai-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
    gap: 12px;
    margin-top: 14px;
    align-items: stretch;
    height: clamp(520px, calc(100vh - 190px), 860px);
    overflow: hidden;
}

.admin-ai-main,
.admin-ai-records {
    min-width: 0;
    border: 1px solid var(--line);
    background: var(--panel-muted);
    border-radius: 18px;
    padding: 14px;
}

.admin-ai-main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}

.admin-ai-header,
.admin-ai-answer-meta,
.admin-ai-message-actions,
.admin-ai-header-actions,
.admin-ai-record-actions,
.admin-ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-ai-header {
    justify-content: space-between;
}

.admin-ai-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-ai-header h3,
.admin-ai-record-group h4,
.admin-ai-markdown h3,
.admin-ai-markdown h4,
.admin-ai-markdown h5,
.admin-ai-markdown h6 {
    margin: 0;
}

.admin-ai-status {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 0.82rem;
    color: var(--muted);
    background: var(--panel);
}

.admin-ai-status.is-ready {
    color: var(--success-text);
    border-color: color-mix(in srgb, var(--success) 38%, var(--line) 62%);
}

.admin-ai-status.is-disabled,
.admin-ai-error {
    color: var(--danger-text);
}

.admin-ai-chat {
    display: grid;
    gap: 12px;
    min-height: 260px;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    align-content: start;
}

.admin-ai-empty {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-height: 150px;
    padding: 16px;
    border: 1px dashed var(--line-strong);
    border-radius: 16px;
    background: var(--panel);
}

.admin-ai-empty > div {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.admin-ai-empty p,
.admin-ai-record p,
.admin-ai-tool-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
    word-break: break-word;
}

.admin-ai-suggestions,
.admin-ai-message-actions {
    flex-wrap: wrap;
}

.admin-ai-suggestions {
    display: flex;
    gap: 8px;
}

.admin-ai-message {
    display: grid;
    gap: 8px;
}

.admin-ai-message.is-pending .admin-ai-answer {
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line) 66%);
}

.admin-ai-question {
    justify-self: end;
    max-width: min(78%, 620px);
    display: grid;
    gap: 4px;
}

.admin-ai-question span {
    justify-self: end;
    color: var(--muted);
    font-size: 0.78rem;
}

.admin-ai-question p {
    margin: 0;
    padding: 10px 12px;
    border-radius: 16px 16px 4px 16px;
    background: var(--accent);
    color: var(--accent-contrast);
    line-height: 1.55;
    word-break: break-word;
}

.admin-ai-answer {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
}

.admin-ai-answer-meta {
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.78rem;
}

.admin-ai-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 8px 10px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 9%, var(--panel) 91%);
    color: var(--text);
}

.admin-ai-message.is-pending .admin-ai-progress .icon {
    animation: admin-ai-spin 1.2s linear infinite;
}

.admin-ai-thought {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
    background: var(--panel-muted);
}

.admin-ai-thought summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 700;
}

.admin-ai-thought-list,
.admin-ai-tool-result-list {
    display: grid;
    gap: 4px;
    margin: 8px 0 0;
    padding-left: 1.15rem;
    color: var(--muted);
    line-height: 1.55;
}

.admin-ai-tool-result-list {
    margin-top: 0;
}

.admin-ai-thought-list li,
.admin-ai-tool-result-list li {
    padding-left: 2px;
    overflow-wrap: anywhere;
}

.admin-ai-tool-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.admin-ai-tool-item {
    display: grid;
    gap: 4px;
    padding: 8px;
    border-radius: 10px;
    background: var(--panel);
    border: 1px solid var(--line);
}

.admin-ai-tool-item span {
    color: var(--muted);
    font-size: 0.78rem;
}

.admin-ai-markdown {
    display: grid;
    gap: 10px;
    line-height: 1.65;
    word-break: break-word;
}

.admin-ai-markdown p,
.admin-ai-markdown ul,
.admin-ai-markdown ol,
.admin-ai-markdown blockquote {
    margin: 0;
}

.admin-ai-markdown ul,
.admin-ai-markdown ol {
    padding-left: 1.2rem;
}

.admin-ai-markdown h3 {
    font-size: 1.05rem;
}

.admin-ai-markdown h4 {
    font-size: 1rem;
}

.admin-ai-markdown h5,
.admin-ai-markdown h6 {
    font-size: 0.94rem;
}

.admin-ai-markdown h6 {
    color: var(--muted);
}

.admin-ai-markdown hr {
    width: 100%;
    height: 1px;
    margin: 2px 0;
    border: 0;
    background: var(--line);
}

.admin-ai-markdown blockquote {
    display: grid;
    gap: 4px;
    padding: 8px 10px;
    border-left: 3px solid color-mix(in srgb, var(--accent) 58%, var(--line) 42%);
    border-radius: 0 10px 10px 0;
    background: color-mix(in srgb, var(--accent) 7%, var(--panel-muted) 93%);
    color: var(--muted);
}

.admin-ai-list-item[data-depth="1"] {
    margin-left: 1.1rem;
}

.admin-ai-list-item[data-ordered="false"] {
    list-style-type: disc;
}

.admin-ai-list-item[data-depth="1"][data-ordered="false"] {
    list-style-type: circle;
}

.admin-ai-list-item[data-depth="2"][data-ordered="false"],
.admin-ai-list-item[data-depth="3"][data-ordered="false"],
.admin-ai-list-item[data-depth="4"][data-ordered="false"],
.admin-ai-list-item[data-depth="5"][data-ordered="false"],
.admin-ai-list-item[data-depth="6"][data-ordered="false"] {
    list-style-type: square;
}

.admin-ai-list-item[data-depth="2"] {
    margin-left: 2.2rem;
}

.admin-ai-list-item[data-depth="3"],
.admin-ai-list-item[data-depth="4"],
.admin-ai-list-item[data-depth="5"],
.admin-ai-list-item[data-depth="6"] {
    margin-left: 3.3rem;
}

.admin-ai-markdown pre {
    margin: 0;
    overflow-x: auto;
    padding: 10px;
    border-radius: 12px;
    background: var(--panel-muted);
    border: 1px solid var(--line);
}

.admin-ai-markdown code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.84rem;
}

.admin-ai-inline-code {
    padding: 1px 5px;
    border-radius: 6px;
    background: var(--panel-muted);
    border: 1px solid var(--line);
}

.admin-ai-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.admin-ai-table-scroll[data-drag-scroll] {
    cursor: grab;
    scrollbar-gutter: stable;
    touch-action: auto;
}

.admin-ai-table-scroll[data-drag-scroll].is-dragging {
    cursor: grabbing;
    user-select: none;
}

@media (hover: none), (pointer: coarse) {
    .admin-ai-table-scroll[data-drag-scroll] {
        cursor: auto;
    }
}

.admin-ai-markdown table {
    width: 100%;
    border-collapse: collapse;
    min-width: max(100%, calc(28 * var(--admin-table-char-width)));
    table-layout: auto;
}

.admin-ai-markdown th,
.admin-ai-markdown td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: normal;
}

.admin-ai-markdown th {
    background: var(--panel-muted);
    font-weight: 700;
}

.admin-ai-composer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    background: var(--panel-muted);
}

.admin-ai-reference-strip {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-ai-reference-card {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(100%, 420px);
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
}

.admin-ai-reference-card span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 0.82rem;
}

.admin-ai-composer .textarea {
    min-height: 76px;
}

.admin-ai-records {
    display: grid;
    gap: 12px;
    align-content: start;
    min-height: 0;
    overflow-y: auto;
}

.admin-ai-record-group {
    display: grid;
    gap: 8px;
}

.admin-ai-record {
    display: grid;
    gap: 4px;
    padding: 10px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--panel-muted) 72%, var(--panel) 28%);
    border: 1px solid var(--line);
}

.admin-ai-record[open] {
    background: var(--panel);
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line) 66%);
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 58%, transparent);
}

.admin-ai-record:not([open]) {
    opacity: 0.86;
}

.admin-ai-record summary {
    display: grid;
    gap: 4px;
    padding: 2px;
    cursor: pointer;
}

.admin-ai-record strong,
.admin-ai-record summary strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.admin-ai-record span {
    color: var(--muted);
    font-size: 0.78rem;
}

.admin-ai-error {
    margin: 0;
    font-weight: 700;
}

@keyframes admin-ai-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .admin-ai-shell {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .admin-ai-main,
    .admin-ai-records {
        max-height: none;
        overflow: visible;
    }

    .admin-ai-chat {
        max-height: min(58vh, 620px);
    }

    .admin-ai-question {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .admin-ai-header,
    .admin-ai-composer {
        grid-template-columns: 1fr;
    }

    .admin-ai-header,
    .admin-ai-composer,
    .admin-ai-header-actions,
    .admin-ai-message-actions {
        align-items: stretch;
    }

    .admin-ai-header,
    .admin-ai-header-actions,
    .admin-ai-message-actions {
        flex-direction: column;
    }
}
