/* ========================================
   Shared AI Tool Styles
   Used by: Story Maker, Podcast Pilot, Course Narrator,
   Language Tutor, IVR Builder, Explainer Video,
   Meditation Studio, Audio Cards
   ======================================== */

@keyframes tool-fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes tool-scale-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes tool-popover-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tool-glow-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* Page layout */
.tool-page {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ── Header ───────────────────────────── */

.tool-creation-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: tool-fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tool-centered-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 2.5rem 0 1rem;
}

.tool-centered-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
    animation: tool-fade-up 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.tool-centered-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: hsl(var(--foreground) / 0.06);
    color: hsl(var(--muted-foreground) / 0.7);
    margin-bottom: 1.25rem;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-centered-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 20px;
    background: hsl(var(--foreground) / 0.03);
    z-index: -1;
    animation: tool-glow-pulse 4s ease-in-out infinite;
}

.tool-centered-title {
    font-family: 'Geist', system-ui, -apple-system, sans-serif;
    font-size: 1.75rem;
    font-weight: 750;
    color: hsl(var(--foreground));
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.03em;
}

.tool-centered-subtitle {
    font-size: 0.85rem;
    color: hsl(var(--muted-foreground) / 0.75);
    margin: 0;
    line-height: 1.7;
    max-width: 420px;
}

/* ── Preset Controls ──────────────────── */

.tool-presets {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    margin-bottom: 1.5rem;
    animation: tool-fade-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.tool-preset-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
}

.tool-preset-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tool-preset-options {
    display: inline-flex;
    background: hsl(var(--secondary));
    border-radius: 0.5rem;
    padding: 3px;
    gap: 2px;
}

.tool-preset-btn {
    padding: 0.35rem 0.7rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tool-preset-btn:hover:not(.active) {
    color: hsl(var(--foreground));
    background: hsl(var(--foreground) / 0.04);
}

.tool-preset-btn.active {
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    box-shadow: 0 1px 4px hsl(0 0% 0% / 0.12);
}

/* ── Main Input ───────────────────────── */

.tool-input-wrapper {
    width: 100%;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 1.25rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    z-index: 10;
    overflow: visible;
    box-shadow: 0 2px 8px hsl(0 0% 0% / 0.04), 0 4px 20px -4px hsl(0 0% 0% / 0.06);
    animation: tool-scale-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
    position: relative;
}

.tool-input-wrapper::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 1.3rem;
    padding: 1px;
    background: linear-gradient(135deg, hsl(var(--foreground) / 0.08), transparent 40%, transparent 60%, hsl(var(--foreground) / 0.04));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tool-input-wrapper:focus-within {
    border-color: hsl(var(--foreground) / 0.15);
    box-shadow: 0 2px 8px hsl(0 0% 0% / 0.06), 0 12px 40px -8px hsl(0 0% 0% / 0.1);
}

.tool-input-wrapper:focus-within::before {
    opacity: 1;
}

.tool-main-input {
    width: 100%;
    padding: 1.25rem 1.25rem 0.5rem;
    background: transparent;
    border: none;
    color: hsl(var(--foreground));
    font-size: 0.925rem;
    font-family: inherit;
    line-height: 1.65;
    resize: none;
    min-height: 88px;
    box-sizing: border-box;
}

.tool-main-input:focus { outline: none; }
.tool-main-input::placeholder { color: hsl(var(--muted-foreground) / 0.4); transition: color 0.2s ease; }
.tool-main-input:focus::placeholder { color: hsl(var(--muted-foreground) / 0.25); }

/* Footer — single flat row: [settings] [controls...] [generate] */
.tool-input-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.375rem 0.625rem 0.625rem 0.625rem;
    gap: 0.4rem;
}

.tool-input-hint {
    font-size: 0.7rem;
    color: hsl(var(--muted-foreground) / 0.6);
    white-space: nowrap;
}

/* ── Language Picker (Language Tutor) ──── */

.tutor-lang-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.tutor-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: hsl(var(--secondary));
    border: 1.5px solid transparent;
    border-radius: 2rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tutor-lang-btn:hover:not(.active) {
    color: hsl(var(--foreground));
    border-color: hsl(var(--border));
}

