/* Visual-only skin for the tool directory and four translation workspaces.
   Existing styles retain geometry, visibility, RTL and interaction behavior. */
body.ui-refined {
    --ref-ink: #242424;
    --ref-muted: #646460;
    --ref-line: #deded9;
    --ref-soft: #f5f5f2;
    --glass-border: #deded9;
    --glass-fill: rgba(255, 255, 255, .9);
    --glass-blur: blur(18px) saturate(110%);
    --glass-shadow: 0 4px 16px rgba(24, 24, 22, .06);
    --glass-edge: none;
    --tools-page: #fafaf8;
    --tools-surface-soft: #f5f5f2;
    --tools-text: #242424;
    --tools-muted: #646460;
    --tools-border: #deded9;
    --tools-blue: #242424;
    --tools-blue-hover: #444440;
    --tools-blue-soft: #efefeb;
    --tools-focus: #716b5e;
    --page: #fafaf8;
    --surface-soft: #f5f5f2;
    --ink: #242424;
    --muted: #646460;
    --line: #deded9;
    --line-strong: #c9c9c2;
    --blue: #30302d;
    --blue-soft: #efefeb;
    --green: #755317;
    --green-soft: #fbf3df;
    --shadow: 0 8px 28px rgba(24, 24, 22, .1);
    color: var(--ref-ink);
    background: #fafaf8 !important;
    accent-color: #30302d;
    caret-color: #30302d;
    scrollbar-color: #c9c9c2 #fafaf8;
}
body.ui-refined ::selection { background: #e5dfcf; color: #242424; }

/* Translucency is reserved for navigation and the floating listening dock. */
body.ui-refined :is(.navbar, .topbar, .control-dock-inner) {
    background: var(--glass-fill) !important;
    border-color: var(--ref-line) !important;
    box-shadow: 0 2px 10px rgba(24, 24, 22, .04) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}
body.ui-refined :is(.topbar, .control-dock-inner) { border-radius: 14px; }
body.ui-refined .navbar :is(.navbar-brand, .nav-link, .text-light) { color: var(--ref-ink) !important; }
body.ui-refined :is(.tool-card, .result-container, .text-panel, .text-section, .image-upload-section, .turn) {
    background: #fff !important;
    border-color: var(--ref-line) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}
body.ui-refined :is(.tool-card-header, .panel-header, .language-selector, .turn-meta, .modal-header, .modal-footer, .modal-head, .modal-actions) {
    color: var(--ref-muted);
    background: var(--ref-soft) !important;
    border-color: var(--ref-line) !important;
    box-shadow: none !important;
}
body.ui-refined .language-selector { border-radius: 10px; }
body.ui-refined :is(.text-content, .text-content-wrapper, .tool-card-body, .cell) { background-color: #fff; }
body.ui-refined :is(.modal-content, .dropdown-menu, .modal) {
    background: #fff;
    border-color: var(--ref-line);
    border-radius: 12px !important;
    box-shadow: 0 12px 36px rgba(24, 24, 22, .12) !important;
}

/* One quiet secondary style; primary, selected and destructive states follow. */
body.ui-refined :is(.btn, .action-btn, .icon-button, .toolbar-button, .secondary-button, .primary-button, .turn-action, .custom-file-picker, .image-preview-toggle) {
    color: var(--ref-ink) !important;
    background: #fff !important;
    border-color: var(--ref-line) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    text-shadow: none;
    transition: background-color 140ms ease, border-color 140ms ease;
}
body.ui-refined :is(.btn, .action-btn, .icon-button, .toolbar-button, .secondary-button, .turn-action, .custom-file-picker, .image-preview-toggle):hover:not(:disabled):not(.disabled) {
    background: #f0f0ed !important;
    border-color: #bdbdb6 !important;
    transform: none;
}
body.ui-refined :is(.btn-primary, .btn-success, .primary-button, .listen-button, .direct-invite-button) {
    color: #fff !important;
    background: #292927 !important;
    border-color: #292927 !important;
    box-shadow: none !important;
}
body.ui-refined :is(.btn-primary, .btn-success, .primary-button, .listen-button, .direct-invite-button):hover:not(:disabled):not(.disabled) {
    background: #444440 !important;
    border-color: #444440 !important;
}
body.ui-refined :is(.btn-outline-danger, .btn-danger, .listen-button.on) {
    color: #a12e37 !important;
    background: #fff0f1 !important;
    border-color: #e7bdc1 !important;
    box-shadow: none !important;
}
body.ui-refined :is(.btn-outline-danger, .btn-danger, .listen-button.on):hover:not(:disabled) {
    background: #f9e1e4 !important;
    border-color: #cc939a !important;
}
body.ui-refined :is(.context-prompt-btn.has-prompt, .auto-play-btn.enabled, .auto-play-button.active, .icon-button[aria-pressed="true"], .btn.active) {
    color: #755317 !important;
    background: #fbf3df !important;
    border-color: #c9ad72 !important;
}
body.ui-refined :is(.btn, .action-btn, .icon-button, .toolbar-button, .secondary-button, .primary-button, .listen-button):active:not(:disabled) {
    box-shadow: inset 0 1px 3px rgba(24, 24, 22, .12) !important;
    transform: none;
}
body.ui-refined :is(.btn, .action-btn, .icon-button, .toolbar-button, .secondary-button, .primary-button, .listen-button):is(:disabled, .disabled) {
    color: #777772 !important;
    background: #efefec !important;
    border-color: #e1e1dc !important;
    box-shadow: none !important;
    opacity: 1;
}
body.ui-refined :is(.form-control, .form-select, .custom-select, .speaker-language-picker, .context-field textarea, .term-form input, .term-form select) {
    color: var(--ref-ink);
    background-color: #fff;
    border-color: var(--ref-line);
    border-radius: 8px;
    box-shadow: none;
}
body.ui-refined :is(input, textarea)::placeholder { color: #6b6b65; opacity: 1; }
body.ui-refined input::file-selector-button {
    color: var(--ref-ink);
    background: #f0f0ed;
    border-color: var(--ref-line);
}
body.ui-refined :is(button, a, input, select, textarea, summary):focus-visible {
    outline: 2px solid #716b5e !important;
    outline-offset: 3px;
}
body.ui-refined .dropdown-item:is(:hover, :focus, .active) { color: #242424; background: #efefeb; }
/* Preserve the joined corners of Bootstrap input groups. */
body.ui-refined .input-group > :not(:first-child) { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
body.ui-refined .input-group > :not(:last-child) { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }

/* Directory: remove candy-colored icon tiles and blue feature-card emphasis. */
body.ui-refined.tools-page .tools-grid > .tool-card {
    background: #fff !important;
    border-color: var(--ref-line) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}
body.ui-refined.tools-page .tools-grid > .tool-card:hover {
    background: #f5f5f2 !important;
    border-color: #bdbdb6 !important;
    transform: none;
}
body.ui-refined.tools-page .tool-icon {
    color: #444440 !important;
    background: #f2f2ef !important;
    border-color: transparent;
    border-radius: 10px !important;
    box-shadow: none !important;
}
body.ui-refined.tools-page .tools-brand-icon { background: #292927; border-color: #292927; box-shadow: none; border-radius: 8px; }
body.ui-refined.tools-page .tools-heading p { border-left-color: #deded9; }
body.ui-refined.tools-page .tool-chevron { color: #777772; }
body.ui-refined.tools-page .tools-footer { background: #fafaf8 !important; }

/* Results retain readable, opaque surfaces and semantic status distinctions. */
body.ui-refined .result-empty { color: #646460 !important; }
body.ui-refined :is(.processing-panel-translation, .translated-result-section, #translatedText, .cell.target) {
    background-color: #fafaf7;
    border-color: var(--ref-line);
}
body.ui-refined :is(.empty-icon, .direct-section-count) { color: #646460; background: #f0f0ed; box-shadow: none; border-color: var(--ref-line); }
body.ui-refined .empty-state strong { color: #30302d; }
body.ui-refined .empty-languages { color: #646460; }
body.ui-refined .speaker-language-picker { background: #fff; border-color: #c9c9c2; border-radius: 10px; box-shadow: none; }
body.ui-refined .speaker-language-picker-source { background: #f4f4f0; }
body.ui-refined .cell.translation-preview { background: #f5f5f2; }
body.ui-refined .cell.translation-stale { background: #fff8e9; }
body.ui-refined .cell.translation-failed { background: #fff0f1; }
body.ui-refined .context-modal-hint { background: #f5f5f2; border-color: var(--ref-line); color: #646460; }

@media (prefers-reduced-transparency: reduce) {
    body.ui-refined { --glass-fill: #fff; --glass-blur: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    body.ui-refined { --glass-fill: #fff; }
}
@media (prefers-reduced-motion: reduce) {
    body.ui-refined :is(.btn, .action-btn, .tool-card, .icon-button) { transition: none; }
}

body.ui-refined.tools-page .tools-grid > .tool-card[href="/realtime-transcription"] {
    border-color: var(--ref-line) !important;
}
body.ui-refined .form-check-input:checked { background-color: #30302d; border-color: #30302d; }

/* Shared chrome spans the viewport independently of each page's content width. */
body.ui-refined { --ref-nav-gutter: clamp(12px, 1.5vw, 24px); color-scheme: light; }
body.ui-refined .navbar { padding-inline: 0; }
body.ui-refined .navbar > :is(.container, .container-fluid),
body.ui-refined.tools-page .tools-navbar .container-fluid,
body.ui-refined .topbar-inner {
    width: 100%;
    max-width: none;
    margin-inline: 0;
    padding-inline: var(--ref-nav-gutter);
}
body.ui-refined.glass-realtime .topbar { margin-inline: 0; border-radius: 0; }
body.ui-refined :is(.group-nav, .header-inner) { padding-inline: var(--ref-nav-gutter); max-width: none; }
body.ui-refined .navbar :is(.btn, .nav-link),
body.ui-refined .topbar .icon-button,
body.ui-refined .group-nav > a,
body.ui-refined .group-nav > div > a {
    border-radius: 8px !important;
    color: #41413d !important;
    background: transparent !important;
    box-shadow: none !important;
}
body.ui-refined .navbar :is(.btn, .nav-link):hover,
body.ui-refined .topbar .icon-button:hover,
body.ui-refined .group-nav a:hover { background: #efefeb !important; }
body.ui-refined .navbar-toggler { border-color: #deded9; color: #41413d; }
body.ui-refined .navbar-dark .navbar-toggler-icon { filter: invert(1); }

/* Account, management and secondary tools share quiet surfaces. Semantic
   badges, notices, totals and validation colors deliberately keep their colors. */
body.ui-refined :is(.card, .profile-card, .login-card, .group-panel, .asr-result-pane, .room-card) {
    border-color: var(--ref-line);
    border-radius: 12px;
    background-color: #fff;
    background-image: none;
    box-shadow: none;
}
body.ui-refined :is(.card-header, .profile-tabs, .input-group-text) {
    background: #f5f5f2;
    border-color: var(--ref-line);
}
body.ui-refined .profile-avatar { color: #646460; background: #efefeb; box-shadow: none; }
body.ui-refined .profile-container { box-shadow: none; }
body.ui-refined :is(.nav-tabs, .profile-tabs) .nav-link {
    border-radius: 8px;
    box-shadow: none;
    color: #646460;
}
body.ui-refined :is(.nav-tabs, .nav-pills, .profile-tabs) .nav-link.active {
    color: #815919;
    background: #fff5dc;
    border-color: #ddc99c;
    box-shadow: none;
}
body.ui-refined :is(.btn-outline-primary, .btn-link):not(:disabled):not(.disabled) { color: #235f91 !important; }
body.ui-refined :is(.btn-outline-success, .btn-outline-warning, .btn-warning):not(:disabled):not(.disabled) {
    color: #815919 !important;
    background: #fff7e5 !important;
    border-color: #d9c391 !important;
}
body.ui-refined :is(.btn-info, .btn-outline-info):not(:disabled):not(.disabled) {
    color: #235f91 !important;
    background: #edf5fb !important;
    border-color: #b9d0e1 !important;
}
body.ui-refined .form-control:is(:disabled, [readonly]) { background-color: #f0f0ed; }
body.ui-refined .form-control.is-invalid { border-color: #b64040; }
body.ui-refined .form-control.is-valid { border-color: #7e9668; }
body.ui-refined .form-control:focus { border-color: #8b8372; box-shadow: none; }
body.ui-refined :is(.page-link, .list-group-item.active) { border-color: #deded9; }
body.ui-refined .page-item.active .page-link { color: #fff; background: #30302d; border-color: #30302d; }

/* Participant identity must remain visible independently of translation
   language and direction. Pending/error states always take precedence. */
body.ui-refined.glass-realtime .turn.is-mine { border-color: #e4d6b7 !important; }
body.ui-refined.glass-realtime .turn.is-peer { border-color: #cedce7 !important; }
body.ui-refined.glass-realtime .turn.is-mine .turn-meta { background: #f8f0df !important; border-color: #e4d6b7 !important; }
body.ui-refined.glass-realtime .turn.is-peer .turn-meta { background: #edf3f8 !important; border-color: #cedce7 !important; }
body.ui-refined.glass-realtime .turn.is-mine .turn-speaker { color: #815919; }
body.ui-refined.glass-realtime .turn.is-peer .turn-speaker { color: #315e86; }
body.ui-refined.glass-realtime .turn.is-mine .cell.speaker-side { background: #fdfaf3; }
body.ui-refined.glass-realtime .turn.is-peer .cell.speaker-side { background: #f8fafc; }
body.ui-refined.glass-realtime .turn.is-mine .cell:not(.speaker-side):not(.translation-stale):not(.translation-preview):not(.translation-failed) { background: #fbf4e5; }
body.ui-refined.glass-realtime .turn.is-peer .cell:not(.speaker-side):not(.translation-stale):not(.translation-preview):not(.translation-failed) { background: #f0f6fb; }
body.ui-refined.glass-realtime .topbar .icon-button[aria-pressed="true"] { color: #815919 !important; background: #fff5dc !important; border-color: #ddc99c !important; }

/* Public offers retain price and offer accents; only material and controls
   join the shared system. Its shadow variable is a color, not a shadow list. */
body.ui-refined.refined-deals {
    --shadow: rgba(24, 24, 22, .06);
    --card-radius: 12px;
    --control-radius: 8px;
    --surface: #fff;
    --surface-strong: #f5f5f2;
}
body.ui-refined.refined-deals :is(.hero-coupon-button, .claim-button, .state-primary-button, .coupon-success button) {
    color: #fff;
    background: #30302d;
    border-radius: 8px;
    box-shadow: none;
}
body.ui-refined.refined-deals :is(.location-button, .state-secondary-button) { border-color: #deded9; border-radius: 8px; box-shadow: none; }

/* Custom speech controls do not use Bootstrap's .btn classes. */
body.ui-refined :is(.tts-action-btn, .tts-preview-btn, .tts-download-btn) {
    border-radius: 8px;
    box-shadow: none;
    background-image: none;
}
body.ui-refined :is(.tts-generate-btn, .tts-preview-btn, .tts-download-btn) { color: #fff; background: #30302d; border-color: #30302d; }
body.ui-refined :is(.tts-generate-btn, .tts-preview-btn, .tts-download-btn):hover:not(:disabled) { background: #444440; }
body.ui-refined .tts-reset-btn { color: #41413d; background: #fff; border-color: #deded9; }
body.ui-refined :is(.tts-action-btn, .tts-preview-btn):disabled { color: #777772; background: #efefec; box-shadow: none; }
body.ui-refined .voice-mode-toggle input:checked + label { color: #815919; background: #fff5dc; box-shadow: none; }
body.ui-refined :is(.tts-card, .tts-actions) { border-color: #deded9; box-shadow: none; border-radius: 12px; }
body.ui-refined .navbar .btn-link:not(:disabled):not(.disabled) { color: #41413d !important; }

/* Shortcut setup uses its own action classes. */
body.ui-refined :is(.primary-action, .secondary-action, .danger-action, .swap-button, .pairing-copy-button, .prompt-inspect-button) {
    border-radius: 8px;
    box-shadow: none;
    background-image: none;
}
body.ui-refined .primary-action { color: #fff; background: #30302d; border-color: #30302d; }
body.ui-refined .primary-action:hover:not(:disabled) { background: #444440; }
body.ui-refined .secondary-action { color: #41413d; background: #fff; border-color: #deded9; }
body.ui-refined .danger-action { color: #a12e37; background: #fff0f1; border-color: #e7bdc1; }
body.ui-refined :is(.primary-action, .secondary-action):disabled { color: #777772; background: #efefec; border-color: #e1e1dc; }

@media (max-width: 767.98px) {
    body.ui-refined .navbar > .container-fluid > .navbar-nav.ms-auto { align-items: flex-end; }
}
