/* Theme Studio panel styles. Every host document links this sheet; the panels carry no inline <style>. */

/* ---- Enterprise theme presets ---- */
.enterprise-theme-panel {
    max-width: 100%;
    overflow-x: hidden;
}

.theme-controls {
    position: sticky;
    top: 0;
    z-index: 12;
    background: var(--mud-palette-surface);
    padding: 0 0 0.75rem;
    margin-bottom: 0.35rem;
}

.theme-search {
    margin-bottom: 0.65rem;
}

.theme-search .mud-input-helper-text,
.theme-search .mud-counter-text {
    display: none !important;
}

.theme-filter-row,
.theme-category-scroll {
    display: flex;
    gap: 0.4rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.theme-filter-row {
    margin-bottom: 0.4rem;
}

.theme-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    height: 30px;
    padding: 0 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-background) 65%, var(--mud-palette-surface));
    color: var(--mud-palette-text-primary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.theme-filter-chip:hover {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 40%, var(--mud-palette-lines-default));
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, var(--mud-palette-surface));
}

.theme-filter-chip.active {
    background: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text, #fff) !important;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--mud-palette-primary) 28%, transparent);
}

.theme-filter-chip.active .filter-count,
.theme-filter-chip.active .category-chip-icon {
    color: inherit !important;
    background: color-mix(in srgb, var(--mud-palette-primary-text, #fff) 18%, transparent);
    border-color: transparent;
}

.theme-filter-chip.active .mud-icon-root {
    color: inherit !important;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
    color: var(--mud-palette-primary);
}

.category-chip-btn .category-chip-icon {
    font-size: 0.95rem !important;
    width: 16px !important;
    height: 16px !important;
    color: var(--mud-palette-primary);
}

.theme-category {
    margin-bottom: 1.15rem;
}

.category-header,
.filtered-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.category-header-main {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex: 1;
}

.category-header-icon-wrap {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, var(--mud-palette-surface));
    color: var(--mud-palette-primary);
    flex-shrink: 0;
}

.category-header-icon-wrap .mud-icon-root,
.filtered-heading-icon {
    color: var(--mud-palette-primary) !important;
    font-size: 1rem !important;
}

.category-title,
.filtered-heading-title {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary) !important;
    background: transparent !important;
    line-height: 1.2;
}

.category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, var(--mud-palette-surface));
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 24%, transparent);
}

.category-view-all {
    border: none;
    background: transparent;
    color: var(--mud-palette-primary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
    flex-shrink: 0;
}

.category-view-all:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
}

.enterprise-theme-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.theme-preset-card {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 0;
    border: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-background) 40%, var(--mud-palette-surface)) !important;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
    outline: none;
    color: var(--mud-palette-text-primary);
    min-height: 96px;
}

.theme-preset-card:hover,
.theme-preset-card:focus-visible {
    border-color: color-mix(in srgb, var(--theme-accent, var(--mud-palette-primary)) 50%, var(--mud-palette-lines-default));
    transform: translateY(-1px);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--theme-accent, var(--mud-palette-primary)) 14%, transparent);
    background: color-mix(in srgb, var(--theme-accent, var(--mud-palette-primary)) 7%, var(--mud-palette-surface)) !important;
}

.theme-preset-card:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mud-palette-primary) 40%, transparent);
}

.theme-preset-card.selected {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 11%, var(--mud-palette-surface)) !important;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--mud-palette-primary) 35%, transparent),
                0 6px 16px color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
}

.theme-card-preview {
    display: flex;
    flex-direction: column;
    background: color-mix(in srgb, var(--theme-surface-tint, var(--mud-palette-background)) 55%, var(--mud-palette-surface));
    border-inline-end: 1px solid var(--mud-palette-lines-default);
    min-height: 100%;
}

.theme-preview-bar {
    height: 14px;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0 6px;
}

.theme-preview-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    opacity: 0.85;
}

.theme-preview-body {
    flex: 1;
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 5px;
    padding: 6px;
    min-height: 58px;
}

.theme-preview-sidebar {
    border-radius: 3px;
    opacity: 0.92;
}

.theme-preview-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
}

.theme-preview-line {
    height: 5px;
    width: 62%;
    border-radius: 999px;
    opacity: 0.55;
}

.theme-preview-line.wide {
    width: 88%;
    opacity: 0.4;
}