.tutor-lang-btn.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.tutor-lang-flag {
    font-size: 1rem;
    line-height: 1;
}

/* ── IVR Language Dropdown ────────────── */

.ivr-lang-opt {
    display: block;
    width: 100%;
    padding: 0.4rem 0.65rem;
    background: transparent;
    border: none;
    border-radius: 0.35rem;
    color: hsl(var(--foreground));
    font-size: 0.78rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.ivr-lang-opt:hover { background: hsl(var(--secondary)); }

.ivr-lang-opt.active {
    background: hsl(var(--primary) / 0.12);
    color: hsl(var(--primary));
    font-weight: 600;
}

/* ── Footer Dropdown Buttons ──────────── */

.tool-footer-dropdown {
    position: relative;
}

.tool-footer-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.55rem;
    background: hsl(var(--secondary));
    border: none;
    border-radius: 0.4rem;
    color: hsl(var(--foreground));
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tool-footer-dropdown-btn:hover {
    background: hsl(var(--secondary) / 0.8);
}

.tool-footer-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: hsl(var(--popover));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    padding: 0.25rem;
    z-index: 999;
    min-width: 130px;
    box-shadow: 0 4px 16px hsl(0 0% 0% / 0.2);
}

.tool-footer-menu.open { display: block; }

.tool-footer-menu-item {
    display: block;
    width: 100%;
    padding: 0.4rem 0.65rem;
    background: transparent;
    border: none;
    border-radius: 0.35rem;
    color: hsl(var(--foreground));
    font-size: 0.78rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.tool-footer-menu-item:hover { background: hsl(var(--secondary)); }

.tool-footer-menu-item.active {
    background: hsl(var(--primary) / 0.12);
    color: hsl(var(--primary));
    font-weight: 600;
}

/* ── Inline Duration/Size Toggle ──────── */

.tool-inline-toggle {
    display: inline-flex;
    background: hsl(var(--secondary));
    border-radius: 0.4rem;
    padding: 2px;
    gap: 1px;
}

.tool-inline-btn {
    padding: 0.3rem 0.55rem;
    background: transparent;
    border: none;
    border-radius: 0.3rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tool-inline-btn:hover:not(.active) { color: hsl(var(--foreground)); }

.tool-inline-btn.active {
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    box-shadow: 0 1px 3px hsl(0 0% 0% / 0.1);
}

/* ── Settings Dropdown ────────────────── */

.tool-settings-dropdown { position: relative; margin-right: auto; }

.tool-settings-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.6rem;
    background: hsl(var(--foreground) / 0.03);
    border: 1px solid hsl(var(--border) / 0.6);
    border-radius: 0.5rem;
    color: hsl(var(--muted-foreground) / 0.8);
    font-size: 0.725rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tool-settings-toggle:hover {
    color: hsl(var(--foreground));
    border-color: hsl(var(--foreground) / 0.12);
    background: hsl(var(--foreground) / 0.06);
}

.tool-settings-toggle svg:first-child { opacity: 0.45; transition: opacity 0.2s ease; }
.tool-settings-toggle:hover svg:first-child { opacity: 0.7; }
.tool-settings-label { font-size: 0.725rem; }

/* Backdrop + Popover */
.tool-settings-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
}
.tool-settings-backdrop.open { display: block; }

.tool-settings-popover {
    position: fixed;
    min-width: 250px;
    border-radius: 0.875rem;
    padding: 0.875rem;
    z-index: 9999;
    display: none;
    flex-direction: column;
    gap: 0.875rem;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 12px 40px rgba(0,0,0,0.08);
}

.tool-settings-popover[data-theme="dark"] {
    background-color: #1a1a1a;
    border-color: #2a2a2a;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 12px 40px rgba(0,0,0,0.4);
}

.tool-settings-popover.open {
    display: flex;
    animation: tool-popover-in 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tool-settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.tool-settings-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-left: 0.1rem;
}

.tool-model-options,
.tool-format-options {
    display: flex;
    background: hsl(var(--secondary));
    border-radius: 0.5rem;
    padding: 3px;
    gap: 2px;
}

.tool-model-opt,
.tool-format-opt {
    flex: 1;
    padding: 0.4rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.tool-model-opt:hover:not(.active),
.tool-format-opt:hover:not(.active) {
    color: hsl(var(--foreground));
    background: hsl(var(--foreground) / 0.04);
}

.tool-model-opt.active,
.tool-format-opt.active {
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    box-shadow: 0 1px 4px hsl(0 0% 0% / 0.12);
}

/* ── Generate Button ──────────────────── */

.tool-generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.15rem;
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    border: none;
    border-radius: 0.625rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.tool-generate-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, hsl(var(--background) / 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.4s ease;
}

.tool-generate-btn:hover:not(:disabled)::before {
    transform: translateX(100%);
}

.tool-generate-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px hsl(0 0% 0% / 0.15);
}

.tool-generate-btn:active:not(:disabled) {
    transform: scale(0.97);
    box-shadow: none;
}

.tool-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.tool-gen-text,
.tool-gen-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.tool-gen-loading .spinner {
    animation: spin 1s linear infinite;
}

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

/* ── Status Message ───────────────────── */

.tool-status-message {
    width: 100%;
    max-width: 680px;
    margin: 0.75rem auto 0;
    padding: 0.7rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.8rem;
    text-align: center;
    animation: tool-fade-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tool-status-message.success {
    background: hsl(142 71% 45% / 0.08);
    color: hsl(142 71% 40%);
    border: 1px solid hsl(142 71% 45% / 0.15);
}

.tool-status-message.error {
    background: hsl(0 72% 51% / 0.08);
    color: hsl(0 72% 51%);
    border: 1px solid hsl(0 72% 51% / 0.15);
}

/* ── Script Preview ───────────────────── */

.tool-script-preview {
    width: 100%;
    margin-top: 1.25rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border) / 0.7);
    border-radius: 1rem;
    overflow: hidden;
    animation: tool-scale-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    box-shadow: 0 2px 12px hsl(0 0% 0% / 0.04);
}

