.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    min-width: 0;
}

textarea, input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="time"], select {
    flex: 1;
    min-width: 0;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.72rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

/* Free-text follows the first strong character so a Hebrew UI can hold
   "Rehovot" without reversing the caret, and English can hold Hebrew. */
<textarea, input[type="text"], input[type="search"] {
    unicode-bidi: plaintext;
    text-align: start;
}

/* Empty dir=auto fields compute as LTR, which pins Hebrew placeholders to the
   left. Placeholders follow the UI language; typed text still uses plaintext. */
html[dir="rtl"] textarea::placeholder,
html[dir="rtl"] input[type="text"]::placeholder,
html[dir="rtl"] input[type="search"]::placeholder {
    direction: rtl;
    text-align: right;
    unicode-bidi: isolate;
}

html[dir="ltr"] textarea::placeholder,
html[dir="ltr"] input[type="text"]::placeholder,
html[dir="ltr"] input[type="search"]::placeholder {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}

input[type="email"],
input[type="password"],
input[type="url"],
input[type="tel"],
input[type="time"] {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
}

textarea {
    resize: none;
    max-height: 40vh;
    line-height: 1.4;
}

textarea:focus, input[type="text"]:focus, input[type="search"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="time"]:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea::placeholder, input[type="text"]::placeholder, input[type="search"]::placeholder, input[type="email"]::placeholder, input[type="password"]::placeholder {
    color: var(--placeholder);
}

.btn {
    border: none;
    padding: 0.72rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: filter 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.05s ease;
    font-family: inherit;
    white-space: nowrap;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--accent);
    color: #04121c;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 14px -6px var(--accent-soft);
}

.ask-screen .btn-primary {
    background-color: var(--ask-accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 14px -6px var(--ask-accent-soft);
}

.ask-screen .btn-mic:hover {
    color: var(--ask-accent);
    border-color: var(--ask-accent);
}

.ask-screen .btn-icon-toggle:hover {
    color: var(--ask-accent);
    background-color: var(--ask-accent-soft);
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.07);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 6px 18px -6px var(--accent-soft);
}

.btn-ghost {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 0.9rem;
    font-size: 0.8rem;
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text-main);
    border-color: var(--text-muted);
    background-color: var(--card-bg-hover);
}

.btn-mic {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.72rem 0.85rem;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.btn-mic:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-mic:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-mic.listening {
    color: #fff;
    background-color: #ef4444;
    border-color: #ef4444;
    animation: mic-pulse 1.4s ease-in-out infinite;
}

.input-row--hero textarea {
    border-radius: 22px;
    padding: 0.85rem 1.15rem;
}

.input-row--hero .btn-mic {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.input-row--hero .btn-mic:hover {
    opacity: 0.9;
    color: #fff;
}

.input-row--hero .btn-mic.listening {
    background-color: #ef4444;
    border-color: #ef4444;
}

.input-row--hero .btn-photo {
    background-color: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text-main);
}

.input-row--hero .btn-photo:hover {
    color: var(--accent);
    border-color: var(--accent);
    opacity: 1;
}

.memory-photo-pending {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.35rem 0.15rem;
}

.memory-photo-pending[hidden] {
    display: none;
}

.memory-photo-pending img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: var(--bg-elevated);
}

.memory-photo-pending-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-width: 0;
}

.memory-photo-pending-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.quick-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.65rem;
}

.quick-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-radius: 999px;
    min-width: 0;
    overflow: hidden;
}

.quick-action-icon {
    font-size: 1rem;
    line-height: 1;
}

.quick-action--primary {
    background-color: var(--accent);
    color: #fff;
}

.quick-action--primary:hover {
    opacity: 0.92;
}

.quick-action--ask {
    background-color: var(--ask-accent-soft);
    border: 1px solid var(--ask-accent);
    color: var(--ask-accent);
}

.quick-action--ask:hover {
    background-color: var(--ask-accent);
    color: #04121c;
}

.voice-status {
    display: block;
    min-height: 1.1rem;
    font-size: 0.78rem;
    color: var(--accent);
}

.voice-status.error {
    color: var(--warning);
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.15); }
}
