/* =============================================================================
   Mingo - upload.css
   Upload components and file organization controls
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Upload Components
   ----------------------------------------------------------------------------- */

/* Desktop Upload Zone */
.upload-zone {
    border: 2px dashed rgba(55, 65, 81, 0.3);
    border-radius: var(--ios-radius-xlarge);
    padding: 48px 24px;
    text-align: center;
    background: var(--ios-secondary-background);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin-bottom: 24px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: var(--ios-shadow-light);
}

.upload-zone:hover {
    border-color: #374151;
    background: rgba(55, 65, 81, 0.04);
    box-shadow: var(--ios-shadow-medium);
    transform: scale(1.02);
}

.upload-zone.dragover {
    border-color: #374151;
    background: rgba(55, 65, 81, 0.08);
    box-shadow: var(--ios-shadow-heavy);
    transform: scale(1.03);
}

.upload-zone h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.45px;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0;
    font-weight: 500;
    letter-spacing: -0.32px;
}

.upload-zone input[type="file"] {
    display: none;
}

/* Mobile Upload Zone */
.upload-zone-mobile {
    background: white;
    border: 2px dashed #374151;
    border-radius: 16px;
    padding: 32px 20px;
    text-align: center;
    margin: 16px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.upload-zone-mobile:hover {
    border-color: #1F2937;
    background: rgba(55, 65, 81, 0.04);
    transform: scale(1.02);
}

.upload-zone-mobile:active {
    transform: scale(0.98);
}

.upload-icon {
    color: #374151;
    margin-bottom: 8px;
}

.upload-zone-mobile h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.upload-zone-mobile p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Upload Mode Section */
.upload-mode-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.upload-mode-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.mode-option {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface-color);
    position: relative;
    display: block;
}

.mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-option:hover {
    border-color: #9CA3AF;
    box-shadow: var(--shadow-sm);
}

.mode-option.active {
    border-color: #6B7280;
    background: var(--surface-hover);
    box-shadow: var(--shadow-sm);
}

.mode-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.mode-icon {
    width: 40px;
    height: 40px;
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.mode-option.active .mode-icon {
    background: #374151;
    color: white;
}

.mode-content strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.25rem;
}

.mode-content p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.4;
}

/* Intent Options */
.upload-intent-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.upload-intent-section label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* upload-org-label inside intent section must not inherit above */
.upload-intent-section .upload-org-label {
    font-weight: 700 !important;
    color: var(--text-secondary) !important;
    font-size: 0.75rem !important;
    display: inline !important;
    margin-bottom: 0 !important;
}

/* Override for new upload-org-label inside intent section */
.upload-intent-section .upload-org-label {
    display: inline !important;
    margin-bottom: 0 !important;
    align-self: center !important;
}

.intent-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.intent-option {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    position: relative;
    display: block;
}

.intent-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.intent-option:hover {
    border-color: #9CA3AF;
    box-shadow: var(--shadow-sm);
}

.intent-option:has(input:checked) {
    border-color: #374151;
    background: var(--surface-hover);
}

.intent-content strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.25rem;
}

.intent-content p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.3;
}

/* Access Mode Options */
.access-mode-option {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface-color);
    position: relative;
    display: block;
    text-align: center;
}

.access-mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.access-mode-option:hover {
    border-color: #9CA3AF;
    box-shadow: var(--shadow-sm);
}

.access-mode-option:has(input:checked) {
    border-color: #374151;
    background: var(--surface-hover);
}

.access-mode-content strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.25rem;
}

.access-mode-content p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.3;
}

/* -----------------------------------------------------------------------------
   Organization and Control Components
   ----------------------------------------------------------------------------- */

/* Organization Controls */
.organization-controls,
.organization-section {
    background: var(--ios-secondary-background);
    border-radius: var(--ios-radius-large);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--ios-shadow-light);
}

.organization-header {
    padding: 20px;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
}

.organization-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.41px;
}

.organization-body,
.mobile-controls-grid {
    padding: 20px;
    display: grid;
    gap: 16px;
}

.control-section,
.org-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.org-row:last-child {
    margin-bottom: 0;
}

.control-label,
.org-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    letter-spacing: -0.32px;
}