.tool-script-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border) / 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: hsl(var(--foreground) / 0.02);
}

.tool-script-title {
    font-family: 'Geist', system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 650;
    color: hsl(var(--foreground));
    margin: 0;
    letter-spacing: -0.015em;
}

.tool-script-meta {
    font-size: 0.675rem;
    color: hsl(var(--muted-foreground) / 0.65);
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
}

.tool-script-lines {
    display: flex;
    flex-direction: column;
    max-height: 400px;
    overflow-y: auto;
}

.tool-script-line {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border) / 0.3);
    transition: background 0.2s ease;
}

.tool-script-line:last-child { border-bottom: none; }
.tool-script-line:hover { background: hsl(var(--foreground) / 0.015); }

.tool-script-speaker {
    font-size: 0.675rem;
    font-weight: 700;
    min-width: 70px;
    padding-top: 0.5rem;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: hsl(var(--muted-foreground) / 0.7);
}

.tool-script-text {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    color: hsl(var(--foreground));
    font-size: 0.85rem;
    font-family: inherit;
    line-height: 1.55;
    padding: 0.35rem 0.5rem;
    resize: none;
    transition: all 0.2s ease;
}

.tool-script-text:focus {
    outline: none;
    border-color: hsl(var(--border));
    background: hsl(var(--secondary) / 0.5);
}

.tool-script-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-top: 0.25rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: hsl(var(--muted-foreground) / 0.4);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.tool-script-remove:hover {
    color: hsl(0 72% 51%);
    background: hsl(0 72% 51% / 0.08);
}

.tool-script-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid hsl(var(--border) / 0.4);
    background: hsl(var(--foreground) / 0.015);
}

.tool-script-discard {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid hsl(var(--border) / 0.6);
    border-radius: 0.5rem;
    color: hsl(var(--muted-foreground) / 0.7);
    font-size: 0.775rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-script-discard:hover {
    color: hsl(0 72% 55%);
    border-color: hsl(0 72% 55% / 0.3);
    background: hsl(0 72% 55% / 0.05);
}

.tool-script-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.15rem;
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    border: none;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-script-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px hsl(0 0% 0% / 0.15);
}

