:root {
    --bg: #f7f5f0;
    --surface: #ffffff;
    --surface-alt: #f0ede6;
    --primary: #c96442;
    --primary-hover: #b55536;
    --text: #2d2b28;
    --text-secondary: #6b6560;
    --text-muted: #9b9590;
    --border: #e5e0d8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    --font: 'Söhne', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --font-mono: 'Söhne Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Fix: hidden attribute must win over display:flex */
[hidden] { display: none !important; }

/* ── Header ────────────────────────────────────────────── */

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

header h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.2px;
}

.back-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: background 0.1s;
}

.back-btn:hover { background: var(--surface-alt); }

/* ── Main ──────────────────────────────────────────────── */

main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 740px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.view-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.3px;
}

.view-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Buttons ───────────────────────────────────────────── */

.btn {
    padding: 8px 16px;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.12s, border-color 0.12s;
    font-weight: 500;
}

.btn:hover {
    background: var(--surface-alt);
    border-color: var(--text-muted);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
    background: #c0392b;
    color: white;
    border-color: #c0392b;
}

.btn-danger:hover { background: #a93226; border-color: #a93226; }

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font);
    padding: 0;
    font-weight: 500;
}

.btn-text:hover { text-decoration: underline; }

/* ── Item List (Clients / Sessions) ────────────────────── */

.item-list {
    flex: 1;
    overflow-y: auto;
}

.item-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    position: relative;
}

.item-card:hover {
    background: var(--surface-alt);
    border-color: var(--text-muted);
}

.item-menu-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.1s, background 0.1s;
}

.item-card:hover .item-menu-btn { opacity: 1; }
.item-menu-btn:hover { background: var(--border); border-color: var(--border); }

.item-menu {
    position: absolute;
    top: 36px;
    right: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 140px;
    z-index: 10;
    overflow: hidden;
}

.item-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 14px;
    border: none;
    background: none;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    cursor: pointer;
}

