:root {
    --depth-1: #060d1a;
    --depth-2: #0a1628;
    --depth-3: #112240;
    --depth-4: #1e3a5f;
    
    --current-1: #2d6a9f;
    --current-2: #4a9fd4;
    
    --foam-1: #cce7ff;
    --foam-2: #8ab8d8;
    
    --biolum: #00d4aa;
    --phosphor: #f0a500;
    --coral: #e05c5c;
    --salt: #ffffff;

    /* Shared in-app control size. Width follows label; height stays fixed.
       Excluded: .security-panel-close, .btn-copy-hash, .tag-chip,
       .tag-chip-remove, .password-toggle-btn, .password-modal-close,
       .toast-dismiss, .toast-action, .icon-button. */
    --control-font: 0.875rem;
    --control-line: 1.25;
    --control-pad-y: 0.4rem;
    --control-pad-x: 0.9rem;
    --control-height: 2.25rem;
}

/* Hash value display (SHA-256) in shares list */
.stat-item-hash {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.hash-value {
    font-family: monospace;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
    display: inline-block;
    vertical-align: middle;
    color: var(--foam-2);
    flex: 1 1 0;
    min-width: 0;
}

.btn-copy-hash {
    background-color: var(--depth-4);
    color: var(--salt);
    border: none;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.btn-copy-hash:hover {
    background-color: var(--current-1);
}

/* File metadata modal */
.metadata-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: color-mix(in srgb, var(--depth-1) 80%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.metadata-modal {
    background-color: var(--depth-3);
    border: 1px solid var(--depth-4);
    border-radius: 8px;
    padding: 2rem;
    max-width: 580px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px color-mix(in srgb, var(--depth-1) 80%, transparent);
    animation: modalSlideIn 0.2s ease-out;
}

.metadata-modal h3 {
    color: var(--salt);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--depth-4);
    padding-bottom: 0.75rem;
}

.metadata-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
    font-size: 0.9rem;
}

.metadata-label {
    color: var(--foam-2);
    min-width: 110px;
    flex-shrink: 0;
    font-weight: 500;
}

.metadata-value {
    color: var(--foam-1);
    word-break: break-all;
    flex: 1;
}

.metadata-value.monospace {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--foam-1);
}

.metadata-copy-btn {
    background-color: var(--depth-4);
    color: var(--salt);
    border: none;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.metadata-copy-btn:hover {
    background-color: var(--current-1);
}

.metadata-modal-close {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.metadata-modal-close button {
    min-height: var(--control-height);
    padding: var(--control-pad-y) var(--control-pad-x);
}

.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
}

.toast-dismiss {
    background: none;
    border: none;
    color: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    min-height: 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.7;
    box-shadow: none;
    transform: none;
}

.toast-dismiss:hover {
    opacity: 1;
    background: none;
    box-shadow: none;
    transform: none;
}

.toast-action {
    background: color-mix(in srgb, currentColor 16%, transparent);
    border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
    color: inherit;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    min-height: 0;
    min-width: 0;
    box-shadow: none;
    transform: none;
}

.toast-action:hover {
    background: color-mix(in srgb, currentColor 28%, transparent);
    box-shadow: none;
    transform: none;
}

a {
    color: var(--current-2);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--salt);
    text-decoration: underline;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--depth-1);
    color: var(--foam-1);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1, h2, h3 {
    color: var(--salt);
    margin-bottom: 1rem;
}

.auth-section, .file-section, .modal-content, .totp-setup-form, .pending-approval-section, .progress-modal, .share-form-container .card, .ui-preview {
    background: var(--depth-3);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px color-mix(in srgb, var(--depth-4) 30%, transparent);
    border: 1px solid var(--depth-4);
}

.login-form p,
.register-form p {
    margin-top: 0.75rem;
}

input, textarea, .totp-input, .password-modal-input, .contact-value, .contact-label, .contact-type {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 2px solid var(--depth-4);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--depth-2);
    color: var(--foam-1);
}

input::placeholder {
    color: var(--foam-2);
    opacity: 0.7;
}

input:focus, .totp-input:focus {
    outline: none;
    border-color: var(--current-2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--current-2) 20%, transparent);
}

/* Custom File Input */
input[type="file"] {
    display: none;
}

.file-input-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: var(--control-pad-y) var(--control-pad-x);
    background-color: var(--depth-2);
    color: var(--salt);
    border: 2px solid var(--current-2);
    border-radius: 6px;
    font-size: var(--control-font);
    font-weight: 600;
    line-height: var(--control-line);
    min-height: var(--control-height);
    box-sizing: border-box;
    width: auto;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.file-input-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.file-input-row .file-input-label {
    margin-bottom: 0;
}

.selected-files-list {
    margin: 0 0 1rem 0;
    padding: 0.75rem 1rem;
    background-color: var(--depth-2);
    border: 1px solid var(--depth-4);
    border-radius: 6px;
    max-height: 12rem;
    overflow-y: auto;
}

.selected-files-list .selected-files-count {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: var(--foam-2);
}

.selected-files-list ul {
    margin: 0;
    padding-left: 1.25rem;
}

.selected-files-list li {
    color: var(--salt);
    font-size: 0.9rem;
}

.selected-files-list .selected-files-more {
    list-style: none;
    margin-left: -1.25rem;
    color: var(--foam-2);
    font-style: italic;
}

.upload-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.75rem;
}

.file-input-label:hover {
    background-color: var(--depth-4);
    border-color: var(--salt);
}

.file-input-label.has-file {
    border-color: var(--biolum);
    color: var(--biolum);
}

.file-input-name {
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--foam-2);
    margin-left: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

/* Select Elements */
select, .password-modal-select, .contact-type {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--depth-2);
    color: var(--foam-1);
    border: 2px solid var(--depth-4);
    border-radius: 6px;
    padding: 0.75rem;
    padding-right: 2.5rem;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238ab8d8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px 8px;
    transition: border-color 0.2s ease;
}

select:focus, .password-modal-select:focus, .contact-type:focus {
    outline: none;
    border-color: var(--current-2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--current-2) 20%, transparent);
}

select:hover, .password-modal-select:hover, .contact-type:hover {
    border-color: var(--current-1);
}