.folder-controls,
.folder-selector-group,
.tags-selector-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.folder-controls select,
.folder-selector-group select,
.tags-selector-group select,
.org-control {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--ios-radius-medium);
    background: var(--ios-secondary-background);
    font-size: 16px;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 16px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 48px;
    box-sizing: border-box;
}

.new-folder-btn,
.new-tag-btn {
    background: #374151;
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--ios-radius-medium);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    transition: all 0.2s ease;
}

.new-folder-btn:hover,
.new-tag-btn:hover {
    background: #1F2937;
    transform: scale(1.05);
}

/* Search Controls */
.mobile-search-filter,
.search-input-wrapper {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: end;
    position: relative;
}

.search-input {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--ios-radius-medium);
    background: var(--ios-secondary-background);
    font-size: 16px;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
}

.search-input-wrapper .search-input {
    padding-left: 48px !important;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    z-index: 2;
    pointer-events: none;
}

/* View Toggle */
.view-toggle-mobile,
.view-controls {
    display: flex;
    background: var(--surface-secondary);
    border-radius: var(--ios-radius-medium);
    padding: 4px;
    gap: 4px;
}

.view-btn-mobile,
.view-btn {
    background: none;
    border: none;
    padding: 10px 16px;
    border-radius: var(--ios-radius-small);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn-mobile.active,
.view-btn.active {
    background: #374151;
    color: white;
    box-shadow: var(--ios-shadow-light);
}

.view-btn:hover:not(.active) {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Tags Section */
.tags-section {
    background: var(--surface-secondary);
    border-radius: var(--ios-radius-medium);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.quick-tags-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.quick-tag,
.common-tag {
    background: var(--ios-secondary-background);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--ios-radius-small);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.quick-tag.selected,
.common-tag.selected {
    background: #374151;
    color: white;
    border-color: #374151;
}

.quick-tag:active,
.common-tag:hover {
    transform: scale(0.95);
}

.custom-tag-input {
    display: flex;
    gap: 8px;
}

.custom-tag-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--ios-radius-small);
    font-size: 14px;
}

.add-tag-btn {
    background: #374151;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--ios-radius-small);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}


/* Tag delete button */
.quick-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
}

/* Only custom tags with delete button need left padding */
.quick-tag[data-tag] {
    padding-left: 28px;
}

.tag-delete-btn {
    background: rgba(0,0,0,0.15) !important;
    border: none !important;
    border-radius: 50%;
    color: inherit;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px !important;
    min-height: 0 !important;
    height: 18px !important;
    width: 18px !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    order: -1;
    opacity: 1;
    position: absolute;
    left: 6px;
}

.tag-delete-btn:hover {
    background: rgba(0,0,0,0.3) !important;
}

/* ── Upload Tab Redesign ─────────────────────────────────────────────────── */
.upload-redesign {
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Mode toggle - slim pill buttons */
.upload-mode-toggle-slim {
    display: flex;
    background: #f1f3f4;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    width: fit-content;
    border: 1px solid rgba(0,0,0,0.06);
}

.upload-mode-btn {
    padding: 8px 24px;
    border: none;
    border-radius: 9px;
    background: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 0;
    box-shadow: none;
    letter-spacing: -0.01em;
}

.upload-mode-btn.active {
    background: #1a2332;
    color: white;
    box-shadow: 0 2px 8px rgba(26,35,50,0.25);
}

.upload-mode-btn:not(.active):hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

/* Existing share inline row */
.upload-inline-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.upload-inline-row label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: 50px;
}

.upload-inline-row select {
    flex: 1;
}

/* Intent toggle buttons */
.intent-toggle {
    display: flex;
    gap: 0.5rem;
}

.intent-btn {
    padding: 7px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 0;
    box-shadow: none;
    transition: all 0.15s ease;
}

.intent-btn.active {
    background: #1a2332;
    color: white;
    border-color: #1a2332;
    box-shadow: 0 2px 8px rgba(26,35,50,0.25);
}

.intent-btn:not(.active):hover {
    border-color: #374151;
    color: #374151;
}

/* Organization bar */
.upload-org-bar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.upload-org-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upload-org-card {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    width: fit-content;
    max-width: 100%;
}

.upload-org-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.upload-org-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 42px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.upload-folder-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.upload-folder-group select {
    width: auto;
    max-width: 200px;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: white;
    color: var(--text-primary);
    appearance: auto;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.upload-folder-group select:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 3px rgba(55,65,81,0.1);
}

.custom-tag-field {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.custom-tag-field input {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: white;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.custom-tag-field input:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 3px rgba(55,65,81,0.1);
}

.custom-tag-field input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

@media (max-width: 768px) {
    .upload-redesign {
        padding: 1rem 0.75rem;
    }

    .upload-org-field label {
        min-width: 36px;
    }
}

/* New folder button - refined */
.upload-redesign .new-folder-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: white;
    border: 1.5px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    min-height: 0;
    box-shadow: none;
    color: var(--text-secondary);
}

.upload-redesign .new-folder-btn:hover {
    border-color: #374151;
    color: #374151;
    background: white;
}

/* Add tag button - refined */
.upload-redesign .add-tag-btn {
    padding: 8px 14px;
    border-radius: 9px;
    background: #374151;
    border: none;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 0;
    box-shadow: none;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.upload-redesign .add-tag-btn:hover {
    background: #1F2937;
}

/* Org bar labels */
.upload-org-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Tags card - wrap nicely */
.upload-tags-card {
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.upload-tags-card .quick-tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
}

.upload-tags-card .quick-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.upload-tags-card .custom-tag-field {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Share dropdown - constrained width, same style as folder */
#existingShareSelect {
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: white;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    max-width: 320px;
    width: 100%;
}

#existingShareSelect:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 3px rgba(55,65,81,0.1);
}

/* Default tags (no delete button) - true center alignment */
#quickTagsGrid .quick-tag:not([data-tag]) {
    padding-left: 12px !important;
    justify-content: center !important;
}