.theme-preview-chips {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.theme-preview-chips span {
    width: 10px;
    height: 5px;
    border-radius: 999px;
    opacity: 0.75;
}

.theme-card-body {
    padding: 0.65rem 0.75rem 0.7rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.theme-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    margin-bottom: 0.35rem;
}

.theme-swatches {
    display: flex;
    align-items: center;
    gap: 4px;
}

.color-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid color-mix(in srgb, var(--mud-palette-surface) 55%, var(--mud-palette-text-primary));
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}

.theme-active-badge,
.theme-premium-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.theme-active-badge {
    color: var(--mud-palette-success);
    background: color-mix(in srgb, var(--mud-palette-success) 14%, var(--mud-palette-surface));
    border: 1px solid color-mix(in srgb, var(--mud-palette-success) 30%, transparent);
}

.theme-premium-badge {
    color: var(--mud-palette-warning);
    background: color-mix(in srgb, var(--mud-palette-warning) 14%, var(--mud-palette-surface));
    border: 1px solid color-mix(in srgb, var(--mud-palette-warning) 30%, transparent);
}

.theme-title {
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--mud-palette-text-primary) !important;
    background: transparent !important;
    margin-bottom: 0.2rem;
}

.theme-description {
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--mud-palette-text-secondary) !important;
    background: transparent !important;
    opacity: 1 !important;
    margin-bottom: 0.45rem;
    flex: 1;
}

.theme-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.theme-meta-chip {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 0.45rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    background: color-mix(in srgb, var(--mud-palette-text-secondary) 10%, var(--mud-palette-surface));
    border: 1px solid color-mix(in srgb, var(--mud-palette-text-secondary) 20%, transparent);
}

.theme-meta-featured {
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, var(--mud-palette-surface));
    border-color: color-mix(in srgb, var(--mud-palette-primary) 26%, transparent);
}

.theme-empty {
    text-align: center;
    padding: 1.75rem 1rem;
}

.theme-empty-icon-wrap {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.75rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--mud-palette-text-secondary) 10%, var(--mud-palette-surface));
    color: var(--mud-palette-text-secondary);
}

.theme-empty-title {
    font-weight: 700;
    color: var(--mud-palette-text-primary);
    margin-bottom: 0.25rem;
}

.theme-empty-text {
    font-size: 0.78rem;
    color: var(--mud-palette-text-secondary);
}

@media (prefers-reduced-motion: reduce) {
    .theme-preset-card { transition: none; }
    .theme-preset-card:hover,
    .theme-preset-card:focus-visible { transform: none; }
}

.mud-theme-dark .theme-preset-card {
    background: color-mix(in srgb, var(--mud-palette-surface) 90%, var(--mud-palette-background)) !important;
}

.mud-theme-dark .theme-card-preview {
    background: color-mix(in srgb, var(--mud-palette-background) 70%, var(--mud-palette-surface));
}

.mud-theme-dark .theme-description {
    color: color-mix(in srgb, var(--mud-palette-text-secondary) 88%, var(--mud-palette-text-primary)) !important;
}

[dir="rtl"] .theme-preset-card {
    direction: rtl;
}

/* ---- Brand colors ---- */
.color-panel {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
}

.color-panel,
.color-panel * {
    pointer-events: auto !important;
}

.color-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.panel-icon {
    color: var(--mud-palette-primary);
}

.color-panel__current { 
    border: 1px solid var(--mud-palette-divider); 
    border-radius: 8px;
    background: var(--mud-palette-surface);
}

.color-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr)); 
    gap: 6px; 
    margin-bottom: 0.75rem; 
}

.color-button { 
    padding: 0 !important; 
    min-width: 40px !important; 
    width: 40px; 
    height: 40px; 
    border-radius: 8px !important; 
    transition: all .2s ease-in-out; 
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
}

.color-button:hover { 
    transform: scale(1.1); 
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    z-index: 1;
}

.color-button.selected { 
    transform: scale(1.15); 
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    z-index: 2;
}