.item-menu button:hover { background: var(--surface-alt); }
.item-menu button.menu-danger { color: #c0392b; }
.item-menu button.menu-danger:hover { background: #fdf0ef; }

.item-card .item-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.item-card .item-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.item-card .item-summary {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.status-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 9999px;
}

.status-ready { background: #e8f0e4; color: #3d6b35; }
.status-transcribing { background: #faf0dc; color: #8a6d2b; }
.status-uploading { background: #e4ecf4; color: #3b5e8a; }
.status-failed { background: #f5e0dc; color: #8a3530; }

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state p { font-size: 15px; line-height: 1.6; }

/* ── Chat View ─────────────────────────────────────────── */

.session-info {
    margin-bottom: 12px;
    flex: 0 1 auto;
    min-height: 0;
    overflow: hidden;
}

.session-info .summary-card {
    max-height: min(35vh, 300px);
    overflow-y: auto;
    /* Stops inertial/rubber-band scroll from chaining to the page and,
       in Safari, occasionally firing a synthetic click on the <summary>
       that collapses the card. */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.session-info-toggle {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.session-info-toggle::-webkit-details-marker { display: none; }

.session-info-toggle::before {
    content: "▶";
    font-size: 10px;
    transition: transform 0.15s;
}

.session-info[open] > .session-info-toggle::before {
    transform: rotate(90deg);
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-top: 8px;
}

.summary-header {
    margin-bottom: 8px;
}

.summary-header strong {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}

.transcript-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.summary-card p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.transcript-panel {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.transcript-panel pre {
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: var(--font);
    color: var(--text-secondary);
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    font-size: 15px;
    line-height: 1.65;
    word-wrap: break-word;
}

.message-user {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    align-self: flex-end;
    max-width: 85%;
    color: var(--text);
    white-space: pre-wrap;
}

.message-assistant {
    align-self: flex-start;
    max-width: 100%;
    color: var(--text);
    padding: 4px 0;
}

/* Shown in an empty assistant bubble between sending the user's
   message and receiving the first streamed token. The 250ms fade-in
   delay deliberately avoids a flash on fast responses. */
.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 1.65em;
    opacity: 0;
    animation: thinking-fade-in 0.18s ease-out 0.25s forwards;
}

.thinking-indicator > span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: thinking-bounce 1.2s ease-in-out infinite;
}

.thinking-indicator > span:nth-child(2) { animation-delay: 0.15s; }
.thinking-indicator > span:nth-child(3) { animation-delay: 0.30s; }

@keyframes thinking-fade-in {
    to { opacity: 1; }
}

@keyframes thinking-bounce {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .thinking-indicator { animation-delay: 0s; }
    .thinking-indicator > span { animation: none; opacity: 0.6; }
}

/* ── Rendered markdown inside assistant messages ───────── */

.message-assistant .message-text > *:first-child { margin-top: 0; }
.message-assistant .message-text > *:last-child { margin-bottom: 0; }

.message-assistant .message-text p {
    margin: 0 0 12px 0;
}

.message-assistant .message-text h1,
.message-assistant .message-text h2,
.message-assistant .message-text h3,
.message-assistant .message-text h4,
.message-assistant .message-text h5,
.message-assistant .message-text h6 {
    margin: 20px 0 10px 0;
    line-height: 1.3;
    font-weight: 600;
    color: var(--text);
}
.message-assistant .message-text h1 { font-size: 1.5em; }
.message-assistant .message-text h2 { font-size: 1.3em; }
.message-assistant .message-text h3 { font-size: 1.15em; }
.message-assistant .message-text h4,
.message-assistant .message-text h5,
.message-assistant .message-text h6 { font-size: 1em; }

.message-assistant .message-text ul,
.message-assistant .message-text ol {
    margin: 0 0 12px 0;
    padding-left: 1.5em;
}
.message-assistant .message-text li {
    margin: 4px 0;
}
.message-assistant .message-text li > p {
    margin: 0 0 6px 0;
}

.message-assistant .message-text blockquote {
    margin: 0 0 12px 0;
    padding: 2px 14px;
    border-left: 3px solid var(--border);
    color: var(--text-secondary);
}

.message-assistant .message-text a {
    color: var(--primary, #2563eb);
    text-decoration: underline;
}

.message-assistant .message-text code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.92em;
    background: var(--surface-alt, rgba(0, 0, 0, 0.06));
    padding: 1px 5px;
    border-radius: 4px;
}

.message-assistant .message-text pre {
    margin: 0 0 12px 0;
    padding: 12px 14px;
    background: var(--surface-alt, rgba(0, 0, 0, 0.06));
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9em;
    line-height: 1.5;
}
.message-assistant .message-text pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 1em;
}

.message-assistant .message-text table {
    border-collapse: collapse;
    margin: 0 0 12px 0;
    font-size: 0.95em;
}
.message-assistant .message-text th,
.message-assistant .message-text td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}
.message-assistant .message-text th {
    background: var(--surface-alt, rgba(0, 0, 0, 0.04));
    font-weight: 600;
}

.message-assistant .message-text hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

.message-assistant .message-text strong { font-weight: 600; }
.message-assistant .message-text em { font-style: italic; }

.chat-input-area {
    flex-shrink: 0;
    padding-top: 16px;
    margin-top: auto;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 8px 8px 8px 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-input-wrapper.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 4px;
    transition: background 0.15s, color 0.15s;
}

.attach-btn:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.attach-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#chat-input {
    margin-left: 4px;
}

/* ── Attachment tray ───────────────────────────────────── */

.attachment-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 4px 10px;
}

.attachment-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px 6px 6px;
    font-size: 13px;
    max-width: 260px;
    position: relative;
}

.attachment-chip-preview {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--surface-alt);
    flex-shrink: 0;
}

.attachment-chip-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.attachment-chip-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-right: 18px;
}

.attachment-chip-name {
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-chip-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.attachment-chip-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: var(--text-muted);
    color: white;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.attachment-chip-remove:hover {
    background: var(--text-secondary);
}

.attachment-chip.uploading {
    opacity: 0.6;
}

.attachment-chip.failed {
    border-color: #c94242;
}

/* ── Attachments rendered in chat messages ─────────────── */

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.message-attachments:first-child {
    margin-top: 0;
}

.message-attachment-image {
    max-width: 320px;
    max-height: 320px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: zoom-in;
    display: block;
}

.message-attachment-pdf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    max-width: 280px;
}