/* Custom tag input - constrain width */
.custom-tag-field input {
    max-width: 140px;
}

/* Top row - mode toggle + share select on same line */
.upload-top-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Inline share select */
#existingShareInline {
    display: none;
}

#existingShareSelect {
    width: auto;
    max-width: 240px;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: white;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

#existingShareSelect:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 3px rgba(55,65,81,0.1);
}

/* Tags row - card + custom input side by side */
.upload-tags-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

/* Tags card - stays on one line, no wrap */
.upload-tags-card {
    flex-wrap: nowrap !important;
    align-items: center;
    flex-shrink: 1;
    min-width: 0;
}

.upload-tags-label {
    flex-shrink: 0;
    align-self: center;
}

.upload-tags-card .quick-tags-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.upload-tags-card .quick-tags-grid::-webkit-scrollbar {
    display: none;
}

/* Default tags - true center, no offset */
.upload-tags-card .quick-tag:not([data-tag]) {
    padding-left: 12px !important;
    justify-content: center !important;
    text-align: center !important;
}

/* Custom tag field - standalone, no card */
.upload-tags-row .custom-tag-field {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
}

.upload-tags-row .custom-tag-field input {
    width: 120px;
    padding: 8px 12px;
    font-size: 0.8rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: white;
}

@media (max-width: 768px) {
    .upload-tags-row {
        flex-wrap: wrap;
    }
}

/* ── Upload tab fixes ───────────────────────────────────────────────────── */

/* Share dropdown - slightly wider */
#existingShareSelect {
    max-width: 300px !important;
    min-width: 200px;
}

/* Intent section - center align label with buttons */
.upload-intent-section .upload-org-card {
    align-items: center !important;
}

/* File replacement section - constrain width */
.file-replacement-section {
    max-width: 480px;
}

/* Tags card - vertically center tags */
.upload-tags-card {
    align-items: center !important;
    min-height: 44px;
}

.upload-tags-card .quick-tags-grid {
    align-items: center;
}

/* Custom tag field - match height of tags container */
.upload-tags-row .custom-tag-field {
    align-self: stretch;
    align-items: center;
}

.upload-tags-row .custom-tag-field input {
    height: 100%;
    min-height: 44px;
    width: 130px;
    box-sizing: border-box;
}

.upload-tags-row .custom-tag-field .add-tag-btn {
    height: 100%;
    min-height: 44px;
}

/* Intent + file replacement on same row */
.upload-intent-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ACTION label - vertically centered */
.upload-intent-section .upload-org-card {
    align-items: center !important;
    min-height: 44px;
}

.upload-intent-section .upload-org-label {
    align-self: center;
}