.color-swatch { 
    width: 100%; 
    height: 100%; 
    border-radius: 6px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.color-swatch-large { 
    width: 44px; 
    height: 44px; 
    border-radius: 8px; 
    border: 2px solid var(--mud-palette-divider); 
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-check-icon { 
    text-shadow: 0 1px 3px rgba(0,0,0,.4);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.font-mono { 
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace; 
}

.custom-color-btn {
    height: 40px;
    min-width: 80px;
}

.color-button:focus-visible { 
    outline: 2px solid var(--mud-palette-primary); 
    outline-offset: 2px; 
}

/* Dark mode */
.mud-theme-dark .color-panel {
    background: rgba(255, 255, 255, 0.02);
}

.mud-theme-dark .color-swatch {
    border-color: rgba(255, 255, 255, 0.1);
}

/* ---- Theme variant ---- */
.theme-variant-panel {
    padding: 0;
    margin-bottom: 1rem;
}

.theme-variant-panel,
.theme-variant-panel * {
    pointer-events: auto !important;
}

.panel-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.variant-options {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.variant-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    background: var(--mud-palette-background);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.variant-card:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
    transform: translateX(4px);
}

.variant-card.active {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
    box-shadow: 0 0 0 2px rgba(var(--mud-palette-primary-rgb), 0.15);
}

[dir="rtl"] .variant-card:hover {
    transform: translateX(-4px);
}

/* Radio Circle */
.variant-radio {
    flex-shrink: 0;
}

.radio-circle {
    width: 18px;
    height: 18px;
    border: 2px solid var(--mud-palette-divider);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.radio-circle.checked {
    border-color: var(--mud-palette-primary);
}

.radio-dot {
    width: 8px;
    height: 8px;
    background: var(--mud-palette-primary);
    border-radius: 50%;
    animation: radio-scale-in 0.2s ease;
}

@keyframes radio-scale-in {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* Icon Box */
.variant-icon-box {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.variant-icon-box.active {
    background: rgba(var(--mud-palette-primary-rgb), 0.12);
}

/* Content */
.variant-content {
    flex-grow: 1;
    min-width: 0;
}

.variant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.125rem;
}

.variant-title {
    line-height: 1.3;
}

.active-chip {
    font-size: 0.6rem !important;
    height: 18px !important;
    padding: 0 6px !important;
}

.variant-description {
    line-height: 1.3;
    font-size: 0.75rem;
}

/* Dark Mode */
.mud-theme-dark .variant-card {
    background: rgba(255, 255, 255, 0.02);
}

.mud-theme-dark .variant-card:hover {
    background: rgba(var(--mud-palette-primary-rgb), 0.08);
}

.mud-theme-dark .variant-icon-box {
    background: rgba(255, 255, 255, 0.05);
}

/* ---- Corner radius ---- */
.radius-panel {
    padding: 0;
}

.radius-panel,
.radius-panel * {
    pointer-events: auto !important;
}

.panel-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--mud-palette-divider);
}

/* Radius Display */
.radius-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.radius-preview-box {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--mud-palette-primary) 0%, var(--mud-palette-primary-darken) 100%);
    border: 2px solid rgba(var(--mud-palette-text-primary-rgb), 0.1);
    flex-shrink: 0;
    transition: border-radius 0.2s ease-in-out;
}

.radius-info {
    flex-grow: 1;
}

.radius-value {
    line-height: 1;
    margin-top: 0.25rem;
}

.radius-unit {
    font-size: 0.6em;
    opacity: 0.7;
    margin-left: 2px;
}

/* Slider Section */
.radius-slider-section {
    margin-bottom: 1.25rem;
}

.radius-slider {
    margin-bottom: 0.25rem;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 0.5rem;
}

.slider-label {
    font-size: 0.65rem;
    color: var(--mud-palette-text-secondary);
}

/* Presets */
.radius-presets {
    margin-bottom: 1.25rem;
}

.presets-label {
    display: block;
    margin-bottom: 0.625rem;
    color: var(--mud-palette-text-secondary);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    background: var(--mud-palette-background);
    cursor: pointer;
    transition: all 0.25s ease;
}

.preset-btn:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
    transform: translateY(-1px);
}

.preset-btn.active {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.08);
    box-shadow: 0 0 0 2px rgba(var(--mud-palette-primary-rgb), 0.2);
}

.preset-preview {
    width: 24px;
    height: 24px;
    background: var(--mud-palette-primary);
    transition: border-radius 0.2s ease;
}

.preset-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.preset-value {
    font-size: 0.6rem;
    color: var(--mud-palette-text-secondary);
}