/* Radio and Checkbox Inputs */
input[type="radio"],
input[type="checkbox"] {
    display: inline-block;
    width: auto;
    margin: 0;
    margin-bottom: 0;
    padding: 0;
    accent-color: var(--current-2);
    cursor: pointer;
}

.btn, button:not(.password-toggle-btn):not(.tag-chip):not(.tag-chip-remove):not(.security-panel-close):not(.btn-copy-hash):not(.hero-btn):not(.password-modal-close):not(.icon-button):not(.toast-dismiss):not(.toast-action), .share-action-btn, .share-list-refresh, .secondary-button, .danger-button, .btn-primary, .btn-secondary, .logout-btn, .nav-link, .remove-contact-btn, .cancel-button, .progress-modal .cancel-button, .password-modal-btn {
    padding: var(--control-pad-y) var(--control-pad-x);
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--control-font);
    font-weight: 600;
    line-height: var(--control-line);
    min-height: var(--control-height);
    box-sizing: border-box;
    width: auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: none;
    background-color: var(--current-1);
    color: var(--foam-1);
}

button:not(.password-toggle-btn):not(.tag-chip):not(.tag-chip-remove):not(.security-panel-close):not(.btn-copy-hash):not(.hero-btn):not(.password-modal-close):not(.icon-button):not(.toast-dismiss):not(.toast-action):hover, .btn-primary:hover, .share-action-btn:hover, .share-list-refresh:hover, .secondary-button:hover {
    background-color: color-mix(in srgb, var(--current-1) 70%, var(--depth-1));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--current-1) 30%, transparent);
}

.danger-button, .logout-btn, .share-action-btn.delete, .share-action-btn.revoke {
    background-color: var(--current-1);
    color: var(--foam-1);
}

.btn-secondary, .secondary-button, .remove-contact-btn, .progress-modal .cancel-button {
    background-color: var(--depth-2);
    color: var(--salt);
    border: 2px solid var(--depth-4);
}

.btn-secondary:hover, .secondary-button:hover, .remove-contact-btn:hover, .progress-modal .cancel-button:hover {
    background-color: var(--depth-1);
    border-color: var(--current-2);
}

.logout-link {
    background-color: color-mix(in srgb, var(--coral) 15%, var(--depth-3));
    color: var(--coral);
    border: 2px solid var(--coral);
}

.logout-link:hover {
    background-color: color-mix(in srgb, var(--coral) 25%, var(--depth-3));
    color: var(--salt);
}

.hidden {
    display: none;
}

.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;
}

.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--coral);
    color: var(--depth-1);
    padding: 1rem;
    border-radius: 6px;
    z-index: 1100;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--coral) 30%, transparent);
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
    word-wrap: break-word;
}

.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--biolum);
    color: var(--depth-1);
    padding: 1rem;
    border-radius: 6px;
    z-index: 1100;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--biolum) 30%, transparent);
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
    word-wrap: break-word;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.files-list {
    margin-top: 2rem;
}

/*
 * Custom always-visible scrollbar: Firefox overlay scrollbars cannot be kept
 * painted via scrollbar-color alone. Hide the native bar and draw a permanent
 * depth-4 rail + biolum thumb beside #filesList.
 */
.files-list-scroll-shell {
    --files-list-scrollbar-size: 12px;
    display: flex;
    align-items: stretch;
    max-height: 80vh;
    border: 1px solid var(--depth-4);
    border-radius: 8px;
    overflow: hidden;
    background: var(--depth-1);
}

#filesList {
    flex: 1 1 auto;
    min-width: 0;
    max-height: 80vh;
    overflow-y: scroll;
    overflow-x: hidden;
    /* Hide native scrollbar in all engines; custom rail/thumb stays visible */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#filesList::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.files-list-scrollbar {
    flex: 0 0 var(--files-list-scrollbar-size);
    width: var(--files-list-scrollbar-size);
    background: var(--depth-4);
    position: relative;
    cursor: pointer;
}

.files-list-scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    min-height: 24px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--biolum) 75%, var(--depth-4));
    border: 2px solid var(--depth-4);
    box-shadow: 0 0 6px color-mix(in srgb, var(--biolum) 30%, transparent);
    cursor: grab;
    box-sizing: border-box;
    /* Position with top (not transform) for natural scrolling */
    will-change: top, height;
    touch-action: none;
}

.files-list-scrollbar-thumb:hover,
.files-list-scrollbar-thumb.is-dragging {
    background: var(--biolum);
    cursor: grabbing;
}

.file-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.file-list-toolbar .selection-count {
    color: var(--foam-2);
    font-size: 0.9rem;
}

.file-list-load-status {
    padding: 0.5rem 0;
    color: var(--foam-2);
    font-size: 0.875rem;
    text-align: center;
}

.file-item .file-select {
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.decrypt-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--depth-2);
    border: 1px solid var(--depth-4);
    border-radius: 4px;
    color: var(--foam-2);
    font-size: 0.9rem;
}

.decrypt-banner button {
    white-space: nowrap;
    background: var(--current-1);
    color: var(--salt);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.decrypt-banner button:hover {
    background: var(--current-2);
}

.file-item {
    background-color: var(--depth-2);
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-item button {
    width: auto;
    margin-left: 1rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
    min-width: 0;
    flex-shrink: 1;
    flex-wrap: wrap;
}

.file-tags,
.edit-tags-chips,
.tag-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

/* Option A: biolum outline chips -- smaller labels, not action buttons */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.3;
    background-color: transparent;
    color: var(--biolum);
    border: 1px solid var(--biolum);
    cursor: pointer;
    width: auto;
    margin: 0;
    box-shadow: none;
    transform: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tag-chip:hover {
    background-color: color-mix(in srgb, var(--biolum) 14%, transparent);
    border-color: var(--biolum);
    color: var(--biolum);
    box-shadow: none;
    transform: none;
}

.tag-chip-remove {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0 0.1rem;
    margin: 0;
    width: auto;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1;
    box-shadow: none;
    transform: none;
}

.tag-chip-remove:hover {
    background: transparent;
    box-shadow: none;
    transform: none;
}

.tag-filter-bar {
    margin: 0.75rem 0 1rem;
    padding: 0.75rem 1rem;
    background: var(--depth-2);
    border: 1px solid var(--depth-4);
    border-radius: 4px;
}

.tag-filter-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foam-1);
}