.message-attachment-pdf:hover {
    border-color: var(--text-muted);
}

.message-attachment-pdf-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #c94242;
    background: rgba(201, 66, 66, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.message-attachment-pdf-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Image lightbox ────────────────────────────────────── */

.image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 24px;
}

.image-lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 4px;
    cursor: default;
}

.image-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chat-input-wrapper:focus-within {
    border-color: var(--text-muted);
    box-shadow: 0 0 0 1px var(--text-muted);
}

#chat-input {
    flex: 1;
    padding: 6px 0;
    border: none;
    font-size: 15px;
    font-family: var(--font);
    resize: none;
    outline: none;
    background: transparent;
    color: var(--text);
    line-height: 1.5;
}

#chat-input::placeholder { color: var(--text-muted); }

#send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    font-size: 16px;
    border: none;
}

.model-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 26px 6px 12px;
    margin-right: 8px;
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%239b9590' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.15s, color 0.15s;
}

.model-select:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.model-select:focus {
    outline: none;
    border-color: var(--text-muted);
    color: var(--text);
}

/* ── Dialogs ───────────────────────────────────────────── */

dialog {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 28px;
    max-width: 440px;
    width: 90%;
    margin: auto;
}

dialog::backdrop { background: rgba(0, 0, 0, 0.4); }

dialog h3 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

dialog input[type="text"],
dialog input[type="file"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    margin-bottom: 20px;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s;
}

dialog input[type="text"]:focus {
    border-color: var(--text-muted);
    box-shadow: 0 0 0 1px var(--text-muted);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.upload-progress {
    margin-bottom: 20px;
}

.progress-bar {
    height: 4px;
    background: var(--surface-alt);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
}

#upload-status {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Transcription progress (chat view) ────────────────── */

.transcription-progress {
    margin: 16px auto 8px;
    padding: 16px 18px;
    max-width: 640px;
    width: calc(100% - 32px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.transcription-progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.transcription-progress-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.transcription-progress-elapsed {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--surface-alt);
    border-radius: 9999px;
    margin-left: 8px;
}

.transcription-progress-text strong {
    font-size: 14px;
    color: var(--text);
}

.transcription-progress-text span {
    font-size: 12px;
    color: var(--text-muted);
}

.transcription-progress-spinner {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--surface-alt);
    border-top-color: var(--primary);
    animation: tc-spin 0.9s linear infinite;
}

.transcription-progress-bar {
    position: relative;
    height: 4px;
    background: var(--surface-alt);
    border-radius: 2px;
    overflow: hidden;
}

.transcription-progress-bar-fill {
    position: absolute;
    top: 0;
    height: 100%;
    width: 35%;
    border-radius: 2px;
    background: var(--primary);
    animation: tc-indeterminate 1.6s ease-in-out infinite;
}

@keyframes tc-spin {
    to { transform: rotate(360deg); }
}

@keyframes tc-indeterminate {
    0%   { left: -35%; width: 35%; }
    50%  { left: 40%;  width: 45%; }
    100% { left: 100%; width: 35%; }
}

/* ── Auth View ─────────────────────────────────────────── */

.auth-view {
    justify-content: center;
    align-items: center;
    padding-bottom: 80px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 380px;
    width: 100%;
}

.auth-card h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-card input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    margin-bottom: 12px;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s;
}

.auth-card input:focus {
    border-color: var(--text-muted);
    box-shadow: 0 0 0 1px var(--text-muted);
}

.auth-btn {
    width: 100%;
    padding: 11px;
    font-size: 15px;
    margin-top: 4px;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-forgot {
    text-align: right;
    margin: -6px 0 6px;
    font-size: 13px;
}

.auth-error {
    background: #fdf0ef;
    color: #c0392b;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.auth-confirm-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.auth-code-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

#logout-btn {
    font-size: 14px;
}

.auth-back {
    margin-bottom: 20px;
    font-size: 13px;
}

/* ── Settings View ─────────────────────────────────────── */

.settings-view {
    overflow-y: auto;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-bottom: 48px;
}

.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.1px;
}