/* Live Preview */
.live-preview-section {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
    border-bottom: 1px solid var(--mud-palette-divider);
}

.preview-icon {
    color: var(--mud-palette-primary);
}

.preview-title {
    color: var(--mud-palette-primary);
}

.preview-examples {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    padding: 1rem;
}

.preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.preview-card,
.preview-button,
.preview-chip,
.preview-input {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-radius 0.2s ease;
}

.preview-card {
    background: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-divider);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.preview-button {
    background: var(--mud-palette-primary);
    border: none;
    color: white;
    cursor: default;
}

.preview-chip {
    background: var(--mud-palette-secondary);
    color: white;
}

.preview-input {
    background: var(--mud-palette-background);
    border: 2px solid var(--mud-palette-divider);
}

.preview-label {
    font-size: 0.65rem;
    color: var(--mud-palette-text-secondary);
    font-weight: 500;
}

/* Dark Mode */
.mud-theme-dark .radius-display,
.mud-theme-dark .live-preview-section {
    background: rgba(255, 255, 255, 0.02);
}

.mud-theme-dark .preset-btn {
    background: rgba(255, 255, 255, 0.02);
}

.mud-theme-dark .preset-btn:hover {
    background: rgba(var(--mud-palette-primary-rgb), 0.08);
}

@media (max-width: 400px) {
    .presets-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .preview-examples {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Layout ---- */
.layout-panel {
    padding: 0;
}

.layout-panel,
.layout-panel * {
    pointer-events: auto !important;
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.625rem;
}

.section-label {
    display: block;
    color: var(--mud-palette-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.65rem;
}

.preset-active-chip,
.nav-style-chip {
    font-size: 0.6rem !important;
    height: 20px !important;
}

/* Preset Grid */
.layout-presets-section {
    margin-bottom: 1.25rem;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    background: var(--mud-palette-background);
    cursor: pointer;
    transition: all 0.25s ease;
}

.preset-btn:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
    transform: translateY(-1px);
}

.preset-btn.active {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.08);
    box-shadow: 0 0 0 2px rgba(var(--mud-palette-primary-rgb), 0.15);
}

.preset-icon-box {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
    border-radius: 8px;
    transition: all 0.25s ease;
}

.preset-btn.active .preset-icon-box {
    background: rgba(var(--mud-palette-primary-rgb), 0.12);
}

.preset-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.preset-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.preset-desc {
    font-size: 0.6rem;
    color: var(--mud-palette-text-secondary);
}

/* Layout Controls */
.layout-controls-section {
    margin-bottom: 1.25rem;
}

.layout-settings-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.layout-setting-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    background: var(--mud-palette-background);
    cursor: pointer;
    transition: all 0.25s ease;
}

.layout-setting-card:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
}

.layout-setting-card.active {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
}

.setting-icon-box {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
    border-radius: 6px;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.setting-icon-box.active {
    background: rgba(var(--mud-palette-primary-rgb), 0.12);
}

.setting-content {
    flex-grow: 1;
    min-width: 0;
}

.setting-name {
    display: block;
    line-height: 1.3;
}

.setting-desc {
    display: block;
    font-size: 0.65rem;
    line-height: 1.2;
}

.setting-switch {
    flex-shrink: 0;
    margin: 0 !important;
}

/* Navigation Style */
.navigation-style-section {
    margin-bottom: 1rem;
}

.navigation-style-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-style-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    background: var(--mud-palette-background);
    cursor: pointer;
    transition: all 0.25s ease;
}

.nav-style-card:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
    transform: translateX(4px);
}

.nav-style-card.active {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
    box-shadow: 0 0 0 2px rgba(var(--mud-palette-primary-rgb), 0.15);
}

[dir="rtl"] .nav-style-card:hover {
    transform: translateX(-4px);
}

/* Radio Circle */
.nav-radio {
    flex-shrink: 0;
}