.tag-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tag-filter-match-all {
    font-size: 0.85rem;
    color: var(--foam-2);
}

.tag-filter-combobox {
    position: relative;
    min-width: 12rem;
    flex: 1 1 12rem;
}

.tag-filter-combobox input,
.upload-tags-row input,
.edit-tags-add-row input,
.edit-tags-replace-row input {
    width: 100%;
}

.tag-filter-suggestions {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    background: var(--depth-2);
    border: 1px solid var(--depth-4);
    border-radius: 4px;
    max-height: 12rem;
    overflow-y: auto;
}

.tag-filter-suggestions li {
    padding: 0.4rem 0.75rem;
    cursor: pointer;
}

.tag-filter-suggestions li:hover,
.tag-filter-suggestions li[aria-selected="true"] {
    background: color-mix(in srgb, var(--biolum) 15%, var(--depth-3));
}

.tag-filter-count,
.tag-filter-status,
.upload-tags-status,
.upload-tags-batch-note,
.edit-tags-status {
    font-size: 0.85rem;
    color: var(--foam-2);
}

.upload-tags-row {
    margin: 0.75rem 0;
}

.upload-tags-row label {
    display: block;
    margin-bottom: 0.35rem;
}

.edit-tags-modal-content {
    max-width: 32rem;
}

.edit-tags-filename {
    word-break: break-all;
    color: var(--foam-2);
}

.edit-tags-add-row,
.edit-tags-replace-row,
.edit-tags-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.edit-tags-actions {
    justify-content: flex-end;
}

.file-info strong {
    word-break: break-all;
    overflow-wrap: break-word;
    min-width: 0;
}

.file-size {
    color: var(--foam-2);
    font-size: 0.9rem;
}

.file-date {
    color: var(--foam-2);
    font-size: 0.9rem;
}

.encryption-type {
    padding: 0.27rem 0.54rem;
    border-radius: 11px;
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.27rem;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
    width: fit-content;
}

.encryption-type-account {
    background-color: var(--biolum);
    color: var(--depth-3);
}

.encryption-type-custom {
    background-color: var(--phosphor);
    color: var(--depth-3);
}

/* Share list key type badges (used in share-list.ts renderShareItem) */
.type-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: default;
    user-select: none;
    margin-left: 0.5rem;
}

.type-account {
    background-color: var(--biolum);
    color: var(--depth-3);
}

.type-custom {
    background-color: var(--phosphor);
    color: var(--depth-3);
}

/* Share revoked/expired inline indicator (next to filename) */
.share-inactive-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: default;
    user-select: none;
    margin-left: 0.6rem;
    vertical-align: middle;
    background-color: var(--coral);
    color: var(--salt);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Share list filename wrapping */
.share-title h3 {
    word-break: break-all;
    overflow-wrap: break-word;
    min-width: 0;
}

.share-header {
    min-width: 0;
}

.share-title {
    min-width: 0;
    overflow: hidden;
}

/* Refresh button override - biolum background */
.share-list-refresh {
    background-color: var(--biolum) !important;
    color: var(--depth-2) !important;
    border: none !important;
}

.share-list-refresh:hover {
    background-color: color-mix(in srgb, var(--biolum) 80%, var(--depth-1)) !important;
    color: var(--depth-2) !important;
}

