:root {
    --color-primary: #6c5ce7;
    --color-primary-soft: #f1edff;
    --color-bg: #f5f7fb;
    --color-surface: #ffffff;
    --color-surface-soft: #fafbff;
    --color-border-subtle: #e1e5f0;
    --color-text-main: #1f2430;
    --color-text-muted: #6b7280;
    --color-sidebar-bg: #f8f4ff;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-full: 999px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
    --sidebar-width: 260px;
    --transition-fast: 150ms ease-out;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-main);
    background: radial-gradient(circle at top left, #f3f0ff 0, #f5f7fb 42%, #f9fafb 100%);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
}

.page {
    padding: 24px 32px 32px;
}

.page-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.section-header__meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

.button--primary {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(108, 92, 231, 0.35);
}

.button--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(108, 92, 231, 0.4);
}

.button--primary:disabled,
.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Unavailable, but still able to say why. Reads as disabled and keeps pointer
   events, which `:disabled` above kills — and with them go both the click that
   shows the explanation and the title tooltip. Pair with aria-disabled="true". */
.button--readonly {
    opacity: 0.55;
    cursor: not-allowed;
}

/* .button--primary:hover:not(:disabled) is three selectors and would otherwise
   re-apply the lift; match its weight and win on order. */
.button.button--readonly:hover {
    transform: none;
    box-shadow: none;
}

.button--loading {
    opacity: 0.78;
    pointer-events: none;
}

.button--loading .admin-spinner {
    width: 14px;
    height: 14px;
}

.button--ghost {
    background: #ffffff;
    border-color: var(--color-border-subtle);
    color: var(--color-text-main);
}

.button--sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 6px;
    line-height: 1;
}

.button--ghost.button--danger {
    /* Restate the ghost background: the solid `.button--danger` in pages.css ties on
       specificity and loads later, so without this the label renders red-on-red. */
    background: #ffffff;
    color: #ef4444;
    border-color: #fecaca;
    box-shadow: none;
}

.button--ghost.button--danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.button--success {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
    box-shadow: 0 14px 30px rgba(22, 163, 74, 0.22);
}

.button--success:hover:not(:disabled) {
    background: #15803d;
    border-color: #15803d;
}

.icon-button {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--color-border-subtle);
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    position: relative;
}

.icon-button__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
}

.badge--warning {
    background: #fff7ed;
    color: #ea580c;
}

.badge--info {
    background: #eff6ff;
    color: #2563eb;
}

@media (max-width: 640px) {
    .form-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .table-responsive {
        overflow-x: auto;
    }
}

.text-wrap-anywhere {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.text-ellipsis {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-fixed {
    table-layout: fixed;
}

.loading-label {
    margin-left: 8px;
    color: var(--color-text-muted);
}

.empty-state-row td,
.table-loading-row td {
    padding: 28px 16px;
    color: var(--color-text-muted);
    text-align: center;
}

.inline-state {
    display: flex;
    min-height: 140px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: var(--color-text-muted);
    text-align: center;
}

.inline-state--error {
    color: #dc2626;
}

.ux-confirm-dialog__body {
    margin: 0;
    color: var(--color-text-muted);
}