.radio-circle {
    width: 16px;
    height: 16px;
    border: 2px solid var(--mud-palette-divider);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.radio-circle.checked {
    border-color: var(--mud-palette-primary);
}

.radio-dot {
    width: 7px;
    height: 7px;
    background: var(--mud-palette-primary);
    border-radius: 50%;
    animation: radio-scale-in 0.2s ease;
}

@keyframes radio-scale-in {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.nav-style-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
    border-radius: 6px;
    flex-shrink: 0;
}

.nav-style-card.active .nav-style-icon {
    background: rgba(var(--mud-palette-primary-rgb), 0.12);
}

.nav-style-content {
    flex-grow: 1;
    min-width: 0;
}

.nav-style-name {
    display: block;
    line-height: 1.3;
}

.nav-style-desc {
    display: block;
    font-size: 0.65rem;
    line-height: 1.2;
}

/* Productivity Tip */
.productivity-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(var(--mud-palette-info-rgb), 0.06);
    border: 1px solid rgba(var(--mud-palette-info-rgb), 0.2);
    border-radius: 8px;
}

.tip-icon {
    flex-shrink: 0;
    color: var(--mud-palette-info);
    margin-top: 1px;
}

.tip-text {
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--mud-palette-text-secondary);
}

/* Dark Mode */
.mud-theme-dark .preset-btn,
.mud-theme-dark .layout-setting-card,
.mud-theme-dark .nav-style-card {
    background: rgba(255, 255, 255, 0.02);
}

.mud-theme-dark .preset-icon-box,
.mud-theme-dark .setting-icon-box,
.mud-theme-dark .nav-style-icon {
    background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 400px) {
    .preset-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- Accessibility ---- */
.accessibility-panel {
    padding: 0;
}

.accessibility-panel,
.accessibility-panel * {
    pointer-events: auto !important;
}

.panel-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.accessibility-settings-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.accessibility-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    background: var(--mud-palette-background);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.accessibility-card:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.accessibility-card.active {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
}

.icon-wrapper {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
    border-radius: 8px;
    transition: all 0.25s ease;
}

.icon-wrapper.active {
    background: rgba(var(--mud-palette-primary-rgb), 0.12);
}

.card-content {
    flex-grow: 1;
    min-width: 0;
}

.card-title {
    line-height: 1.3;
    margin-bottom: 0.125rem;
}

.card-description {
    line-height: 1.3;
    font-size: 0.75rem;
}

.card-control {
    flex-shrink: 0;
}

.accessibility-switch {
    margin: 0 !important;
}

/* Font Scale Section */
.font-scale-section {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.font-scale-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.scale-chip {
    font-size: 0.7rem !important;
    height: 22px !important;
}

.font-scale-slider {
    padding: 0 0.25rem;
}

.font-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.scale-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--mud-palette-text-secondary);
}

.scale-label.current {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}

/* Font Preview Section */
.font-preview-section {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: rgba(var(--mud-palette-info-rgb), 0.08);
    border-bottom: 1px solid var(--mud-palette-divider);
}

.preview-icon {
    color: var(--mud-palette-info);
}

.preview-title {
    color: var(--mud-palette-info);
}

.preview-content {
    padding: 1rem;
}

.preview-heading {
    font-size: calc(1.25rem * var(--preview-scale, 1));
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--mud-palette-text-primary);
}

.preview-body {
    font-size: calc(0.875rem * var(--preview-scale, 1));
    line-height: 1.5;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 0.375rem;
}

.preview-caption {
    font-size: calc(0.75rem * var(--preview-scale, 1));
    color: var(--mud-palette-text-disabled);
}

/* Settings Summary */
.settings-summary {
    background: rgba(var(--mud-palette-info-rgb), 0.06);
    border: 1px solid rgba(var(--mud-palette-info-rgb), 0.2);
    border-radius: 10px;
    padding: 0.875rem;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(var(--mud-palette-info-rgb), 0.15);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    text-align: center;
}

.summary-label {
    font-size: 0.7rem;
    color: var(--mud-palette-text-secondary);
    font-weight: 500;
}

.summary-chip {
    font-size: 0.65rem !important;
    height: 20px !important;
}

/* Dark Mode */
.mud-theme-dark .accessibility-card {
    background: rgba(255, 255, 255, 0.02);
}

.mud-theme-dark .accessibility-card:hover {
    background: rgba(var(--mud-palette-primary-rgb), 0.08);
}