/* Password Options Styles */
.password-options {
    background-color: var(--depth-2);
    padding: 1.5rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.option {
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option input[type="radio"] {
    width: auto;
    margin: 0;
}

.option label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Password Requirements Styles */
.password-requirements {
    background-color: var(--depth-2);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.strength-meter {
    height: 8px;
    background-color: var(--depth-4);
    border-radius: 4px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 0;
    color: var(--salt);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
}

.requirements-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    color: var(--foam-2);
}

.requirements-list li {
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.requirements-list li::before {
    content: "-";
    color: var(--foam-2);
}

.requirements-list li.met::before {
    content: "✓";
    color: var(--biolum);
}

/* Password Confirmation Styles */
.password-confirmation {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.match-status {
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.match-status.matching {
    display: flex;
    background-color: color-mix(in srgb, var(--biolum) 15%, var(--depth-3));
    color: var(--biolum);
    border: 1px solid var(--biolum);
}

.match-status.matching::before {
    content: "✓";
    color: var(--biolum);
    font-weight: bold;
}

.match-status.not-matching {
    display: flex;
    background-color: color-mix(in srgb, var(--coral) 15%, var(--depth-3));
    color: var(--coral);
    border: 1px solid var(--coral);
}

.match-status.not-matching::before {
    content: "✗";
    color: var(--coral);
    font-weight: bold;
}

.match-status.empty {
    display: flex;
    background-color: color-mix(in srgb, var(--phosphor) 15%, var(--depth-3));
    color: var(--phosphor);
    border: 1px solid var(--phosphor);
}

.match-status.empty::before {
    content: "⏳";
    color: var(--phosphor);
}

/* Storage Info Styles */
.storage-info {
    margin-top: 2rem;
    padding: 1rem;
    background-color: var(--depth-2);
    border-radius: 4px;
}

.storage-bar {
    height: 8px;
    background-color: var(--depth-4);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.storage-bar .used {
    height: 100%;
    background-color: var(--current-1);
    transition: width 0.3s ease;
}

.storage-info-section {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background-color: var(--depth-2);
    border-radius: 4px;
}

.storage-text {
    font-size: 0.9rem;
    color: var(--foam-2);
    text-align: right;
}

.storage-bar-normal .used {
    background-color: var(--biolum);
}

.storage-bar-warning .used {
    background-color: var(--phosphor);
}

.storage-bar-critical .used {
    background-color: var(--coral);
}

.storage-contact-note {
    font-size: 0.8rem;
    color: var(--foam-2);
    text-align: right;
    margin-top: 0.25rem;
    opacity: 0.8;
}

/* File Actions */
.file-actions {
    display: flex;
    gap: 0.5rem;
}

.file-actions button {
    width: auto;
}

.file-actions .danger-button {
    margin-top: 0;
}

/* Custom Password Section */
#customPasswordSection {
    border: 1px solid var(--depth-4);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

#customPasswordSection.hidden {
    display: none;
}

/* Password Strength Colors */
.strength-meter.very-weak {
    background-color: var(--coral);
    width: 20%;
}

.strength-meter.weak {
    background-color: var(--phosphor);
    width: 40%;
}

.strength-meter.moderate {
    background-color: var(--phosphor);
    width: 60%;
}

.strength-meter.strong {
    background-color: var(--biolum);
    width: 80%;
}

.strength-meter.very-strong {
    background-color: var(--biolum);
    width: 100%;
}

/* User Navigation Bar */
.user-nav {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
    position: relative;
}

.user-controls {
    display: flex;
    gap: 0.5rem;
}

.icon-button {
    background-color: var(--salt);
    color: var(--depth-1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.3s ease;
    padding: 0;
}

.icon-button:hover {
    background-color: var(--current-2);
    color: var(--salt);
}

/* Specific styling for logout button */
.logout-btn {
    background-color: var(--coral) !important;
    color: var(--salt) !important;
    font-size: var(--control-font) !important;
    width: auto !important;
    padding: var(--control-pad-y) var(--control-pad-x) !important;
    line-height: var(--control-line) !important;
    min-height: var(--control-height) !important;
    border-radius: 6px !important;
    height: auto !important;
}

.logout-btn:hover {
    background-color: color-mix(in srgb, var(--coral) 80%, var(--depth-1)) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px color-mix(in srgb, var(--depth-1) 80%, transparent);
}

/* Navigation link styling */
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: var(--control-pad-y) var(--control-pad-x);
    margin: 0 4px;
    text-decoration: none;
    color: var(--salt);
    background-color: var(--depth-2);
    border: 2px solid var(--current-2);
    border-radius: 6px;
    font-size: var(--control-font);
    font-weight: 600;
    line-height: var(--control-line);
    min-height: var(--control-height);
    box-sizing: border-box;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-link:hover {
    background-color: var(--depth-4);
    border-color: var(--salt);
    text-decoration: none;
    transform: none;
    box-shadow: none;
}

.logout-link {
    background-color: color-mix(in srgb, var(--coral) 15%, var(--depth-3)) !important;
    color: var(--coral) !important;
    border: 2px solid var(--coral) !important;
}

.logout-link:hover {
    background-color: color-mix(in srgb, var(--coral) 25%, var(--depth-3)) !important;
    border-color: var(--coral) !important;
    color: var(--salt) !important;
}

/* Security Settings Panel */
.security-panel {
    position: absolute;
    top: 45px;
    right: 0;
    background-color: var(--depth-3);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--depth-1) 80%, transparent);
    width: 400px;
    max-width: calc(100vw - 1rem);
    z-index: 10;
}

.security-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--depth-4);
    padding-bottom: 0.5rem;
}

.security-panel-header h3,
.security-panel h3 {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.2rem;
}

.security-panel > h3 {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--depth-4);
    padding-bottom: 0.5rem;
}

.security-panel-header h3 {
    border-bottom: none;
    padding-bottom: 0;
}

.security-panel-close {
    background: transparent;
    color: var(--foam-2);
    border: 1px solid var(--depth-4);
    border-radius: 4px;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    flex-shrink: 0;
    min-height: 0;
    min-width: 0;
    box-shadow: none;
}

.security-panel-close:hover {
    background-color: var(--depth-2);
    color: var(--salt);
    border-color: var(--foam-2);
    transform: none;
    box-shadow: none;
}

.security-panel button:not(.password-toggle-btn):not(.tag-chip):not(.tag-chip-remove):not(.security-panel-close),
.security-panel .btn,
.security-panel .btn-primary,
.security-panel .secondary-button,
.security-panel .danger-button {
    margin: 0;
}

.security-panel .file-input-label {
    margin-bottom: 0.5rem;
    background-color: var(--depth-2);
    border: 2px solid var(--current-2);
    color: var(--salt);
}

.security-panel .mfa-credential-row > div {
    flex-wrap: wrap;
}

.billing-plans-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.billing-plan-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.65rem 0.75rem;
    background: var(--depth-2);
    border: 1px solid var(--depth-4);
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.billing-plan-card button {
    align-self: flex-start;
}

/* Result text inside nav panels must stay inline; .success-message/.error-message
   are otherwise position:fixed toasts. */
.security-panel .success-message,
.security-panel .error-message,
#share-verify-result.success-message,
#share-verify-result.error-message {
    position: static;
    top: auto;
    right: auto;
    max-width: none;
    box-shadow: none;
    animation: none;
    padding: 0.75rem;
    margin: 0.5rem 0;
}

.setting-item {
    margin-bottom: 1rem;
}

.danger-button {
    background-color: var(--coral);
    color: var(--salt);
}

.danger-button:hover {
    background-color: color-mix(in srgb, var(--coral) 80%, var(--depth-1));
}

