/**
 * imgcreator - Multi-Backend Image Generation Gateway
 * Modern Native Dark Theme Stylesheet
 */

:root {
    --bg-app: #0d1117;
    --bg-surface: #161b22;
    --bg-subtle: #21262d;
    --bg-hover: #30363d;
    --border-color: #30363d;
    --border-subtle: #21262d;
    
    --text-primary: #c9d1d9;
    --text-heading: #f0f6fc;
    --text-muted: #8b949e;
    --text-link: #58a6ff;
    
    --color-primary: #238636;
    --color-primary-hover: #2ea043;
    --color-primary-active: #196c2e;
    
    --color-info: #388bfd;
    --color-success: #3fb950;
    --color-warning: #d29922;
    --color-danger: #f85149;
    --color-danger-hover: #da3633;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition-fast: 0.15s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    margin: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    font-weight: 600;
    line-height: 1.25;
}

p {
    margin-bottom: 0.5rem;
}

a {
    color: var(--text-link);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: #090d13;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #e6edf3;
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 100%;
}

code {
    padding: 0.2rem 0.4rem;
    word-break: break-all;
    overflow-wrap: anywhere;
    display: inline-block;
    max-width: 100%;
}

pre {
    padding: 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-width: 100%;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-sm {
    font-size: 0.85rem;
}

/* Icons */
.menu-icon-sm {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
}

.menu-icon-lg {
    width: 36px;
    height: 36px;
}

/* App Wrapper */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Top Navigation Bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
    flex-wrap: wrap;
    min-height: 58px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #238636, #2ea043);
    border-radius: 8px;
    color: #ffffff;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.5px;
}

.brand-badge {
    background-color: rgba(56, 139, 253, 0.15);
    color: var(--color-info);
    border: 1px solid rgba(56, 139, 253, 0.3);
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 2px 0;
    max-width: 100%;
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    min-height: 44px;
}

.nav-tab:hover {
    color: var(--text-heading);
    background-color: var(--bg-subtle);
}

.nav-tab.active {
    color: #ffffff;
    background-color: var(--color-primary);
    font-weight: 600;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
    margin: 0 0.25rem;
}

.admin-tab {
    color: #a371f7;
}
.admin-tab:hover {
    color: #d2a8ff;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.85rem;
}

.user-dot {
    width: 8px;
    height: 8px;
    background-color: var(--color-success);
    border-radius: 50%;
}

.role-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
}
.role-admin {
    background-color: rgba(163, 113, 247, 0.2);
    color: #d2a8ff;
    border: 1px solid rgba(163, 113, 247, 0.4);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.55rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    text-decoration: none;
    min-height: 44px; /* Touch accessibility invariant */
    box-sizing: border-box;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
    border-color: rgba(240, 246, 252, 0.1);
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
    color: #ffffff;
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background-color: var(--bg-hover);
    color: var(--text-heading);
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}
.btn-ghost:hover {
    background-color: var(--bg-subtle);
    color: var(--text-heading);
    text-decoration: none;
}

.btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: var(--color-danger-hover);
    color: #ffffff;
}

.btn-success {
    background-color: var(--color-success);
    color: #ffffff;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    min-height: 44px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 0.4rem;
    width: 44px;
    height: 44px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.4;
}

.badge-pulse {
    background: rgba(35, 134, 54, 0.15);
    color: #3fb950;
    border: 1px solid rgba(35, 134, 54, 0.3);
}

.badge-success {
    background-color: rgba(63, 185, 80, 0.15);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.badge-info {
    background-color: rgba(56, 139, 253, 0.15);
    color: #58a6ff;
    border: 1px solid rgba(56, 139, 253, 0.3);
}

.badge-warning {
    background-color: rgba(210, 153, 34, 0.15);
    color: #e3b341;
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.badge-danger {
    background-color: rgba(248, 81, 73, 0.15);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.badge-secondary {
    background-color: var(--bg-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-heading);
}

.form-control {
    background-color: #090d13;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-heading);
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
    min-height: 44px;
}

.form-control:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.form-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.col-6 {
    flex: 1 1 calc(50% - 0.75rem);
    min-width: 220px;
}

.input-with-action {
    display: flex;
    gap: 0.4rem;
}

.toggle-group {
    display: flex;
    gap: 0.4rem;
    background-color: #090d13;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px;
}

.toggle-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 4px;
    padding: 0.45rem 0.5rem;
    color: var(--text-muted);
    min-height: 40px;
}

.toggle-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.toggle-pill:has(input:checked) {
    background-color: var(--bg-subtle);
    color: #ffffff;
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Login Card View */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 1rem;
}

.login-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
    max-width: 420px;
    width: 100%;
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #238636, #2ea043);
    border-radius: 16px;
    color: #ffffff;
    margin-bottom: 1rem;
}

.login-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

/* Studio Layout */
.studio-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.5rem;
    align-items: start;
}

.studio-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.prompt-textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.5;
}