.mud-theme-dark .font-scale-section,
.mud-theme-dark .font-preview-section {
    background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 600px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .summary-item {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* ---- Table customization ---- */
.table-customization-panel {
    padding: 0;
}

.table-customization-panel,
.table-customization-panel * {
    pointer-events: auto !important;
}

.panel-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.settings-section {
    margin-bottom: 1.25rem;
}

.section-label {
    display: block;
    margin-bottom: 0.625rem;
    color: var(--mud-palette-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.65rem;
}

.table-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
}

.table-setting-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    background: var(--mud-palette-background);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.table-setting-card:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
}

.table-setting-card.active {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
}

.setting-icon-box {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
    border-radius: 6px;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.setting-icon-box.active {
    background: rgba(var(--mud-palette-primary-rgb), 0.12);
}

.setting-info {
    flex-grow: 1;
    min-width: 0;
}

.setting-name {
    display: block;
    line-height: 1.3;
}

.setting-status {
    display: block;
    font-size: 0.65rem;
    color: var(--mud-palette-text-secondary);
}

.setting-status.active {
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.setting-switch {
    flex-shrink: 0;
    margin: 0 !important;
}

.pagination-setting {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    padding: 1rem;
}

.pagination-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
}

.page-size-chip {
    font-size: 0.7rem !important;
    height: 22px !important;
}

.page-size-options {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.375rem;
}

.page-size-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    padding: 0.5rem 0.25rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 6px;
    background: var(--mud-palette-background);
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-size-btn:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
}

.page-size-btn.active {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.1);
}

.size-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.default-badge {
    font-size: 0.5rem;
    color: var(--mud-palette-primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table-preview-section {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: rgba(var(--mud-palette-success-rgb), 0.08);
    border-bottom: 1px solid var(--mud-palette-divider);
}

.preview-icon {
    color: var(--mud-palette-success);
}

.preview-title {
    color: var(--mud-palette-success);
}

.preview-table {
    font-size: 0.7rem;
}

.preview-header-row,
.preview-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
}

.preview-header-row {
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.preview-row {
    background: var(--mud-palette-background);
    color: var(--mud-palette-text-secondary);
    transition: background 0.15s ease;
}

.preview-table.dense .preview-header-row,
.preview-table.dense .preview-row {
    padding: 0.375rem 0.875rem;
}

.preview-table.striped .preview-row:nth-child(even) {
    background: rgba(var(--mud-palette-text-primary-rgb), 0.02);
}

.preview-table.bordered .preview-row {
    border-bottom: 1px solid var(--mud-palette-divider);
}

.preview-table.hoverable .preview-row:hover {
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
}

.status-active {
    color: var(--mud-palette-success);
    font-weight: 500;
}

.status-pending {
    color: var(--mud-palette-warning);
    font-weight: 500;
}

.preview-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.875rem;
    background: rgba(var(--mud-palette-text-primary-rgb), 0.02);
    border-top: 1px solid var(--mud-palette-divider);
    font-size: 0.65rem;
}

.pagination-info {
    color: var(--mud-palette-text-secondary);
}

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

.page-btn,
.page-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    color: var(--mud-palette-text-secondary);
}

.page-number.active {
    background: var(--mud-palette-primary);
    color: white;
    font-weight: 600;
}

.settings-summary {
    background: rgba(var(--mud-palette-success-rgb), 0.06);
    border: 1px solid rgba(var(--mud-palette-success-rgb), 0.2);
    border-radius: 10px;
    padding: 0.875rem;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.summary-chip {
    font-size: 0.6rem !important;
    height: 20px !important;
}

.mud-theme-dark .table-setting-card,
.mud-theme-dark .page-size-btn {
    background: rgba(255, 255, 255, 0.02);
}

.mud-theme-dark .pagination-setting,
.mud-theme-dark .table-preview-section {
    background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 400px) {
    .table-settings-grid {
        grid-template-columns: 1fr;
    }

    .page-size-options {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ---- Dark mode ---- */
.appearance-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.appearance-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 4.25rem;
    padding: 0.65rem 0.4rem;
    border-radius: 0.75rem;
    border: 1px solid var(--mud-palette-lines-default, var(--mud-palette-divider));
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.appearance-mode-card:hover {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 45%, var(--mud-palette-lines-default));
    color: var(--mud-palette-text-primary);
}

.appearance-mode-card.is-active {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, var(--mud-palette-surface));
    color: var(--mud-palette-primary);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--mud-palette-primary) 35%, transparent);
    font-weight: 600;
}

.appearance-mode-card span {
    font-size: 0.75rem;
    letter-spacing: 0.01em;
}

.appearance-mode-hint {
    background: var(--mud-palette-background);
}