/* Billing panel (storage credits / usage metering).
   Renders inside a .security-panel container; this block adds the
   billing-specific layout on top of the panel's chrome.
   See client/static/js/src/ui/billing.ts for the matching DOM structure.
*/
.billing-panel-section {
    margin-bottom: 1.25rem;
}
.billing-panel-section:last-child {
    margin-bottom: 0;
}
.billing-panel-section h4 {
    margin: 0 0 0.4rem 0;
    font-size: 0.78rem;
    color: var(--foam-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.billing-balance-amount {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0;
    color: var(--salt);
    font-variant-numeric: tabular-nums;
}
.billing-balance-amount.negative {
    color: var(--coral);
}

.billing-runway,
.billing-below-baseline {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--foam-2);
}

.billing-oob-note {
    margin: 0.35rem 0 0 0;
    font-size: 0.85rem;
    color: var(--foam-2);
    line-height: 1.45;
}

.billing-oob-method {
    margin-top: 0.85rem;
    padding: 0.75rem 0.85rem;
    background: var(--depth-2);
    border: 1px solid var(--depth-4);
    border-radius: 4px;
}

.billing-oob-method-title {
    margin: 0 0 0.35rem 0;
    font-size: 0.8rem;
    color: var(--biolum);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.billing-oob-value {
    margin: 0.2rem 0;
    color: var(--foam-1);
    font-size: 0.9rem;
    word-break: break-all;
}

.billing-oob-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.4;
}

.billing-usage-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 1rem;
    row-gap: 0.3rem;
    margin: 0;
    font-size: 0.9rem;
}
.billing-usage-grid dt {
    color: var(--foam-2);
    font-weight: normal;
}
.billing-usage-grid dd {
    margin: 0;
    color: var(--salt);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.billing-tx-scroll {
    max-height: 300px;
    overflow-y: auto;
}

.billing-tx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.billing-tx-table th,
.billing-tx-table td {
    padding: 0.3rem 0.5rem 0.3rem 0;
    text-align: left;
    vertical-align: top;
}
.billing-tx-table th {
    color: var(--foam-2);
    font-weight: 600;
    border-bottom: 1px solid var(--depth-4);
}
.billing-tx-amount,
.billing-tx-balance {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
.billing-tx-amount.negative,
.billing-tx-balance.negative {
    color: var(--coral);
}

/* Contact Info Panel */

.contact-info-notice {
    font-size: 0.85rem;
    color: var(--foam-2);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.contact-method-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.contact-method-row select.contact-type,
.contact-method-row input.contact-value,
.contact-method-row input.contact-label {
    margin-bottom: 0;
}

.contact-method-row select.contact-type {
    flex-shrink: 0;
    width: 110px;
    padding: 0.5rem;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.contact-method-row input.contact-value {
    flex: 1;
    min-width: 120px;
    width: auto;
    padding: 0.5rem;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.contact-method-row input.contact-label {
    flex-shrink: 0;
    width: 100px;
    min-width: 0;
    padding: 0.5rem;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.contact-method-row .remove-contact-btn {
    background: none;
    border: 1px solid var(--depth-4);
    color: var(--coral);
    cursor: pointer;
    width: auto;
    flex: 0 0 auto;
    align-self: center;
    margin: 0;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    line-height: 1;
    border-radius: 4px;
}

.contact-method-row .remove-contact-btn:hover {
    background-color: color-mix(in srgb, var(--coral) 18%, var(--depth-3));
}

#contact-info-panel textarea {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.85rem;
    border: 1px solid var(--depth-4);
    background-color: var(--depth-2);
    color: var(--foam-1);
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

#contact-info-panel input[type="text"]:not(.contact-value):not(.contact-label) {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
    border: 1px solid var(--depth-4);
    background-color: var(--depth-2);
    color: var(--foam-1);
    border-radius: 4px;
}

#contact-info-panel .contact-method-row input.contact-value {
    flex: 1;
    width: auto;
    min-width: 0;
}

#contact-info-panel .contact-method-row input.contact-label {
    flex: 0 0 auto;
}

#contact-info-panel label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

/* OPAQUE Authentication Styles */

/* Modal and Dialog Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: color-mix(in srgb, var(--depth-1) 80%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* .modal sets display:flex after .hidden; without this, class="modal hidden"
   stays visible and intercepts clicks (breaks Playwright and real UI). */
.modal.hidden {
    display: none;
    pointer-events: none;
}

.modal-content {
    background-color: var(--depth-3);
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px color-mix(in srgb, var(--depth-1) 80%, transparent);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Capability Consent Dialog */
.capability-consent-dialog .modal-content {
    text-align: left;
}

.capability-consent-dialog h3 {
    color: var(--salt);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.consent-message {
    background-color: var(--depth-2);
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: var(--foam-1);
    white-space: pre-line;
}

.consent-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.consent-options button {
    width: 100%;
    text-align: left;
    white-space: normal;
}

.btn-primary {
    background-color: var(--current-1);
    color: var(--salt);
    border: 2px solid var(--current-1);
}

.btn-primary:hover {
    background-color: var(--current-2);
    border-color: var(--current-2);
}

.btn-secondary {
    background-color: var(--depth-3);
    color: var(--salt);
    border: 2px solid var(--depth-4);
}

.btn-secondary:hover {
    background-color: var(--depth-2);
    border-color: var(--current-2);
}

/* Progress Messages */
.progress-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--depth-3);
    color: var(--foam-1);
    padding: 1.5rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px color-mix(in srgb, var(--depth-1) 80%, transparent);
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease-out;
}

.progress-message::before {
    content: "⏳";
    font-size: 1.2rem;
    animation: pulse 1.5s infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Capability Info Display */
.capability-info {
    background-color: var(--depth-2);
    border: 1px solid var(--depth-4);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: var(--foam-1);
    z-index: 1050;
    position: relative;
}

.capability-info div {
    margin-bottom: 0.3rem;
}

.capability-info strong {
    color: var(--salt);
}

/* Ensure capability info is properly positioned and readable */
.capability-info.success-message {
    background-color: color-mix(in srgb, var(--biolum) 15%, var(--depth-3));
    border: 1px solid var(--biolum);
    color: var(--biolum);
    top: 80px;
    z-index: 1050;
}

.capability-info.success-message strong {
    color: var(--biolum);
}

/* Authentication Method Indicator */
.auth-method-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: color-mix(in srgb, var(--current-2) 15%, var(--depth-3));
    color: var(--current-2);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.auth-method-indicator.opaque {
    background-color: color-mix(in srgb, var(--biolum) 15%, var(--depth-3));
    color: var(--biolum);
}

.auth-method-indicator.legacy {
    background-color: color-mix(in srgb, var(--phosphor) 15%, var(--depth-3));
    color: var(--phosphor);
}

.auth-method-indicator::before {
    content: "[SECURE]";
    font-size: 0.8em;
    font-weight: bold;
}

.auth-method-indicator.opaque::before {
    content: "[OPAQUE]";
    font-size: 0.8em;
    font-weight: bold;
}

.auth-method-indicator.legacy::before {
    content: "[LEGACY]";
    font-size: 0.8em;
    font-weight: bold;
    color: var(--phosphor);
}

/* Enhanced Form Styling for OPAQUE */
.auth-form {
    position: relative;
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section h4 {
    color: var(--salt);
    margin-bottom: 0.8rem;
    font-size: 1rem;
    font-weight: 600;
}

.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-with-icon {
    padding-left: 2.5rem;
}

.input-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--foam-2);
    font-size: 1.1rem;
}

/* Security Level Indicators */
.security-level {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.security-level.interactive {
    background-color: color-mix(in srgb, var(--current-2) 15%, var(--depth-3));
    color: var(--foam-1);
}

.security-level.balanced {
    background-color: color-mix(in srgb, var(--current-2) 15%, var(--depth-3));
    color: var(--foam-1);
}

.security-level.maximum {
    background-color: color-mix(in srgb, var(--biolum) 15%, var(--depth-3));
    color: var(--biolum);
}

/* Responsive Design for OPAQUE Elements */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .consent-options {
        gap: 0.6rem;
    }
    
    .progress-message {
        margin: 1rem;
        padding: 1rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Mobile file list: stack vertically */
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .file-item button {
        margin-left: 0;
    }

    .file-info {
        flex-wrap: wrap;
        width: 100%;
        gap: 0.5rem;
    }

    .file-info strong {
        width: 100%;
        font-size: 0.95rem;
    }

    .file-actions {
        flex-wrap: wrap;
        width: 100%;
        gap: 0.4rem;
    }

    /* Mobile share list */
    .share-item {
        padding: 0.75rem;
    }

    .share-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .share-title h3 {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .share-url-section {
        overflow: hidden;
    }

    .share-url-input {
        font-size: 0.75rem;
        width: 100%;
        min-width: 0;
    }

    /* Mobile: Share list URL input group - stack vertically */
    .url-input-group {
        flex-direction: column;
    }

    .url-input-group .btn-copy {
        width: 100%;
    }

    /* Mobile: Decrypt banner - stack vertically */
    .decrypt-banner {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .share-stats {
        flex-direction: column;
        gap: 0.3rem;
    }

    .stat-item {
        font-size: 0.82rem;
    }

    .share-actions {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    /* Mobile: full-viewport overlay; Close stays on screen via sticky header */
    .security-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        z-index: 100;
        border-radius: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 1.25rem;
        padding-top: max(1.25rem, env(safe-area-inset-top, 0px));
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
    }

    .security-panel-header {
        position: sticky;
        top: calc(-1 * max(1.25rem, env(safe-area-inset-top, 0px)));
        z-index: 2;
        background-color: var(--depth-3);
        margin: calc(-1 * max(1.25rem, env(safe-area-inset-top, 0px))) -1.25rem 1rem -1.25rem;
        padding: max(1.25rem, env(safe-area-inset-top, 0px)) 1.25rem 0.75rem 1.25rem;
    }

    .security-panel-close {
        padding: 0.35rem 0.7rem;
        font-size: 0.82rem;
        min-height: 2.2rem;
    }

    /* Mobile: Stack contact method rows vertically */
    .contact-method-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .contact-method-row select.contact-type {
        width: 100%;
    }

    .contact-method-row input.contact-value {
        width: 100%;
        min-width: 0;
    }

    .contact-method-row input.contact-label {
        width: 100%;
    }

    .contact-method-row .remove-contact-btn {
        align-self: flex-end;
    }

    /* Mobile: Pending contact info section */
    .pending-contact-info-section {
        padding: 1rem;
    }

    .pending-contact-info-section .setting-item[style*="flex"] {
        flex-direction: column;
        gap: 0.5rem;
    }

    .pending-contact-info-section .setting-item[style*="flex"] button {
        width: 100%;
        min-width: 0;
    }

    /* Mobile: Contact info panel button row */
    #contact-info-panel .setting-item[style*="flex"] {
        flex-direction: column;
        gap: 0.5rem;
    }

    #contact-info-panel .setting-item[style*="flex"] button {
        width: 100%;
    }

    /* Mobile: Pending approval section constrain width */
    .pending-approval-section {
        max-width: 100%;
        padding: 1rem;
    }

    .pending-approval-content {
        padding: 1rem;
    }

    /* Mobile: User navigation controls - wrap when needed */
    .user-controls {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .user-controls .nav-link {
        margin: 2px;
    }

    /* Mobile: Reduce container padding */
    .container {
        padding: 1rem;
    }

    /* Mobile: TOTP setup form */
    .totp-setup-form {
        padding: 1rem;
        max-width: 100%;
    }

    .totp-step {
        padding: 1rem;
    }

    /* Mobile: Generic modals - wider on small screens */
    .modal-content {
        max-width: 95%;
        width: 95%;
        max-height: 85vh;
        padding: 1.25rem;
    }

    /* Mobile: Password modal - ensure it fits */
    .password-modal {
        width: 95%;
        max-width: 95%;
    }

    .password-modal-overlay {
        align-items: flex-start;
        padding: max(1rem, env(safe-area-inset-top, 0px)) 0.5rem max(1rem, env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
    }

    .password-modal-footer {
        flex-wrap: wrap;
    }

    .password-modal-btn {
        min-height: var(--control-height);
    }

    /* Mobile: Metadata modal */
    .metadata-modal {
        width: 95%;
        padding: 1rem;
        max-height: 85vh;
    }

    .metadata-row {
        flex-direction: column;
        gap: 0.25rem;
    }

    .metadata-label {
        min-width: 0;
    }

    /* Mobile: Share form inline card */
    .share-form-container .card {
        margin-left: 0;
        padding: 1rem;
    }

    /* Mobile: Upload section */
    .upload-section {
        padding: 1rem;
    }

    /* Mobile: Progress modal */
    .progress-modal {
        min-width: 0;
        width: calc(100vw - 2rem);
        max-width: 400px;
        padding: 20px;
    }

    .message-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
        top: max(12px, env(safe-area-inset-top, 0px));
    }

    .metadata-modal-close button {
        width: 100%;
        justify-content: center;
    }
}

/* TOTP Setup Styling */
.totp-setup-form {
    background-color: var(--depth-3);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px color-mix(in srgb, var(--depth-1) 80%, transparent);
    max-width: 600px;
    margin: 0 auto;
}

.totp-info {
    background-color: color-mix(in srgb, var(--current-2) 15%, var(--depth-3));
    border: 1px solid var(--current-2);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: var(--foam-1);
}

.totp-step {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--depth-2);
    border-radius: 6px;
    border-left: 4px solid var(--current-1);
}

.totp-step h3 {
    margin-top: 0;
    color: var(--salt);
    font-size: 1.1rem;
}

.totp-step ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.totp-step li {
    margin-bottom: 0.3rem;
}

.qr-code-container {
    text-align: center;
    margin: 1rem 0;
}

.qr-code-container img {
    max-width: 200px;
    height: auto;
    border: 1px solid var(--depth-4);
    border-radius: 4px;
}

/* TOTP app recommendation tooltip */
.totp-app-hint {
    color: var(--current-2);
    cursor: help;
    position: relative;
    border-bottom: 1px dotted var(--current-2);
}

.totp-app-tooltip {
    display: none;
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--depth-2);
    color: var(--foam-1);
    border: 1px solid var(--depth-4);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.totp-app-hint:hover .totp-app-tooltip,
.totp-app-hint:focus .totp-app-tooltip {
    display: block;
}

.manual-entry {
    background-color: var(--depth-2);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    border: 1px solid var(--depth-4);
}

.manual-entry-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: nowrap;
}

.manual-entry code {
    font-family: monospace;
    background-color: var(--depth-4);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow-x: auto;
}

.totp-input {
    font-family: monospace;
    font-size: 1.2rem;
    text-align: center;
    letter-spacing: 0.2em;
    width: 120px;
    padding: 0.8rem;
    border: 2px solid var(--depth-4);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.totp-input:focus {
    border-color: var(--current-1);
    outline: none;
}

.backup-codes-section {
    background-color: color-mix(in srgb, var(--phosphor) 15%, var(--depth-3));
    border: 1px solid var(--phosphor);
    border-radius: 6px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.backup-warning {
    margin-bottom: 1rem;
    color: var(--phosphor);
}

.backup-codes-container ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    background-color: var(--depth-3);
    border-radius: 4px;
    padding: 1rem;
}

.backup-codes-container li {
    font-family: monospace;
    background-color: var(--depth-2);
    padding: 0.5rem;
    margin: 0.3rem 0;
    border-radius: 3px;
    font-size: 0.95rem;
    border: 1px solid var(--depth-4);
}

.totp-navigation {
    margin-top: 2rem;
    text-align: center;
}

.secondary-button {
    background-color: var(--depth-4);
    color: var(--salt);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 0;
    transition: background-color 0.3s ease;
}

.secondary-button:hover {
    background-color: color-mix(in srgb, var(--depth-4) 70%, var(--depth-1));
}

.secondary-button:disabled {
    background-color: var(--depth-4);
    cursor: not-allowed;
}

/* Animation for smooth transitions */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Share Form Styles */
.share-form-container {
    margin: 1rem 0;
    animation: slideUp 0.3s ease-out;
}

.share-form-container .card {
    background-color: var(--depth-2);
    border: 1px solid var(--depth-4);
    border-radius: 8px;
    padding: 1.5rem;
    margin-left: 2rem;
    border-left: 4px solid var(--current-1);
}

.share-form-container h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--salt);
    font-size: 1.1rem;
}

.share-form-container .form-group {
    margin-bottom: 1rem;
}

.share-form-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--salt);
}