/* File replacement inline */
.upload-intent-row .file-replacement-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 260px;
    align-self: center;
}

.upload-intent-row .replacement-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin: 0;
}

.upload-intent-row .replaceable-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* Tag pills - vertically centered in container */
.upload-tags-card {
    align-items: center !important;
}

.upload-tags-card .quick-tags-grid {
    align-items: center !important;
    display: flex !important;
    flex-wrap: nowrap !important;
}

.upload-tags-card .quick-tag {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Custom tag field - same size as SHARE/FOLDER dropdowns */
.upload-tags-row .custom-tag-field input {
    height: auto !important;
    min-height: 0 !important;
    width: 130px !important;
    padding: 8px 12px !important;
    font-size: 0.875rem !important;
    border: 1.5px solid var(--border-color) !important;
    border-radius: 10px !important;
    background: white !important;
    box-sizing: border-box;
}

.upload-tags-row .custom-tag-field .add-tag-btn {
    height: auto !important;
    min-height: 0 !important;
    padding: 8px 14px !important;
}

.upload-tags-row .custom-tag-field {
    align-self: center !important;
}

/* ── Final centering fixes ──────────────────────────────────────────────── */
.upload-intent-row {
    align-items: center !important;
}

.upload-intent-row .file-replacement-section {
    align-self: center !important;
    min-width: 220px;
}

.upload-intent-row .replacement-description {
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ── DEFINITIVE FIX: tags grid is display:grid by default - force flex in upload tab ── */
#upload-tab .quick-tags-grid {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px !important;
    margin-bottom: 0 !important;
    overflow-x: auto;
}

#upload-tab .quick-tag {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
}

/* ── Upload fixes: blank space, file replacement alignment ─────────────── */

/* Remove blank space from upload-intent-row when children are hidden */
.upload-intent-row:empty,
.upload-intent-row > *[style*="display: none"]:only-child {
    display: none;
}

/* When only hidden children exist, collapse the row */
.upload-intent-row {
    min-height: 0;
}

/* File replacement section - align with ACTION card */
.upload-intent-row .file-replacement-section {
    align-self: center !important;
    min-width: 280px !important;
    max-width: 400px;
}

.upload-intent-row .replacement-description {
    margin: 0 0 0.5rem 0 !important;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* File name + size spacing */
.replaceable-file-name {
    margin-right: 0.5rem;
}

.replaceable-file-meta {
    margin-left: 0.5rem !important;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-color);
}

/* File replacement - remove description paragraph to align list with ACTION card top */
.upload-intent-row .replacement-description {
    display: none !important;
}

/* Replaceable files list - align top with ACTION card */
.upload-intent-row .file-replacement-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-self: flex-start !important;
    min-width: 280px !important;
    max-width: 400px;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Reduce gap between mode toggle row and intent row */
.existing-share-options {
    gap: 0.5rem !important;
}

/* Match file replacement section height exactly to ACTION card */
.upload-intent-row {
    align-items: stretch !important;
}

.upload-intent-row .upload-intent-section,
.upload-intent-row .file-replacement-section {
    align-self: stretch !important;
}

.upload-intent-row .file-replacement-section {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

/* Re-show description as small label inside the container */
.upload-intent-row .replacement-description {
    display: block !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: var(--text-secondary) !important;
    margin: 0 0 0.5rem 0 !important;
}

/* Label inside the list box - not above it */
.replaceable-files-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.75rem 1rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    background: #f8f9fa;
}

/* Hide description paragraph - label is now inside list */
.upload-intent-row .replacement-description {
    display: none !important;
}

/* Align replacement section top with ACTION card */
.upload-intent-row {
    align-items: flex-start !important;
}

.upload-intent-row .file-replacement-section {
    align-self: flex-start !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* ── Consistent styling across all upload tab controls ─────────────────── */

/* Replace trigger button - matches folder/share dropdown */
.replace-files-trigger {
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    min-height: 0;
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

.replace-files-trigger:hover {
    border-color: #374151;
}

/* Intent buttons - match the pill weight/size of mode toggle */
.intent-btn {
    font-family: inherit;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: var(--text-secondary);
}

.intent-btn.active {
    color: white;
}

/* Upload org labels - consistent everywhere */
.upload-org-label {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}