.settings-section-subtitle {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-top: -8px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.settings-field input[type="text"],
.settings-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-family: var(--font);
    outline: none;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}

.settings-field textarea {
    resize: vertical;
    min-height: 96px;
}

.settings-field input[type="text"]:focus,
.settings-field textarea:focus {
    border-color: var(--text-muted);
    box-shadow: 0 0 0 1px var(--text-muted);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.settings-status {
    font-size: 13px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    color: var(--text-secondary);
}

/* ── Usage stats (settings → Usage section) ───────────── */

.usage-stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.usage-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.usage-stat-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.usage-stat-value {
    font-size: 13.5px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.usage-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-alt);
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width 200ms ease;
    width: 0%;
}

.usage-bar-fill.over-cap {
    background: #b54231;
}

/* ── Admin View ─────────────────────────────────────────── */

.admin-view {
    overflow-y: auto;
    padding-bottom: 48px;
}

.admin-view .view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-month-picker input[type="month"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
}

.admin-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.admin-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.1px;
}

.admin-card-total {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table thead th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12.5px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table .num {
    text-align: right;
}

.admin-transcribe {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 13.5px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.admin-empty {
    color: var(--text-muted);
    font-size: 13.5px;
}

.settings-status-success {
    background: #e8f0e4;
    color: #3d6b35;
}

.settings-status-error {
    background: #fdf0ef;
    color: #c0392b;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Landing View ─────────────────────────────────────── */

.landing-view {
    flex: 1;
    overflow-y: auto;
    background: var(--bg);
}

.landing-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

.landing-nav {
    display: block;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.landing-nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 16px;
}

.landing-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.landing-logo-dot {
    color: var(--primary);
}

.landing-nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.landing-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.landing-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    animation: landing-pulse 2s ease-in-out infinite;
}

@keyframes landing-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.landing-signin-link {
    font-size: 14px;
}

.landing-hero {
    padding: 96px 0 80px;
    text-align: center;
}

.landing-eyebrow {
    display: inline-block;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 9999px;
    margin-bottom: 24px;
}

.landing-h1 {
    font-size: clamp(40px, 6vw, 60px);
    font-weight: 700;
    letter-spacing: -1.2px;
    line-height: 1.1;
    margin-bottom: 24px;
    color: var(--text);
}

.landing-accent {
    color: var(--primary);
}

.landing-subtitle {
    font-size: 19px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.55;
}

.landing-cta-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.landing-cta {
    padding: 12px 24px;
    font-size: 15px;
    text-decoration: none;
    display: inline-block;
}

.landing-section {
    padding: 80px 0;
}

.landing-section-header {
    text-align: center;
    margin-bottom: 56px;
}

.landing-h2 {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.6px;
    margin-bottom: 12px;
    color: var(--text);
}

.landing-section-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.55;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.landing-feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.landing-feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 20px;
}

.landing-feature-card h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.2px;
    color: var(--text);
}

.landing-feature-card p {
    color: var(--text-secondary);
    font-size: 14.5px;
    line-height: 1.6;
}

.landing-flow {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px;
}

.landing-flow-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 32px;
    counter-reset: step;
}

.landing-flow-step {
    counter-increment: step;
}

.landing-flow-step::before {
    content: counter(step);
    display: inline-block;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 28px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}

.landing-flow-step h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.landing-flow-step p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.landing-trust {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
}

.landing-trust h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.landing-trust p {
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto 24px;
    line-height: 1.6;
}

.landing-badge-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.landing-badge {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.landing-contact {
    text-align: center;
    padding: 80px 0;
}

.landing-contact h2 {
    margin-bottom: 16px;
}

.landing-contact p {
    color: var(--text-secondary);
    margin: 0 auto 28px;
    max-width: 520px;
    line-height: 1.6;
}

.landing-footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.landing-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.landing-footer a:hover {
    color: var(--primary);
}

@media (max-width: 640px) {
    .landing-hero { padding: 64px 0 48px; }
    .landing-section { padding: 56px 0; }
    .landing-flow { padding: 32px 24px; }
    .landing-trust { padding: 32px 24px; }
}