/* Preview Monitor */
.preview-container {
    background-color: #090d13;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    text-align: center;
    padding: 2rem;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    width: 100%;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-bar-container {
    width: 80%;
    max-width: 320px;
    height: 6px;
    background-color: var(--bg-subtle);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-bar-fill {
    width: 30%;
    height: 100%;
    background-color: var(--color-primary);
    animation: pulse-progress 1.5s ease-in-out infinite;
}

@keyframes pulse-progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.preview-result {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.result-img {
    max-width: 100%;
    max-height: 480px;
    object-fit: contain;
    border-radius: 4px;
}

.result-overlay {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.result-meta {
    display: flex;
    gap: 0.4rem;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

/* Error Notification Card in Preview Monitor */
.preview-error {
    width: 100%;
    max-width: 520px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background-color: rgba(248, 81, 73, 0.08);
    border: 1px solid rgba(248, 81, 73, 0.35);
    border-radius: var(--border-radius);
    margin: 1rem;
    box-sizing: border-box;
}

.error-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.preview-error h4 {
    margin: 0.25rem 0 0.5rem;
    color: var(--color-danger);
    font-size: 1.15rem;
}

.error-message-box {
    width: 100%;
    background-color: #0d1117;
    border: 1px solid rgba(248, 81, 73, 0.25);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    max-height: 180px;
    overflow-y: auto;
    text-align: left;
    box-sizing: border-box;
}

.error-text {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: #ff7b72;
    line-height: 1.5;
    word-break: break-all;
    overflow-wrap: anywhere;
    margin: 0;
}

.error-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.gallery-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.gallery-card:hover {
    transform: translateY(-2px);
    border-color: #58a6ff;
}

.gallery-thumb-wrap {
    height: 200px;
    background-color: #090d13;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-card-body {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.4rem;
}

.gallery-prompt {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-heading);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

/* Quota & Analytics */
.quota-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.metric-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 1rem;
}

.gauge-wrapper {
    width: 130px;
    height: 130px;
    margin: 0 auto;
}

.circular-gauge {
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: var(--bg-subtle);
    stroke-width: 8;
}

.gauge-bar {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 264;
    stroke-dashoffset: 264;
    transition: stroke-dashoffset 0.6s ease;
}

.gauge-text {
    transform: rotate(9deg);
    transform-origin: center;
    font-size: 13px;
    fill: var(--text-heading);
    font-weight: 700;
    text-anchor: middle;
}

.effective-counts {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.effective-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.effective-val {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-heading);
}

.effective-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.metric-footer {
    margin-top: auto;
    padding-top: 0.75rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.25rem;
}

.chart-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
}

.chart-card h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.analytics-canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* Documentation */
.docs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.doc-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}

.doc-card h3 {
    margin-bottom: 0.75rem;
}

/* Data Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    -webkit-overflow-scrolling: touch;
}

.table-responsive .data-table {
    width: max-content;
    min-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table th {
    background-color: var(--bg-subtle);
    color: var(--text-heading);
    font-weight: 600;
    white-space: nowrap;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Audit Logs Filter & Pagination Styles */
.audit-filter-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.audit-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1 1 140px;
    min-width: 130px;
}

.filter-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    min-width: 140px;
}

.ip-badge {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    display: inline-block;
    background-color: #090d13;
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: #79c0ff;
    letter-spacing: 0.2px;
}

.audit-data-table td {
    padding: 0.65rem 0.85rem;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pagination-info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-xs {
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    height: auto;
    min-height: 32px;
}

.select-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
    height: auto;
    min-height: 32px;
    background-color: var(--bg-base);
    color: var(--text-base);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Responsive Audit Table vs Cards */
.audit-cards-mobile {
    display: none;
}

@media (max-width: 900px) {
    .audit-table-desktop {
        display: none !important;
    }
    .audit-cards-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
        width: 100%;
        max-width: 100%;
    }
    .audit-card-item {
        background-color: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        padding: 0.9rem 1rem;
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .audit-card-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .audit-card-meta {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem 0.75rem;
        font-size: 0.82rem;
        background-color: #090d13;
        padding: 0.6rem 0.75rem;
        border-radius: 6px;
    }
    .audit-card-meta-item {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
    }
    .audit-card-details {
        font-size: 0.8rem;
        word-break: break-word;
        overflow-wrap: anywhere;
        background-color: rgba(255, 255, 255, 0.02);
        padding: 0.5rem;
        border-radius: 4px;
        border: 1px solid var(--border-subtle);
    }
    .audit-card-action {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding-top: 0.25rem;
    }
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.alert-danger {
    background-color: rgba(248, 81, 73, 0.15);
    border: 1px solid rgba(248, 81, 73, 0.4);
    color: #ff7b72;
}

.alert-success {
    background-color: rgba(63, 185, 80, 0.15);
    border: 1px solid rgba(63, 185, 80, 0.4);
    color: #56d364;
}

.token-copy-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #090d13;
    padding: 0.5rem;
    border-radius: 6px;
    margin-top: 0.5rem;
}
.token-copy-box code {
    flex: 1;
    overflow-x: auto;
}

/* Responsive Rules for Mobile (Pixel 5 & 393px) */
@media (max-width: 900px) {
    .studio-grid {
        grid-template-columns: 1fr;
    }
    .topbar {
        padding: 0.6rem 0.75rem;
        gap: 0.5rem;
    }
    .brand {
        flex: 1;
    }
    .user-controls {
        flex: 0 0 auto;
    }
    .nav-tabs {
        order: 3;
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        overflow-x: hidden;
    }
    .nav-tab {
        flex: 1 1 calc(33.333% - 6px);
        min-width: 100px;
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
        justify-content: center;
    }
    .nav-divider {
        display: none;
    }
    .login-card {
        padding: 1.5rem 1rem;
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 0.75rem;
    }
    .col-6 {
        flex: 1 1 100%;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
}