.share-form-container input[type="password"] {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--depth-4);
    border-radius: 4px;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.share-form-container input[type="password"]:focus {
    outline: none;
    border-color: var(--current-1);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--current-2) 20%, transparent);
}

.share-form-container .password-strength {
    margin-bottom: 0.5rem;
}

.share-form-container .strength-meter {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.share-form-container .feedback {
    font-size: 0.8rem;
    color: var(--foam-2);
    font-style: italic;
}

.share-form-container small {
    color: var(--foam-2);
    font-size: 0.85rem;
}

.share-form-container .form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.share-form-container .btn {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-form-container .btn.primary {
    background-color: var(--current-1);
    color: var(--salt);
}

.share-form-container .btn.primary:hover:not(:disabled) {
    background-color: var(--current-2);
}

.share-form-container .btn.primary:disabled {
    background-color: var(--depth-4);
    cursor: not-allowed;
}

.share-form-container .btn.secondary {
    background-color: var(--depth-4);
    color: var(--salt);
}

.share-form-container .btn.secondary:hover {
    background-color: color-mix(in srgb, var(--depth-4) 70%, var(--depth-1));
}

.share-form-container .success-message {
    background-color: color-mix(in srgb, var(--biolum) 15%, var(--depth-3));
    border: 1px solid var(--biolum);
    color: var(--biolum);
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.share-form-container .success-message h4 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    color: var(--biolum);
}

.share-form-container .error-message {
    background-color: color-mix(in srgb, var(--coral) 15%, var(--depth-3));
    border: 1px solid var(--coral);
    color: var(--coral);
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

/*
 * .warning-note -- non-blocking advisory text shown in-line above an action
 * (e.g. the share-access download button when SW streaming is unavailable
 * AND the file is large enough to risk hitting Chromium's blob URL ceiling).
 *
 * Uses the same --phosphor amber the rest of the app uses for warnings
 * (storage-bar-warning, encryption-type-custom, backup-warning,
 * pending-approval-content, share revoke action). The element is hidden by
 * default -- JS toggles `display:none` -> `''` to reveal it. No inline
 * style: properties beyond `display:none` should be set in markup.
 */
.warning-note {
    background-color: color-mix(in srgb, var(--phosphor) 15%, var(--depth-3));
    border: 1px solid var(--phosphor);
    color: var(--phosphor);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin: 0.5rem 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.share-form-container .share-url-group {
    margin-bottom: 1rem;
}

.share-form-container .share-url-group label {
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.share-form-container .url-copy-container {
    display: flex;
    gap: 0.5rem;
}

.share-form-container .url-copy-container input {
    flex: 1;
    font-family: monospace;
    font-size: 0.9rem;
    background-color: var(--depth-3);
    border: 1px solid var(--depth-4);
    margin-bottom: 0;
}

.share-form-container .url-copy-container button {
    background-color: var(--biolum);
    color: var(--depth-1);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.share-form-container .url-copy-container button:hover {
    background-color: var(--current-2);
}

.share-form-container #share-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--salt);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.share-form-container #share-progress .progress-bar {
    width: 100px;
    height: 4px;
    background-color: var(--depth-4);
    border-radius: 2px;
    overflow: hidden;
}

.share-form-container #share-progress .progress-bar-fill {
    height: 100%;
    background-color: var(--current-1);
    border-radius: 2px;
    animation: progress-fill 2s ease-in-out infinite;
}

@keyframes progress-fill {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}

/* Progress Modal Styles */
.progress-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--depth-3);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px color-mix(in srgb, var(--depth-1) 80%, transparent);
    z-index: 1500;
    min-width: 300px;
    text-align: center;
    border: 1px solid var(--depth-4);
}

.progress-modal h4 {
    margin: 0 0 15px 0;
    color: var(--foam-1);
    font-size: 18px;
}

.progress-modal .progress-message-text {
    margin-bottom: 20px;
    color: var(--foam-2);
    font-size: 14px;
    line-height: 1.4;
}

.progress-modal .progress-container {
    width: 100%;
    height: 8px;
    background-color: var(--depth-4);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-modal .progress-bar {
    height: 100%;
    background-color: var(--current-1);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: var(--progress-width, 0%);
}

.progress-modal .progress-bar.indeterminate {
    background: linear-gradient(90deg, transparent 0%, var(--current-2) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: indeterminate 1.5s infinite;
    width: 100%;
}

@keyframes indeterminate {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.progress-modal .progress-percentage {
    font-size: 12px;
    color: var(--foam-2);
    margin-bottom: 15px;
}

.progress-modal .cancel-button {
    background-color: var(--depth-4);
    color: var(--salt);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.progress-modal .cancel-button:hover {
    background-color: color-mix(in srgb, var(--depth-4) 70%, var(--depth-1));
}

.progress-modal .progress-info {
    font-size: 11px;
    color: var(--foam-2);
    margin-top: 10px;
    line-height: 1.3;
}

.progress-modal .progress-error {
    color: var(--coral);
    font-size: 13px;
    margin-top: 10px;
    padding: 8px;
    background-color: color-mix(in srgb, var(--coral) 15%, var(--depth-3));
    border-radius: 4px;
    border: 1px solid var(--coral);
}

.progress-modal.error {
    border-color: var(--coral);
}

.progress-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: color-mix(in srgb, var(--depth-1) 80%, transparent);
    z-index: 1400;
}

/* Password Toggle Styles */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
}

.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
    flex: 1;
    padding-right: 45px; /* Make room for the toggle button */
    margin-bottom: 0; /* Remove bottom margin when in wrapper */
}

/* Password visibility toggle (icon control inside text fields; not a primary action button) */
.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    box-sizing: border-box;
    margin: 0;
    padding: 6px;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--foam-2);
    font: inherit;
    font-weight: normal;
    line-height: 1;
    min-width: 0;
    min-height: 0;
    width: auto;
    height: auto;
    box-shadow: none;
    transition: color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.password-toggle-btn:hover,
.password-toggle-btn:active {
    color: var(--salt);
    background: transparent;
    transform: translateY(-50%);
    box-shadow: none;
}

.password-toggle-btn:focus {
    outline: none;
}

.password-toggle-btn:focus-visible {
    outline: 2px solid var(--current-1);
    outline-offset: 2px;
    transform: translateY(-50%);
    box-shadow: none;
}

.password-toggle-btn .eye-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Ensure wrapper maintains proper spacing */
.password-input-wrapper + .password-requirements,
.password-input-wrapper + .password-feedback,
.password-input-wrapper + .password-confirmation {
    margin-top: 0.5rem;
}

/* Adjust for password fields with validation feedback */
.password-section .password-input-wrapper {
    margin-bottom: 0.5rem;
}

.password-modal-field .password-input-wrapper,
.share-form-container .password-input-wrapper,
.password-form .password-input-wrapper,
.login-form .password-input-wrapper,
.register-form .password-input-wrapper,
.upload-section .password-input-wrapper {
    width: 100%;
}

.password-input-wrapper .password-modal-input {
    width: 100%;
    margin-bottom: 0;
    padding-right: 45px;
}

/* Pending Approval Section */
.pending-approval-section {
    background-color: var(--depth-3);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px color-mix(in srgb, var(--depth-1) 80%, transparent);
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.pending-approval-section h2 {
    color: var(--salt);
    margin-bottom: 1.5rem;
}

.pending-approval-content {
    background-color: color-mix(in srgb, var(--phosphor) 15%, var(--depth-3));
    border: 1px solid var(--phosphor);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.pending-icon {
    font-size: 3rem;
    color: var(--phosphor);
    margin-bottom: 1rem;
}

.pending-message {
    font-size: 1.1rem;
    color: var(--phosphor);
    margin-bottom: 1rem;
}

.pending-details {
    color: var(--phosphor);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.pending-info {
    color: var(--foam-2);
    font-size: 0.9rem;
    font-style: italic;
}

.pending-actions {
    margin-top: 1.5rem;
}

.pending-actions button {
    max-width: 200px;
    margin: 0 auto;
}

/* Pending approval: optional contact info form */
.pending-contact-info-section {
    background-color: var(--depth-2);
    border: 1px solid var(--depth-4);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    text-align: left;
}

.pending-contact-info-section h3 {
    color: var(--salt);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.pending-contact-info-section .contact-info-notice {
    color: var(--foam-2);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
    font-style: italic;
}

.pending-contact-info-section .setting-item {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.pending-contact-info-section .setting-item label,
.pending-contact-info-section .setting-item > strong {
    display: block;
    color: var(--foam-1);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.pending-contact-info-section .setting-item input[type="text"],
.pending-contact-info-section .setting-item textarea {
    width: 100%;
    box-sizing: border-box;
}

.pending-contact-info-section .setting-item textarea {
    resize: vertical;
    min-height: 80px;
}

.pending-contact-info-section .setting-item[style*="flex"] {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.pending-contact-info-section .setting-item[style*="flex"] button,
#contact-info-panel .setting-item[style*="flex"] button {
    flex: 1 1 auto;
    min-width: 130px;
    max-width: none;
    margin: 0;
    white-space: nowrap;
}

a {
    color: var(--current-2);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--salt);
    text-decoration: underline;
}