.tool-script-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Suggestion Chips ─────────────────── */

.tool-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.75rem;
    animation: tool-fade-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.tool-suggestion-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.05rem;
    background: hsl(var(--foreground) / 0.03);
    border: 1px solid hsl(var(--border) / 0.7);
    border-radius: 2rem;
    color: hsl(var(--muted-foreground) / 0.85);
    font-size: 0.775rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.tool-suggestion-chip:hover {
    color: hsl(var(--foreground));
    border-color: hsl(var(--foreground) / 0.2);
    background: hsl(var(--foreground) / 0.06);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px hsl(0 0% 0% / 0.06);
}

.tool-suggestion-chip:active { transform: scale(0.96) translateY(0); }

/* ── History Section ──────────────────── */

.tool-history {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 1px solid hsl(var(--border) / 0.5);
    animation: tool-fade-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.tool-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.tool-history-header h3 {
    font-size: 0.9rem;
    font-weight: 650;
    color: hsl(var(--foreground));
    letter-spacing: -0.01em;
}

.tool-history-header .view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.775rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    transition: all 0.2s ease;
}

.tool-history-header .view-all-link:hover {
    color: hsl(var(--foreground));
}

.tool-history-header .view-all-link:hover svg {
    transform: translateX(2px);
    transition: transform 0.2s ease;
}

.tool-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tool-history-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: hsl(var(--muted-foreground) / 0.6);
    font-size: 0.85rem;
}

.tool-history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.125rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border) / 0.7);
    border-radius: 0.875rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-history-item:hover {
    border-color: hsl(var(--foreground) / 0.12);
    background: hsl(var(--foreground) / 0.02);
    transform: translateY(-1px);
    box-shadow: 0 2px 12px hsl(0 0% 0% / 0.06);
}

.tool-history-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.625rem;
    background: hsl(var(--secondary));
    color: hsl(var(--muted-foreground) / 0.65);
    flex-shrink: 0;
}

.tool-history-info { flex: 1; min-width: 0; }

.tool-history-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.tool-history-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.2rem;
    font-size: 0.725rem;
    color: hsl(var(--muted-foreground) / 0.65);
}

.tool-status-badge {
    display: inline-flex;
    padding: 0.15rem 0.45rem;
    border-radius: 0.3rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tool-status-badge.completed { background: hsl(142 71% 45% / 0.1); color: hsl(142 71% 45%); }
.tool-status-badge.processing { background: hsl(45 100% 51% / 0.1); color: hsl(45 100% 45%); }
.tool-status-badge.failed { background: hsl(0 72% 51% / 0.1); color: hsl(0 72% 55%); }
.tool-status-badge.cancelled { background: hsl(var(--muted-foreground) / 0.1); color: hsl(var(--muted-foreground)); }

.tool-history-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.tool-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    background: transparent;
    border: 1px solid hsl(var(--border) / 0.5);
    color: hsl(var(--muted-foreground) / 0.6);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.tool-action-btn:hover {
    color: hsl(var(--foreground));
    border-color: hsl(var(--foreground) / 0.15);
    background: hsl(var(--secondary));
    transform: translateY(-1px);
}

/* ── Responsive ───────────────────────── */

@media (max-width: 900px) {
    .tool-input-right {
        gap: 0.3rem;
    }
    .tool-inline-toggle {
        gap: 0;
    }
    .tool-inline-btn {
        padding: 0.25rem 0.45rem;
        font-size: 0.65rem;
    }
}

@media (max-width: 640px) {
    .tool-presets { gap: 0.75rem; }
    .tool-suggestions { gap: 0.3rem; }
    .tool-suggestion-chip { font-size: 0.7rem; padding: 0.4rem 0.75rem; }
    .tutor-lang-picker { gap: 0.35rem; }
    .tutor-lang-btn { padding: 0.35rem 0.65rem; font-size: 0.72rem; }
}
