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

/* Image download protection */
img,
.folder-thumbnail,
.file-thumb,
.photo-thumb {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    pointer-events: auto;
}

img {
    -webkit-user-drag: none;
    user-drag: none;
}

:root {
    --bg-dark: #f8fafc;
    --bg-main: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-input: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-light: #dbeafe;
    --primary-hover: #2563eb;
    --primary-text: #ffffff;
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 8px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* ============================================
   Auth Screen
   ============================================ */

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-main) 100%);
    padding: 20px;
}

.auth-container {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.logo-icon {
    font-size: 2.5rem;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    background: var(--primary);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: lowercase;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-google:hover {
    background: var(--bg-hover);
    border-color: #dadce0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

.btn-google svg {
    flex-shrink: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-with-action {
    display: flex;
    gap: 6px;
    align-items: center;
}

.input-with-action input {
    flex: 1;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input[type="range"] {
    padding: 0;
    border: none;
    background: transparent;
    width: 100%;
    height: 6px;
    cursor: pointer;
    accent-color: var(--primary);
}

.btn-primary {
    padding: 10px 18px;
    background: var(--primary);
    color: var(--primary-text);
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow);
}

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-full {
    width: 100%;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-secondary {
    padding: 12px 20px;
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    padding: 12px 20px;
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: var(--error);
    color: white;
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.82rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-small.btn-danger {
    border-color: var(--error);
    color: var(--error);
}

.btn-small.btn-danger:hover {
    background: var(--error);
    color: white;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.server-status {
    font-weight: 600;
}

.server-status.online {
    color: var(--success);
}

.server-status.offline {
    color: var(--error);
}

/* ============================================
   Main App Layout
   ============================================ */

.main-app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #fafbfc;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.logo-small {
    display: flex;
    align-items: center;
}

.sidebar-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.logo-small .logo-icon {
    font-size: 1.5rem;
}

.logo-small .logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.user-info {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-email {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    margin-top: 2px;
}

.btn-logout:hover {
    color: var(--error);
}

.nav-menu {
    list-style: none;
    padding: 12px 8px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    color: var(--text-secondary);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: var(--primary-text);
}

.nav-icon {
    font-size: 1rem;
}

.nav-text {
    font-weight: 500;
    font-size: 0.85rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-external {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.link-external:hover {
    color: var(--primary);
}

/* Debug Toggle */
.debug-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    margin-bottom: 8px;
}

.toggle-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 22px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Back to Zoho Results */
.btn-back-zoho-results {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.btn-back-zoho-results:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Found Filter Toggle */
.found-filter-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: var(--radius-sm);
    margin-top: 16px;
}

.found-filter-toggle .toggle-label {
    font-size: 0.9rem;
    color: #2e7d32;
    font-weight: 500;
}

.found-filter-toggle .toggle-switch input:checked + .toggle-slider {
    background-color: #2e7d32;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 20px 24px;
    min-height: 100vh;
    background: #ffffff;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Split view: map + results side by side */
.content-section.active.split-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    overflow: hidden;
}

.content-section.split-view .section-header {
    flex-shrink: 0;
}

.content-section.split-view .zoho-search-form {
    flex-shrink: 0;
}

.content-section.split-view .split-view-body {
    flex: 1 1 0;
    display: flex;
    gap: 16px;
    min-height: 0;
    height: 0;
    padding: 0;
}

.content-section.split-view .split-view-body > .radio-map-panel-float {
    width: 40%;
    min-width: 300px;
    max-width: 480px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.content-section.split-view .split-view-body > .radio-map-panel-float .radio-address-row {
    padding: 8px 10px;
    flex-shrink: 0;
}

.content-section.split-view .split-view-body > .radio-map-panel-float .radio-map-container {
    flex: 1;
    height: auto;
    min-height: 200px;
    border-radius: 0;
    border: none;
}

.content-section.split-view .split-view-body > #zohoSearchResults {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-bottom: 20px;
}

/* Fallback: no split-view-body (old structure) */
.content-section.split-view > #zohoSearchResults {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    height: 0;
    padding-bottom: 20px;
}

/* Mobile: stack vertically */
@media (max-width: 768px) {
    .content-section.active.split-view .split-view-body {
        flex-direction: column;
    }

    .content-section.active.split-view .split-view-body > .radio-map-panel-float {
        width: 100%;
        max-width: none;
        min-width: 0;
        max-height: 250px;
    }

    .content-section.active.split-view .split-view-body > .radio-map-panel-float .radio-map-container {
        min-height: 150px;
    }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-actions select {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 200px;
}

/* Directory Select in Folders Section */
#directorySelect {
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    min-width: 300px;
    cursor: pointer;
    order: -1;
}

#directorySelect:hover {
    border-color: var(--primary);
}

#directorySelect:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

#section-folders .section-header {
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 20px;
}

#section-browse-folders .section-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #ffffff;
    padding: 12px 0;
    margin-top: -12px;
    border-bottom: 1px solid var(--border);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-icon-small {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

/* ============================================
   Photo Grid
   ============================================ */

.photo-grid {
    /* Container for toolbar + select bar + grid */
}

.photo-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.photo-card {
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}

.photo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.photo-thumb {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-hover);
    position: relative;
}

.photo-resolution {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 6px;
    text-align: center;
}

.photo-card-info {
    display: none;
}

.photo-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Files List
   ============================================ */

.files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    gap: 14px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.12s ease;
}

.file-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.file-thumb {
    width: 130px;
    height: 130px;
    background-size: cover;
    background-position: center;
    background-color: #f8fafc;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.file-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.file-location-info {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 10px;
}

.file-meta {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.file-resolution {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.72rem;
}

.file-size {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.72rem;
}

.file-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.45;
}

.file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.tag-badge {
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 500;
}

/* ============================================
   Folders Grid
   ============================================ */

.folders-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.folder-card {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.folder-card:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.folder-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

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

.folder-info h3 {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
}

.folder-info p {
    display: none;
}

.folder-count {
    display: none;
}

/* ============================================
   Packages Grid
   ============================================ */

.packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 20px;
}

.package-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.package-icon {
    font-size: 2.5rem;
}

.package-info {
    flex: 1;
}

.package-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.package-info p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.package-count {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.package-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ============================================
   Search
   ============================================ */

.search-form {
    margin-bottom: 24px;
}

.search-bar {
    display: flex;
    gap: 12px;
    max-width: 600px;
}

.search-bar input {
    flex: 1;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar .btn-primary {
    padding: 14px 28px;
}

/* Inline Geographic Filters (inside semantic-search-toggle row) */
.search-options-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.inline-provincia-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.85rem;
    max-width: 200px;
}

.inline-radio-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.inline-radio-slider {
    width: 120px;
    cursor: pointer;
}

.inline-radio-label {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 50px;
}

.inline-radio-input {
    width: 80px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
}

.inline-radio-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
}

/* Map panel - visually separate from the form */
.radio-map-panel {
    border-top: 1px solid var(--border);
    background: var(--bg-dark);
}

.radio-map-panel-header {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-map-panel-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.radio-map-panel-body {
    padding: 0 16px 16px;
}

.radio-address-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.radio-address-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--bg-input);
    color: var(--text-primary);
}

.radio-address-input:focus {
    outline: none;
    border-color: var(--primary);
}

.radio-address-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.geo-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.geo-popup {
    background: var(--bg-card, #fff);
    border-radius: var(--radius, 8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.geo-popup-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.geo-popup-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary, #333);
}

.geo-popup-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 0 4px;
    line-height: 1;
}

.geo-popup-close:hover {
    color: var(--text-primary, #333);
}

.geo-popup-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.geo-popup-list li {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border, #f0f0f0);
    font-size: 0.9rem;
    color: var(--text-primary, #333);
    transition: background 0.15s;
}

.geo-popup-list li:last-child {
    border-bottom: none;
}

.geo-popup-list li:hover {
    background: var(--bg-hover, #f5f5f5);
}

.geo-popup-list li:active {
    background: var(--primary-light, #e3f2fd);
}

.radio-map-container {
    height: 300px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    z-index: 0;
}

/* Google Places Autocomplete dropdown styling */
.pac-container {
    z-index: 10001 !important;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    font-family: inherit;
}

.pac-item {
    padding: 8px 12px;
    font-size: 0.88rem;
    cursor: pointer;
}

.pac-item:hover {
    background: var(--bg-hover);
}

@media (max-width: 768px) {
    .search-options-sep {
        width: 100%;
        height: 1px;
        margin: 4px 0;
    }
    .inline-provincia-select {
        max-width: 100%;
        width: 100%;
    }
}

/* Image Search */
.image-search-section {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.image-search-section h3 {
    margin-bottom: 16px;
    font-size: 1rem;
    color: var(--text-secondary);
}

.image-search-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.image-search-dropzone {
    width: 150px;
    height: 150px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}

.image-search-dropzone:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.image-search-dropzone input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.image-search-dropzone .dropzone-content {
    text-align: center;
    padding: 10px;
}

.image-search-dropzone .dropzone-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.image-search-dropzone .dropzone-content p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.image-search-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.image-search-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-preview {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-preview:hover {
    background: var(--error);
}

.similarity-control {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.similarity-control label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.similarity-control label span {
    color: #059669;
    font-weight: bold;
    font-size: 1.2rem;
}

.similarity-control input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #cbd5e1, #059669);
    outline: none;
    -webkit-appearance: none;
}

.similarity-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    border: 2px solid #059669;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.similarity-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    border: 2px solid #059669;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.similarity-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-image-search {
    align-self: center;
    padding: 14px 24px;
}

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

.photo-grid-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 6px;
}

.photo-grid-results .photo-card {
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}

.photo-grid-results .photo-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.photo-grid-results .photo-thumb {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
}

.photo-grid-results .photo-card-info {
    display: none;
}

.photo-grid-results .photo-name {
    display: block;
    font-size: 0.7rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-grid-results .photo-desc {
    display: none;
}

/* ============================================
   Upload
   ============================================ */

.upload-container {
    max-width: 600px;
}

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    position: relative;
    margin-bottom: 20px;
    transition: all 0.2s;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-dropzone input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.dropzone-content p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.dropzone-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-queue {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.upload-queue h3 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.upload-files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.upload-file-item .file-name {
    flex: 1;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-file-item .file-size {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.upload-file-item .btn-remove {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
}

.upload-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0;
    transition: width 0.3s;
}

/* ============================================
   Modal
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

/* Modals that open on top of other modals need higher z-index */
#sendWorkRequestModal.modal {
    z-index: 1100;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

.modal-content {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 95vw;
    max-height: 95vh;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

.modal-small {
    width: 420px;
    padding: 28px;
}

.modal-small h2 {
    margin-bottom: 20px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 10;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--error);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: flex-end;
}

/* Photo Modal */
.photo-modal-content {
    display: flex;
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.photo-modal-image {
    flex: 1;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 0;
}

.photo-modal-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 2rem;
    transition: background 0.2s;
}

.nav-arrow:hover {
    background: var(--primary);
}

.nav-prev {
    left: 16px;
}

.nav-next {
    right: 16px;
}

.photo-modal-info {
    width: 340px;
    padding: 28px 24px;
    overflow-y: auto;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
}

.photo-modal-info h2 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    word-break: break-word;
    padding-right: 28px;
}

.photo-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.meta-item {
    margin-bottom: 8px;
}

.meta-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.meta-value {
    font-size: 0.9rem;
}

.photo-description p,
.photo-tags {
    font-size: 0.9rem;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.tag {
    background: var(--bg-hover);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Tags iluminados en el modal fullscreen */
.tags-list .search-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
}

/* Cart button in photo modal */
.modal-cart-action {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.modal-cart-action .btn {
    width: 100%;
    justify-content: center;
}

.tags-list .search-tag-match {
    background: var(--success-light);
    color: #047857;
}

.tags-list .search-tag-dim {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.photo-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ============================================
   Pagination
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.btn-page {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}

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

.page-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   Toast
   ============================================ */

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success);
    color: white;
}

.toast.error {
    background: var(--error);
    color: white;
}

.toast.info {
    background: var(--primary);
    color: white;
}

.toast.warning {
    background: var(--warning);
    color: #000;
}

/* ============================================
   Loading
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .photo-modal-content {
        flex-direction: column;
        width: 95vw;
        height: auto;
        max-height: 95vh;
    }

    .photo-modal-image {
        height: 45vh;
        min-height: 200px;
    }

    .photo-modal-info {
        width: 100%;
        max-height: 50vh;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 768px) {
    /* === Mobile Header === */
    .mobile-header {
        display: flex;
    }

    /* === Main Content: extra padding bottom for bottom nav === */
    .main-content {
        padding-bottom: 68px;
        overflow-x: hidden;
    }

    /* === Shorten long texts for mobile === */
    .section-header h1 {
        font-size: 1rem;
    }

    /* Hide filter-group labels on mobile (selects are self-explanatory) */
    .zoho-form-row .filter-group > label {
        display: none;
    }

    /* Compact selects */
    .zoho-form-row .filter-group select {
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    /* Shorter text search input */
    #zohoSearchQuery {
        font-size: 0.85rem;
    }

    /* Shorter slider labels */
    .similitud-label {
        font-size: 0.7rem;
    }

    /* Compact sunlocs checkbox label */
    .sunlocs-controls .checkbox-label span {
        font-size: 0.8rem;
    }

    /* Compact radio map title */
    .radio-map-panel-title {
        font-size: 0.85rem;
    }

    .radio-address-input {
        font-size: 0.8rem;
    }

    /* Shorter zoho dropzone text */
    .zoho-dropzone-text {
        font-size: 0.75rem;
    }

    /* Compact empty state text */
    .empty-state p {
        font-size: 0.8rem;
    }

    /* Compact section header on split-view */
    .content-section.active.split-view .section-header h1 {
        font-size: 0.95rem;
    }

    /* === Sidebar === */
    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 260px;
        height: 100vh;
        z-index: 1001;
        transition: left 0.3s ease;
        border-right: 1px solid var(--border);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .cart-button-container {
        display: none;
    }

    /* === Main Content === */
    .main-content {
        margin-left: 0;
        margin-top: 56px;
        padding: 12px;
    }

    .content-section.active.split-view {
        height: calc(100vh - 56px - 56px - 12px);
    }

    #section-browse-folders .section-header {
        top: 56px;
        padding: 8px 0;
        margin-top: -8px;
    }

    /* === Section Header === */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 12px;
    }

    .section-header h1 {
        font-size: 1.1rem;
    }

    /* === Modals === */
    .modal-small {
        width: calc(100vw - 24px);
        max-width: 420px;
        padding: 20px 16px;
    }

    .photo-modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .photo-modal-image {
        height: 40vh;
        min-height: 180px;
    }

    .photo-modal-info {
        padding: 16px;
        max-height: 60vh;
    }

    .photo-modal-info h2 {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .photo-meta {
        gap: 4px 12px;
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .nav-arrow {
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }

    .nav-prev { left: 8px; }
    .nav-next { right: 8px; }

    .photo-modal-actions {
        flex-direction: column;
        gap: 8px;
        padding-top: 12px;
    }

    .photo-modal-actions .btn {
        min-height: 44px;
    }

    .modal-close {
        top: 8px;
        right: 8px;
    }

    /* === Photo Grid === */
    .photo-grid-inner {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .folders-grid,
    .packages-grid {
        grid-template-columns: 1fr;
    }

    /* === Overflow prevention === */
    #directorySelect {
        min-width: 0;
        width: 100%;
    }

    .section-actions select {
        min-width: 0;
        width: 100%;
    }

    .section-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    /* === File Items (Search results) === */
    .files-list .file-item {
        flex-direction: column;
    }

    .files-list .file-thumb {
        width: 100%;
        height: 200px;
        min-width: auto;
    }

    /* === Search Bar === */
    .search-bar {
        flex-direction: column;
    }

    .search-bar input[type="text"] {
        width: 100%;
    }

    /* === Zoho Search Form === */
    .zoho-form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .zoho-form-row .filter-group {
        width: 100%;
        min-width: 0;
    }

    .filter-group-radio {
        width: 100% !important;
    }

    .filter-group-radio label:first-child {
        display: none;
    }

    .radio-inline-wrap {
        height: auto;
        flex-wrap: wrap;
    }

    .zoho-form-row-options {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .zoho-btn-buscar {
        width: 100%;
        margin-left: 0;
        min-height: 44px;
        font-size: 1rem;
    }

    .sunlocs-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .similitud-slider-container {
        width: 100%;
    }

    /* === Search Mode Toggle === */
    .search-mode-toggle {
        width: 100%;
    }

    .search-mode-btn {
        flex: 1;
        min-height: 40px;
    }

    /* === Radio Map === */
    .radio-address-row {
        flex-direction: column;
    }

    .radio-address-btn {
        width: 100%;
    }

    /* === Split View on Mobile: stack vertically === */
    .content-section.active.split-view .split-view-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .content-section.active.split-view .split-view-body > .radio-map-panel-float {
        width: 100%;
        max-width: none;
        min-width: 0;
        max-height: 300px;
        flex-shrink: 0;
    }

    .content-section.active.split-view .split-view-body > #zohoSearchResults {
        flex: 1 1 auto;
        overflow-y: visible;
        min-height: auto;
    }

    /* === Folder Thumbnails Grid === */
    .folders-thumbnail-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .folder-thumbnail {
        height: 120px;
    }

    .folder-thumbnail-info {
        padding: 6px 8px;
    }

    .folder-thumbnail-name {
        font-size: 0.75rem;
    }

    .folder-thumbnail-code {
        font-size: 0.65rem;
    }

    .folder-thumbnail-meta {
        font-size: 0.7rem;
    }

    .search-tag {
        font-size: 0.6rem;
        padding: 2px 5px;
    }

    .btn-add-folder-cart {
        font-size: 0.75rem;
        padding: 4px 6px;
    }

    /* === Zoho Location Detail === */
    .zoho-card {
        padding: 12px;
    }

    .zoho-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .zoho-card-header h2 {
        font-size: 1.1rem;
    }

    .zoho-fields {
        grid-template-columns: 1fr;
    }

    .zoho-tarifas {
        grid-template-columns: repeat(2, 1fr);
    }

    .zoho-tags {
        gap: 4px;
    }

    .zoho-tag {
        font-size: 0.65rem;
        padding: 3px 6px;
    }

    .zoho-location-header {
        flex-direction: column;
        gap: 6px;
    }

    /* === Admin === */
    .admin-section {
        padding: 12px;
        overflow-x: hidden;
    }

    .admin-section h2 {
        font-size: 1rem;
    }

    .admin-filters {
        flex-direction: column;
    }

    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
        gap: 8px;
    }

    .stat-icon {
        font-size: 1.5rem;
    }

    /* === Analytics Dashboard Mobile === */
    .analytics-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .kpi-card {
        padding: 12px 10px;
        gap: 10px;
    }

    .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        border-radius: 8px;
    }

    .kpi-value {
        font-size: 1.3rem;
    }

    .kpi-label {
        font-size: 0.7rem;
    }

    .analytics-panels-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .analytics-panel {
        padding: 14px;
    }

    .analytics-bar-label {
        min-width: 80px;
        max-width: 80px;
        font-size: 0.72rem;
    }

    .analytics-engagement-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .engagement-metric-value {
        font-size: 1.2rem;
    }

    .analytics-table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .analytics-table-controls {
        width: 100%;
        flex-direction: column;
    }

    .analytics-search-input,
    .analytics-filter-select {
        width: 100%;
        min-width: auto;
    }

    .users-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }

    .users-table {
        font-size: 0.7rem;
        min-width: 500px;
    }

    .users-table th:nth-child(4),
    .users-table td:nth-child(4) {
        display: none;
    }

    .users-table th,
    .users-table td {
        padding: 6px 4px;
    }

    .actions-cell {
        flex-direction: column;
        gap: 4px;
    }

    .btn-action {
        font-size: 0.65rem;
        padding: 4px 8px;
    }

    /* === Packages === */
    .my-packages-grid {
        grid-template-columns: 1fr;
    }

    .package-card {
        padding: 12px;
    }

    .admin-packages-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* === Bulk Actions Bar === */
    .bulk-actions-bar {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px;
    }

    .bulk-actions-bar .btn {
        font-size: 0.75rem;
        padding: 6px 10px;
        min-height: 36px;
    }

    /* === Cart Modal === */
    .cart-items {
        max-height: 50vh;
    }

    /* === Image Search === */
    .zoho-image-dropzone {
        min-height: 100px;
    }

    .zoho-similarity-control {
        flex-direction: column;
        gap: 6px;
    }

    /* === Toggle Form Button === */
    .btn-toggle-form {
        font-size: 0.8rem;
    }

    /* === Toast === */
    .toast {
        bottom: 80px;
        max-width: calc(100vw - 32px);
        font-size: 0.85rem;
    }

    /* === General buttons: touch targets === */
    .btn-primary,
    .btn-secondary,
    .btn {
        min-height: 40px;
    }

    /* === Upload === */
    .upload-container {
        max-width: 100%;
    }

    .upload-dropzone {
        padding: 24px 16px;
    }

    .upload-dropzone .dropzone-content p {
        font-size: 0.85rem;
    }

    /* === Auth Screen === */
    .auth-container {
        padding: 24px 16px;
        max-width: 100%;
        border-radius: 12px;
    }

    .auth-header {
        margin-bottom: 20px;
    }

    .logo-img {
        height: 40px;
    }

    .auth-subtitle {
        font-size: 0.85rem;
    }

    .auth-tabs {
        margin-bottom: 16px;
    }

    .auth-tab {
        min-height: 40px;
        font-size: 0.85rem;
    }

    .auth-form .form-group label {
        font-size: 0.85rem;
    }

    .auth-form input {
        min-height: 44px;
        font-size: 1rem;
    }

    .btn-full {
        min-height: 48px;
        font-size: 1rem;
    }

    .google-btn-container {
        display: flex;
        justify-content: center;
    }

    /* === Fullscreen Viewer === */
    .fullscreen-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }

    .fullscreen-nav {
        width: 40px;
        height: 40px;
        font-size: 1.6rem;
    }

    .fullscreen-prev {
        left: 8px;
    }

    .fullscreen-next {
        right: 8px;
    }

    .fullscreen-viewer-content img {
        max-width: 100vw;
        max-height: 100vh;
    }

    .fullscreen-zoom-hint {
        bottom: 20px;
        font-size: 0.75rem;
        padding: 6px 14px;
    }

    /* === Admin Packages Table === */
    .admin-packages-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }

    .packages-table {
        font-size: 0.7rem;
        min-width: 500px;
    }

    .packages-table th,
    .packages-table td {
        padding: 6px 4px;
        white-space: nowrap;
    }

    /* Hide less important columns on mobile */
    .packages-table th:nth-child(5),
    .packages-table td:nth-child(5),
    .packages-table th:nth-child(6),
    .packages-table td:nth-child(6) {
        display: none;
    }

    /* === Package Activity Modal === */
    .activity-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .activity-stat-value {
        font-size: 1.5rem;
    }

    .activity-dates {
        flex-direction: column;
        gap: 8px;
    }

    .activity-log-item {
        flex-direction: column;
        gap: 4px;
    }

    .activity-log-item .activity-time {
        min-width: auto;
        font-size: 0.75rem;
    }

    /* === Package Details Modal === */
    .package-items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .info-row {
        flex-direction: column;
        gap: 4px;
    }

    .info-label {
        min-width: auto;
    }

    .share-url-container {
        flex-direction: column;
    }

    .share-url-container input {
        width: 100%;
    }

    /* === My Package Cards === */
    .my-package-header h3 {
        font-size: 0.95rem;
    }

    .my-package-actions {
        flex-direction: column;
    }

    .my-package-actions .btn,
    .my-package-actions button {
        width: 100%;
        min-height: 40px;
        text-align: center;
    }

    /* === File Actions in Search Results === */
    .file-actions {
        flex-direction: row;
        justify-content: flex-start;
    }

    /* === Location Cards === */
    .location-card {
        padding: 12px;
    }

    .location-icon {
        font-size: 1.5rem;
    }

    .location-name {
        font-size: 0.9rem;
    }

    /* === Stat Cards === */
    .stat-card {
        padding: 12px;
        gap: 10px;
    }

    .stat-icon {
        font-size: 1.8rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* === Cart Modal === */
    .modal-medium {
        width: calc(100vw - 24px);
        max-width: 100%;
        padding: 20px 16px;
    }

    .modal-large {
        width: calc(100vw - 24px);
        max-width: 100%;
        padding: 20px 16px;
    }

    .cart-item {
        gap: 8px;
    }

    .cart-item-thumb {
        width: 48px;
        height: 48px;
    }

    .cart-item-name {
        font-size: 0.8rem;
    }

    /* === Modal Actions === */
    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }

    .modal-actions button {
        width: 100%;
        min-height: 44px;
    }

    /* === Empty states === */
    .empty-icon {
        font-size: 2.5rem;
    }

    .empty-state p {
        font-size: 0.85rem;
    }

    /* === Debug toggle === */
    .sidebar-footer {
        padding: 12px;
    }

    .sidebar-footer .link-external {
        font-size: 0.8rem;
    }

    /* === Loading overlay === */
    .loading-overlay .spinner {
        width: 36px;
        height: 36px;
    }

    /* === Inline Radio Input === */
    .inline-radio-input {
        width: 80px;
        font-size: 0.85rem;
    }

    /* === Zoho Image Search === */
    .zoho-image-search {
        flex-direction: column;
        gap: 10px;
    }

    .zoho-image-dropzone {
        width: 100%;
    }
}

/* ============================================
   Zoho CRM Integration Card
   ============================================ */

.zoho-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}

.zoho-card-header {
    background: #e8f5e9;
    border-bottom: 1px solid #a5d6a7;
    color: #2e7d32;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.zoho-icon {
    font-size: 1rem;
}

.zoho-title {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
    color: #1b5e20;
}

.zoho-codigo {
    background: #c8e6c9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
}

.zoho-estado {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.zoho-estado.estado-activa {
    background: #10b981;
    color: white;
}

.zoho-estado.estado-inactiva {
    background: #ef4444;
    color: white;
}

.zoho-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 14px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.zoho-badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
}

.zoho-badge-categoria {
    background: #1e40af;
    color: white;
}

.zoho-badge-subcategoria {
    background: #7c3aed;
    color: white;
}

.zoho-badge-caracteristica {
    background: #0d9488;
    color: white;
}

.zoho-card-body {
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.zoho-section {
    margin-bottom: 0;
}

.zoho-section:last-child {
    margin-bottom: 0;
}

.zoho-section-full {
    grid-column: 1 / -1;
}

.zoho-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    color: #1e40af;
    text-transform: uppercase;
    margin-bottom: 6px;
    padding-bottom: 3px;
    border-bottom: 1px solid #e2e8f0;
    letter-spacing: 0.03em;
}

.zoho-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.zoho-field {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.zoho-field-full {
    grid-column: 1 / -1;
}

.zoho-label {
    font-size: 0.58rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.zoho-value {
    font-size: 0.75rem;
    color: #1e293b;
}

.zoho-tarifas {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

.zoho-precio {
    font-weight: 600;
    color: #1e40af;
    font-size: 0.9rem;
}

.zoho-observaciones {
    font-size: 0.72rem;
    color: #475569;
    line-height: 1.4;
    margin: 0;
    background: #f1f5f9;
    padding: 6px 8px;
    border-radius: 4px;
}

.zoho-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #1e40af;
    text-decoration: none;
    font-size: 0.7rem;
    padding: 4px 10px;
    background: #dbeafe;
    border-radius: 4px;
    transition: all 0.15s ease;
    margin-top: 4px;
}

.zoho-link:hover {
    background: #bfdbfe;
    color: #1e3a8a;
}

.zoho-link-inline {
    color: #1e40af;
    text-decoration: none;
}

.zoho-link-inline:hover {
    text-decoration: underline;
}

.zoho-card-body pre {
    background: rgba(255, 255, 255, 0.7);
    padding: 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    overflow-x: auto;
    margin: 0;
}

@media (max-width: 768px) {
    .zoho-fields {
        grid-template-columns: 1fr;
    }

    .zoho-tarifas {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Location Search
   ============================================ */

.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 12px;
}

.location-card {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.location-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.location-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.location-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.location-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-code {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.location-city {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.location-type {
    font-size: 0.75rem;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.location-photo-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.location-address {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .locations-grid {
        grid-template-columns: 1fr;
    }
}

/* Browse Folders: Account search filter */
#section-browse-folders .section-header {
    justify-content: flex-start;
}
.browse-folders-search-wrapper {
    flex: 0 1 350px;
    min-width: 220px;
}
.browse-folders-search-wrapper .autocomplete-combo {
    position: relative;
}
.browse-folders-search-wrapper .autocomplete-combo input[type="text"] {
    font-size: 1rem;
    padding: 10px 32px 10px 36px;
    height: 44px;
}
.browse-folders-search-wrapper .autocomplete-combo-icon {
    top: 14px;
    width: 16px;
    height: 16px;
}
.browse-folders-search-wrapper .autocomplete-combo-clear {
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    font-size: 1.1rem;
}
.browse-folders-search-wrapper .autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
}
@media (max-width: 600px) {
    .browse-folders-search-wrapper {
        flex: 1 1 100%;
        order: 3;
    }
}

/* ============================================
   Folder Thumbnail Cards
   ============================================ */

.folders-thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    align-content: start;
}

.folder-thumbnail-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.12s ease;
}

.folder-thumbnail-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.folder-thumbnail {
    width: 100%;
    aspect-ratio: 16/10;
    background-size: cover;
    background-position: center;
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.folder-thumbnail-placeholder {
    font-size: 1.5rem;
    opacity: 0.3;
}

.folder-thumbnail-info {
    padding: 4px 6px;
    background: #fafbfc;
}

.folder-thumbnail-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.folder-thumbnail-code {
    font-size: 0.58rem;
    color: var(--text-muted);
    display: block;
    margin: 1px 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-thumbnail-count,
.folder-thumbnail-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 3px 0 1px 0;
}

.search-tag {
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.search-tag-match {
    background: var(--success-light);
    color: #047857;
}

.search-tag-dim {
    background: #f1f5f9;
    color: #94a3b8;
}

.search-highlight {
    background: var(--success-light);
    color: #047857;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Mobile folder thumbnail overrides moved to main 768px media query block */

/* ============================================
   Debug JSON Display
   ============================================ */

.debug-json {
    background: #1e1e1e;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    overflow: hidden;
}

.debug-section {
    margin-bottom: 16px;
}

.debug-section:last-child {
    margin-bottom: 0;
}

.debug-section h4 {
    color: #4fc3f7;
    margin: 0 0 8px 0;
    font-size: 0.85rem;
}

.debug-json pre {
    background: #2d2d2d;
    color: #a5d6a7;
    padding: 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* ============================================
   Zoho Sync Button and Modal
   ============================================ */

.btn-sync-zoho {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f5a623 0%, #f78b00 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.btn-sync-zoho:hover {
    background: linear-gradient(135deg, #f78b00 0%, #e07d00 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 166, 35, 0.3);
}

.btn-sync-zoho:active {
    transform: translateY(0);
}

.sync-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sync-modal {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.sync-modal-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sync-modal-header.sync-success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
}

.sync-modal-header.sync-error {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
}

.sync-icon {
    font-size: 1.5rem;
}

.sync-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.sync-modal-body {
    padding: 24px;
    text-align: left;
}

.sync-step-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.sync-step-result:last-child {
    border-bottom: none;
}

.sync-step-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
}

.sync-step-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    min-width: 0;
}

.sync-step-detail {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.sync-modal-footer {
    padding: 16px 24px;
    background: #f8f9fa;
    display: flex;
    justify-content: center;
}

.sync-modal-footer .btn-primary {
    min-width: 120px;
}

/* ============================================
   Toggle Form Button
   ============================================ */

.btn-toggle-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-toggle-form:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.toggle-form-icon {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
    display: inline-block;
}

.btn-toggle-form.collapsed .toggle-form-icon {
    transform: rotate(180deg);
}

.zoho-search-form.collapsed > .zoho-form-main {
    display: none;
}

/* ============================================
   Zoho Search Section
   ============================================ */

.zoho-search-form {
    margin-bottom: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.zoho-form-main {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.zoho-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.zoho-form-row-options {
    gap: 10px;
}

.sunlocs-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.2s;
}

.sunlocs-controls.disabled {
    opacity: 0.35;
    pointer-events: none;
}


.radio-inline-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 42px;
}

.filter-group-radio {
    min-width: auto !important;
}

.zoho-form-row .filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 150px;
}

.zoho-form-row .filter-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.zoho-form-row .filter-group select,
.zoho-form-row .filter-group input {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.zoho-form-row .filter-group select:focus,
.zoho-form-row .filter-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.zoho-form-row .filter-group-text {
    flex: 1;
    min-width: 200px;
}

/* Search mode toggle (Text / Image) */
.search-mode-toggle {
    display: flex;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    padding: 2px;
    align-self: center;
}

.search-mode-btn {
    padding: 8px 14px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
}

.search-mode-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* Zoho image search (thumbnail dropzone) */
.zoho-image-search {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.zoho-image-dropzone {
    position: relative;
    width: 120px;
    height: 90px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.zoho-image-dropzone.has-image {
    border-style: solid;
    border-color: var(--primary);
}

.zoho-image-dropzone:hover {
    border-color: var(--primary);
}

.zoho-image-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.zoho-dropzone-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    pointer-events: none;
    text-align: center;
    padding: 4px;
    line-height: 1.3;
}

.zoho-image-preview {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoho-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.btn-remove-preview-sm {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoho-similarity-control {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.zoho-similarity-control input[type="range"] {
    width: 100px;
}

#zohoSunlocsControls {
    display: contents;
}

#zohoSunlocsControls.hidden {
    display: none;
}

.zoho-btn-buscar {
    margin-left: auto;
    padding: 10px 24px;
    font-weight: 500;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Similitud Slider */

.similitud-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.similitud-slider-container.active {
    opacity: 1;
    pointer-events: auto;
}

.similitud-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.similitud-label-left {
    color: #64748b;
}

.similitud-label-right {
    color: #059669;
}

.similitud-slider {
    width: 200px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #cbd5e1, #059669);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.similitud-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid #059669;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease;
}

.similitud-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.similitud-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid #059669;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.similitud-slider:disabled {
    cursor: not-allowed;
}

.similitud-slider:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
    border-color: #94a3b8;
}

.similitud-slider:disabled::-moz-range-thumb {
    cursor: not-allowed;
    border-color: #94a3b8;
}

.zoho-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 16px;
}

.zoho-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}

.zoho-result-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.zoho-result-header {
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.zoho-result-icon {
    font-size: 1.2rem;
}

.zoho-result-name {
    font-weight: 600;
    font-size: 1rem;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zoho-result-codigo {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.zoho-result-body {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.zoho-result-location {
    font-size: 0.9rem;
    color: var(--text-secondary);
    width: 100%;
    margin-bottom: 4px;
}

.zoho-detail-view {
    padding: 20px;
}

.zoho-detail-view .btn-secondary {
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .zoho-form-row .filter-group {
        width: 100%;
    }

    .zoho-results-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Admin Section
   ============================================ */

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.admin-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.admin-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Backup & Restore */
.backup-restore-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.backup-card {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.backup-card-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.backup-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.backup-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.4;
}

.restore-upload-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.restore-file-name {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

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

@media (max-width: 768px) {
    .backup-restore-container {
        grid-template-columns: 1fr;
    }
}

.admin-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.admin-filters input,
.admin-filters select {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 180px;
}

.admin-filters input:focus,
.admin-filters select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-invite-member {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    margin-bottom: 20px;
    background: var(--primary);
    color: #fff;
    border: 2px dashed rgba(255,255,255,0.4);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-invite-member:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-invite-member:active {
    transform: translateY(0);
}

.users-table-container {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.users-table th,
.users-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.users-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
}

.users-table tbody tr:hover {
    background: var(--bg-hover);
}

.users-table .user-banned {
    background: #fff5f5;
}

.users-table .user-banned:hover {
    background: #ffe8e8;
}

.users-table .user-current {
    background: #f0f9ff;
}

.user-email-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary-text);
    flex-shrink: 0;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: #dcfce7;
    color: #16a34a;
}

.status-banned {
    background: #fee2e2;
    color: #dc2626;
}

.status-pending {
    background: #fef2f2;
    color: #b91c1c;
}

.role-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-admin {
    background: #fef3c7;
    color: #d97706;
}

.role-user {
    background: #e0e7ff;
    color: #4f46e5;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-action {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.btn-action:hover {
    transform: translateY(-1px);
}

.btn-ban {
    color: #d97706;
    border-color: #d97706;
}

.btn-ban:hover {
    background: #d97706;
    color: white;
}

.btn-unban {
    color: #16a34a;
    border-color: #16a34a;
}

.btn-unban:hover {
    background: #16a34a;
    color: white;
}

.btn-make-admin {
    color: #4f46e5;
    border-color: #4f46e5;
}

.btn-make-admin:hover {
    background: #4f46e5;
    color: white;
}

.btn-remove-admin {
    color: #6b7280;
    border-color: #6b7280;
}

.btn-remove-admin:hover {
    background: #6b7280;
    color: white;
}

.btn-delete {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-delete:hover {
    background: #dc2626;
    color: white;
}

.current-user-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.activity-log {
    max-height: 300px;
    overflow-y: auto;
}

.activity-entry {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-entry:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 140px;
}

.activity-text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-filters {
        flex-direction: column;
    }

    .admin-filters input,
    .admin-filters select {
        width: 100%;
    }

    .users-table {
        font-size: 0.8rem;
    }

    .users-table th,
    .users-table td {
        padding: 8px 10px;
    }

    .actions-cell {
        flex-direction: column;
    }
}

/* ============================================
   Package Cart System
   ============================================ */

/* Cart Button in Sidebar */
.cart-button-container {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.btn-cart {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    position: relative;
}

.btn-cart:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    background: var(--error);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Add to Cart Buttons */
.btn-add-cart {
    padding: 8px 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-add-cart:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: scale(1.05);
}

.btn-add-folder-cart {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 6px 10px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    z-index: 10;
}

.folder-thumbnail-card {
    position: relative;
}

.folder-thumbnail-card:hover .btn-add-folder-cart {
    opacity: 1;
}

.btn-add-folder-cart:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: scale(1.05);
}

.btn-add-subfolder-cart {
    flex-shrink: 0;
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
    opacity: 0;
    transition: opacity 0.15s;
}

.folder-card:hover .btn-add-subfolder-cart {
    opacity: 1;
}

/* Location heart indicator on folder thumbnail cards */
.loc-heart-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: transform 0.2s, background 0.2s;
    padding: 0;
    line-height: 1;
}

.loc-heart-btn:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.15);
}

.loc-heart-btn .heart {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s;
    pointer-events: none;
}

.loc-heart-btn.partial .heart {
    color: #f6ad55;
}

.loc-heart-btn.partial {
    background: rgba(255, 255, 255, 0.85);
}

.loc-heart-btn.all .heart {
    color: #ef4444;
}

.loc-heart-btn.all {
    background: rgba(255, 255, 255, 0.9);
}

@keyframes locHeartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

.loc-heart-btn.pop .heart {
    animation: locHeartPop 0.35s ease;
}

/* File item with actions */
.file-item {
    display: flex;
    gap: 14px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.12s ease;
}

.file-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Modal Sizes */
.modal-medium {
    width: 560px;
    max-width: 95vw;
    padding: 28px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-large {
    width: 800px;
    max-width: 95vw;
    padding: 28px;
    max-height: 92vh;
    overflow-y: auto;
}

/* Cart Modal */
.cart-items-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    align-items: center;
}

.cart-item-thumb {
    width: 60px;
    height: 60px;
    background-size: cover;
    background-position: center;
    background-color: var(--border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.cart-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.btn-remove-cart {
    width: 32px;
    height: 32px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-remove-cart:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Package Success Modal */
.share-url-container {
    display: flex;
    gap: 8px;
}

.share-url-container input {
    flex: 1;
    padding: 12px;
    font-size: 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* My Packages Grid */
/* ===== Projects Section ===== */

.projects-grid {
    width: 100%;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.project-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.project-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.project-card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    white-space: nowrap;
}

.project-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.project-detail {
    display: flex;
    gap: 6px;
    font-size: 0.85rem;
}

.project-card-actions {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

/* Project Detail View */

.project-detail-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.project-info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.project-summary-card {
    padding: 20px 24px;
}

.project-summary-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 32px;
}

.project-summary-columns.single-column {
    grid-template-columns: 1fr;
}

.project-summary-section {
    min-width: 0;
}

.project-section-title {
    margin: 0 0 10px 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-summary-divider {
    height: 1px;
    background: var(--border);
    margin: 14px 0;
}

.project-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.project-info-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.project-info-grid.dates-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.project-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-info-item.full-width {
    grid-column: 1 / -1;
}

.project-info-item .info-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-info-item .info-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.project-price {
    font-weight: 600;
    color: var(--primary) !important;
}

/* Project Folder Groups */

.project-folders {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.project-folder-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.project-folder-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.folder-icon {
    font-size: 1.2rem;
}

.folder-name {
    flex: 1;
}

.folder-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

.project-folder-packages {
    display: flex;
    flex-direction: column;
}

.project-package-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.project-package-item:last-child {
    border-bottom: none;
}

.project-package-item.expired {
    opacity: 0.6;
}

.project-pkg-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.project-pkg-name {
    font-weight: 500;
}

.project-pkg-meta {
    display: flex;
    gap: 16px;
    font-size: 0.83rem;
    color: var(--text-muted);
}

.project-pkg-actions {
    display: flex;
    gap: 6px;
}

/* Project Browser - File Navigation */

.project-browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 12px;
}

.project-browser-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
    overflow: hidden;
}

.project-browser-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.project-browser-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    flex: 1;
    min-width: 0;
}

.project-browser-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.project-browser-card-body {
    flex: 1;
    min-width: 0;
}

.project-browser-card-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-browser-card-meta {
    display: flex;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    flex-wrap: wrap;
}

.project-browser-card-with-actions {
    flex-wrap: wrap;
}

.project-browser-card-actions {
    width: 100%;
    padding: 0 16px 12px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: -4px;
}

.btn-unlink {
    color: #dc2626;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-unlink:hover {
    color: #fff;
    border-color: #dc2626;
    background: #dc2626;
}

.btn-unlink-table {
    color: #dc2626 !important;
    background: #fee2e2 !important;
    border: 1px solid #fca5a5 !important;
}

.btn-unlink-table:hover {
    color: #fff !important;
    background: #dc2626 !important;
}

/* Photo Grid in Project Browser */

.project-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.project-photo-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s ease;
}

.project-photo-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.project-photo-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--bg-secondary);
}

.project-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-photo-name {
    padding: 8px 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 600px) {
    .project-browser-grid {
        grid-template-columns: 1fr;
    }
    .project-photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
}

/* Create Project Modal - Form Layout */

.input-error {
    border-color: var(--error) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.project-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.project-form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.project-form-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 20px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.project-search-bar {
    display: flex;
    gap: 8px;
}

.project-search-bar input {
    flex: 1;
}

.input-currency-wrap {
    display: flex;
    align-items: center;
    position: relative;
}

.input-currency-wrap input {
    flex: 1;
    padding-right: 32px;
}

.input-currency-symbol {
    position: absolute;
    right: 12px;
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    user-select: none;
}

/* Coordinate fields (lat/lng) - compact */
.coords-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.coords-row .form-group {
    flex: 0 0 auto;
}
.coords-row .form-group input {
    width: 130px;
}
.coords-edit-toggle {
    padding-bottom: 10px;
    white-space: nowrap;
}

.project-dropdown-results {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 6px;
    background: var(--bg-card);
}

.project-dropdown-results.autocomplete-dropdown {
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    max-height: 180px;
}

.autocomplete-loading,
.autocomplete-empty {
    padding: 10px 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.project-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.project-dropdown-item:last-child {
    border-bottom: none;
}

.project-dropdown-item:hover {
    background: var(--bg-secondary);
}

/* Project combo (searchable dropdown for packages) */
.project-combo {
    position: relative;
}

.project-combo::after {
    content: '▾';
    position: absolute;
    right: 12px;
    top: 10px;
    pointer-events: none;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
}

.project-combo input[type="text"] {
    width: 100%;
    padding-right: 32px;
    cursor: pointer;
}

.project-combo-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
    background: var(--bg-card);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.project-combo-results.open {
    display: block;
}

.project-combo-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.project-combo-item:last-child {
    border-bottom: none;
}

.project-combo-item:hover {
    background: var(--bg-secondary);
}

.project-combo-item.no-project {
    color: var(--text-muted);
    font-style: italic;
}

/* Autocomplete combo (searchable select field) */
.autocomplete-combo {
    position: relative;
}

.autocomplete-combo-icon {
    position: absolute;
    left: 10px;
    top: 11px;
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.autocomplete-combo input[type="text"] {
    padding-left: 32px;
    padding-right: 28px;
    width: 100%;
}

.autocomplete-combo-clear {
    position: absolute;
    right: 6px;
    top: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 50%;
    z-index: 1;
}

.autocomplete-combo-clear:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.autocomplete-combo.has-selection input[type="text"] {
    border-color: var(--primary);
    background-color: color-mix(in srgb, var(--primary) 6%, var(--bg-card));
    font-weight: 500;
    cursor: pointer;
}

.autocomplete-combo.has-selection .autocomplete-combo-icon {
    color: var(--primary);
}

/* Visual cue: pencil icon on hover for inline-edit autocomplete fields with selection */
.crud-inline-edit-body .autocomplete-combo.has-selection::after {
    content: '\270E';
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 0.85rem;
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.15s;
}

.crud-inline-edit-body .autocomplete-combo.has-selection:hover::after {
    opacity: 1;
}

/* Project Members / Team */
.project-members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.project-member-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.project-member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.project-member-info {
    flex: 1;
    min-width: 0;
}

.project-member-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-member-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 3px;
    font-size: 0.78rem;
    color: var(--text-muted);
    align-items: center;
}

.project-member-role-badge {
    background: var(--primary-light, rgba(37, 99, 235, 0.1));
    color: var(--primary);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}

.project-member-dept {
    color: var(--text-muted);
}

.project-member-perm {
    color: var(--text-muted);
    font-style: italic;
}

.project-member-status {
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}

.member-status-invited {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.member-status-accepted {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.member-status-nda {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

.member-status-active {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.member-status-revoked {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.project-member-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .project-member-card {
        flex-wrap: wrap;
    }
    .project-member-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
    }
}

/* Decorados */
.project-decorados-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-decorado-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}

/* Decorados display in detail view */
.project-decorados-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-decorado-tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* ===== Decorados Management ===== */

.decorados-mgmt {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}

.decorados-mgmt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.decorados-mgmt-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.decorados-mgmt-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    padding: 8px 0;
}

/* Decorados Table */
.decorados-table-wrap {
    overflow-x: auto;
}

.decorados-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.decorados-table thead th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.decorados-table-row {
    cursor: pointer;
    transition: background 0.15s;
}

.decorados-table-row:hover {
    background: var(--bg-secondary);
}

.decorados-table-row td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.decorados-table-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.decorados-table-desc {
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.4;
}

.decorados-table-files {
    color: var(--text-muted);
    white-space: nowrap;
}

/* Decorado adjuntos previews in table */
.dec-adjuntos-cell {
    min-width: 60px;
}

.dec-adjuntos-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.dec-adjunto-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    border: 1px solid var(--border-light);
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.dec-adjunto-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    z-index: 2;
}

.dec-adjunto-loading {
    background: var(--bg-secondary);
    animation: dec-thumb-pulse 1s ease-in-out infinite alternate;
}

@keyframes dec-thumb-pulse {
    from { opacity: 0.4; }
    to { opacity: 0.8; }
}

.dec-adjunto-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.dec-adjunto-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    z-index: 2;
}

.dec-adjunto-pdf {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.dec-adjunto-pdf:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    z-index: 2;
}

.dec-adjunto-pdf svg {
    width: 100%;
    height: 100%;
}

.decorado-file-icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

/* ============================================================
   Decorados + Packages Unified Section
   ============================================================ */

.decorados-packages-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.decorados-packages-section .decorados-mgmt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.decorados-packages-section .decorados-mgmt-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.decorados-mgmt-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-filter-favs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filter-favs:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.btn-filter-favs.active {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    font-weight: 600;
}

.btn-director-favs {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.18);
    color: #7c3aed;
}

.btn-director-favs:hover {
    border-color: #7c3aed;
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.12);
}

.btn-director-favs.active {
    border-color: #7c3aed;
    background: rgba(124, 58, 237, 0.15);
    color: #7c3aed;
    font-weight: 600;
}

/* Decorado Card */
.deco-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.deco-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.deco-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.deco-card-header:hover {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-secondary) 100%);
}

.deco-card-header-muted {
    cursor: default;
    background: var(--bg-card);
}

.deco-card-header-muted:hover {
    background: var(--bg-card);
}

.deco-card-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.deco-card-info {
    flex: 1;
    min-width: 0;
}

.deco-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.deco-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deco-card-files {
    flex-shrink: 0;
}

.deco-card-files .dec-adjuntos-previews {
    display: flex;
    gap: 4px;
    align-items: center;
}

.deco-card-files .dec-adjunto-thumb,
.deco-card-files .dec-adjunto-icon,
.deco-card-files .dec-adjunto-pdf {
    width: 32px;
    height: 32px;
}

.deco-card-badge {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.deco-card-locations-btn {
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: 4px;
}

.deco-card-docs-btn {
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: 4px;
}

/* Decorado Documents Grid Viewer */
.deco-docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding: 4px;
}

.deco-doc-card {
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.deco-doc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.deco-doc-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.deco-doc-thumb-loading {
    background: var(--bg-secondary);
    animation: dec-thumb-pulse 1s ease-in-out infinite alternate;
}

.deco-doc-thumb-loaded {
    background-color: transparent;
}

.deco-doc-thumb-pdf {
    background: #fef2f2;
}

.deco-doc-thumb-pdf svg {
    width: 64px;
    height: 64px;
}

.deco-doc-thumb-icon {
    background: var(--bg-secondary);
}

.deco-doc-thumb-icon span {
    font-size: 2.5rem;
}

.deco-doc-info {
    padding: 8px;
}

.deco-doc-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deco-doc-size {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}

@media (max-width: 600px) {
    .deco-docs-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
}

.deco-loc-fav-heart {
    position: absolute;
    top: 6px;
    right: 6px;
    color: #ef4444;
    font-size: 0.85rem;
    pointer-events: none;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Nested package rows inside decorado card */
.deco-card-packages {
    display: flex;
    flex-direction: column;
}

.deco-pkg-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px 12px 40px;
    border-bottom: 1px solid var(--border-light, var(--border));
    flex-wrap: wrap;
    position: relative;
    transition: background 0.12s;
}

.deco-pkg-row::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.deco-pkg-row:last-child {
    border-bottom: none;
}

.deco-pkg-row:last-child::before {
    bottom: 50%;
}

.deco-pkg-row:hover {
    background: var(--bg-secondary);
}

.deco-pkg-row.expired {
    opacity: 0.6;
}

.deco-pkg-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 0;
    min-width: 150px;
    overflow: hidden;
}

.deco-pkg-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.deco-pkg-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.deco-pkg-likes {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    flex: 0 0 50px;
    min-width: 50px;
    justify-content: center;
}

.deco-pkg-likes-heart {
    font-size: 0.75rem;
    color: #d4d4d4;
    transition: color 0.2s, background 0.2s;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
}

.deco-pkg-likes.has-likes .deco-pkg-likes-heart {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.deco-pkg-likes.has-likes {
    color: #ef4444;
    font-weight: 600;
}

.deco-pkg-likes-count {
    font-variant-numeric: tabular-nums;
}

/* Package table header row */
.deco-pkg-header-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 20px 8px 40px;
    border-bottom: 2px solid var(--border);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.deco-pkg-header-row .deco-pkg-main {
    font-size: inherit;
    font-weight: inherit;
}

.deco-pkg-header-row .deco-pkg-meta {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.deco-pkg-likes-header {
    min-width: 50px;
    flex: 0 0 50px;
    text-align: center;
}

.deco-pkg-actions-header {
    min-width: 100px;
    flex: 0 0 100px;
    text-align: center;
}

.deco-pkg-folder {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
}

.deco-pkg-desc-col {
    flex: 1 1 0;
    min-width: 120px;
    overflow: hidden;
}

.deco-pkg-desc {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary, var(--text-muted));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deco-pkg-header-row .deco-pkg-desc-col {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.deco-pkg-opened {
    color: var(--text-muted);
    white-space: nowrap;
}

.deco-pkg-meta {
    display: flex;
    gap: 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex: 1.5 1 0;
    min-width: 0;
}

.deco-pkg-meta > span {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deco-pkg-actions {
    display: flex;
    gap: 6px;
    min-width: 100px;
    flex-shrink: 0;
}

/* No-decorado card */
.deco-card-no-decorado {
    border-style: dashed;
    opacity: 0.85;
}

.deco-card-no-decorado .deco-card-badge {
    color: var(--text-muted);
    background: var(--bg-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .deco-card-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }

    .deco-card-files {
        display: none;
    }

    .deco-pkg-row {
        padding: 10px 14px 10px 30px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .deco-pkg-row::before {
        left: 16px;
    }

    .deco-pkg-meta {
        flex-wrap: wrap;
        gap: 8px;
    }

    .deco-pkg-header-row {
        display: none;
    }
}

.decorado-file-icon-svg svg {
    width: 24px;
    height: 24px;
}

/* Decorado file lightbox */
.dec-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.dec-lightbox-overlay.show {
    display: flex;
}

.dec-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dec-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.5rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.15s;
}

.dec-lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

.dec-lightbox-img {
    max-width: 85vw;
    max-height: 75vh;
    border-radius: 8px;
    object-fit: contain;
    transition: opacity 0.3s;
}

.dec-lightbox-footer {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.dec-lightbox-name {
    color: #fff;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Expanded Decorado Row in Form */
.decorado-row-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.decorado-row-top {
    display: flex;
    gap: 8px;
    align-items: center;
}

.decorado-row-top .decorado-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.decorado-row-top .decorado-input:focus {
    outline: none;
    border-color: var(--primary);
}

.decorado-desc-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.decorado-desc-input:focus {
    outline: none;
    border-color: var(--primary);
}

.decorado-row-file {
    display: flex;
    align-items: center;
    gap: 8px;
}

.decorado-file-label {
    cursor: pointer;
    white-space: nowrap;
}

.decorado-file-names {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.decorados-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.decorado-card {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.decorado-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.decorado-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.decorado-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.decorado-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Decorado Detail View */

.decorado-detail-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.decorado-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.decorado-detail-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.decorado-detail-name h2 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.decorado-detail-actions {
    display: flex;
    gap: 8px;
}

.decorado-name-edit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.decorado-name-edit-input {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    min-width: 250px;
}

.decorado-detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.decorado-section-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.decorado-descripcion-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.decorado-descripcion-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.decorado-save-desc-btn {
    margin-top: 10px;
}

/* Decorado Files */

.decorado-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.decorado-files-header .decorado-section-label {
    margin-bottom: 0;
}

.decorado-upload-btn {
    cursor: pointer;
}

.decorado-files-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.decorado-files-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.decorado-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.decorado-file-row:last-child {
    border-bottom: none;
}

.decorado-file-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.decorado-file-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.decorado-file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.decorado-file-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .decorados-cards {
        grid-template-columns: 1fr;
    }

    .decorados-table-desc {
        max-width: 200px;
    }

    .decorado-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .decorado-name-edit-input {
        min-width: 0;
        width: 100%;
    }

    .decorado-files-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .decorado-row-file {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Project Share Bar */
.project-share-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
}

.project-share-url {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.project-share-url .share-url-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.project-access-key {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.access-key-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.access-key-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #92400e;
    letter-spacing: 2px;
    background: transparent;
    padding: 0;
}

@media (max-width: 768px) {
    .project-share-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .project-share-url {
        flex-direction: column;
    }

    .project-share-url .share-url-input {
        width: 100%;
    }

    .project-form-grid,
    .project-form-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ── Director Share Bar ── */
.project-director-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f5f3ff;
    border: 1px solid #c4b5fd;
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-top: 8px;
}

.project-director-bar .director-bar-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #6d28d9;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-director-bar .share-url-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #c4b5fd;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: white;
}

.project-director-bar .project-access-key {
    background: #ede9fe;
    border-color: #c4b5fd;
}

.project-director-bar .access-key-value {
    color: #5b21b6;
}

/* Director selection badge in deco card */
.deco-director-selection {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px 10px 40px;
    border-top: 1px solid var(--border-light, var(--border));
    background: #faf5ff;
    font-size: 0.82rem;
}

.deco-director-selection-icon {
    font-size: 0.9rem;
}

.deco-director-selection-label {
    font-weight: 600;
    color: #6d28d9;
}

.deco-director-selection-count {
    font-weight: 700;
    color: #7c3aed;
    background: #ede9fe;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
}

.deco-director-selection .btn-small {
    margin-left: auto;
    background: #7c3aed;
    color: white;
    border: none;
    font-size: 0.78rem;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.deco-director-selection .btn-small:hover {
    background: #6d28d9;
}

@media (max-width: 768px) {
    .project-director-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ===== End Projects Section ===== */

.my-packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(350px, 100%), 1fr));
    gap: 20px;
}

.my-package-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s;
}

.my-package-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.my-package-card.expired {
    opacity: 0.7;
    background: #fafafa;
}

.my-package-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.my-package-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.package-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.package-status-active {
    background: #dcfce7;
    color: #16a34a;
}

.package-status-expired {
    background: #fee2e2;
    color: #dc2626;
}

.package-opened {
    font-size: 0.8rem;
    color: #16a34a;
}

.package-unopened {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.badge-project {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #dcfce7;
    color: #16a34a;
    white-space: nowrap;
}

.badge-no-project {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #fef9c3;
    color: #a16207;
    white-space: nowrap;
}

.my-package-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.my-package-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.my-package-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* Package Details Modal */
.package-details-content {
    padding: 0;
}

.package-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.package-details-header h3 {
    font-size: 1.3rem;
    margin: 0;
}

.package-details-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.package-details-info {
    background: var(--bg-hover);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.info-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

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

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 80px;
}

.info-value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-url-input {
    flex: 1;
    padding: 8px;
    font-size: 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.package-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.package-item-card {
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.package-item-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.package-item-thumb.clickable {
    cursor: pointer;
    transition: opacity 0.15s;
}

.package-item-thumb.clickable:hover {
    opacity: 0.85;
}

.package-item-info {
    padding: 8px;
}

.package-item-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.package-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}

.package-item-type {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.btn-tiny {
    width: 20px;
    height: 20px;
    padding: 0;
    font-size: 0.65rem;
    line-height: 1;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-muted);
    transition: all 0.15s;
}

.btn-tiny.btn-danger:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Admin Packages Table */
.packages-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.packages-table th,
.packages-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.packages-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
}

.packages-table th.sortable-th {
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: nowrap;
}

.packages-table th.sortable-th:hover {
    background: #edf0f3;
    color: var(--text-primary);
}

.sort-icon {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 4px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.3;
    border-bottom: 5px solid currentColor;
}

.packages-table th.sortable-th:hover .sort-icon {
    opacity: 0.5;
}

.sort-icon.sort-asc {
    border-bottom: 5px solid currentColor;
    border-top: none;
    opacity: 1;
}

.sort-icon.sort-desc {
    border-top: 5px solid currentColor;
    border-bottom: none;
    opacity: 1;
}

.packages-table tbody tr:hover {
    background: var(--bg-hover);
}

.packages-table .row-expired {
    background: #fafafa;
    opacity: 0.8;
}

.table-responsive {
    overflow-x: auto;
}

.table-actions {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

.btn-share-project {
    background: var(--primary-light, #e8f0fe);
    color: var(--primary, #1a73e8);
    border: 1px solid var(--primary, #1a73e8);
    border-radius: 4px;
}

.btn-share-project:hover {
    background: var(--primary, #1a73e8);
    color: #fff;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: var(--bg-hover);
}

/* Shared project indicators */
.shared-project-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--primary-light, #e8f0fe);
    color: var(--primary, #1a73e8);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.shared-project-row {
    border-left: 3px solid var(--primary, #1a73e8);
}

.shared-project-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--primary-light, #e8f0fe);
    border: 1px solid var(--primary, #1a73e8);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.shared-project-banner-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.shared-project-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shared-project-banner-text strong {
    color: var(--primary, #1a73e8);
    font-size: 0.95rem;
}

.shared-project-banner-text span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ============================================
   Analytics Dashboard - KPI Cards
   ============================================ */

.analytics-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow 0.2s, transform 0.15s;
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.kpi-blue { background: #eff6ff; }
.kpi-green { background: #f0fdf4; }
.kpi-orange { background: #fff7ed; }
.kpi-purple { background: #faf5ff; }
.kpi-cyan { background: #ecfeff; }
.kpi-red { background: #fef2f2; }

.kpi-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.kpi-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Analytics Panels
   ============================================ */

.analytics-panels-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.analytics-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.analytics-panel h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* Bar Charts */
.analytics-chart-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-bar-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    min-width: 120px;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.analytics-bar-track {
    flex: 1;
    height: 20px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 4px;
}

.analytics-bar-blue { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.analytics-bar-green { background: linear-gradient(90deg, #4ade80, #22c55e); }
.analytics-bar-purple { background: linear-gradient(90deg, #c084fc, #a855f7); }
.analytics-bar-cyan { background: linear-gradient(90deg, #22d3ee, #06b6d4); }

.analytics-bar-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* Engagement Grid */
.analytics-engagement-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.engagement-metric {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
}

.engagement-metric-highlight {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.engagement-metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.engagement-metric-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.3;
}

.engagement-mini-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.engagement-mini-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Timeline */
.analytics-timeline {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.timeline-item:hover {
    background: var(--bg-hover);
}

.timeline-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.timeline-desc {
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.timeline-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Table Header with Filters */
.analytics-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.analytics-table-header h2 {
    margin-bottom: 0 !important;
}

.analytics-table-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.analytics-search-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input, #fff);
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 180px;
}

.analytics-search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.analytics-filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input, #fff);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.analytics-filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Table Metric Cells */
.table-metric {
    font-weight: 600;
    color: var(--text-primary);
}

.table-metric-sub {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Empty State Small */
.empty-state-small {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 24px 12px;
}

/* Activity Section Block */
.activity-section-block {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.activity-section-block h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Package Activity Modal */
.package-activity-content h3 {
    margin-bottom: 20px;
}

.activity-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.activity-stat {
    background: var(--bg-hover);
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}

.activity-stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.activity-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.activity-dates {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.activity-log-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-log-item {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

.activity-log-item .activity-time {
    color: var(--text-muted);
    min-width: 160px;
}

.activity-log-item .activity-ip {
    color: var(--text-secondary);
}

.activity-log-item .activity-detail {
    color: var(--text-primary);
    font-weight: 500;
}

@media (max-width: 768px) {
    .project-summary-columns {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .project-summary-columns > .project-summary-section + .project-summary-section {
        border-top: 1px solid var(--border);
        margin-top: 12px;
        padding-top: 12px;
    }

    .project-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .project-info-grid.compact {
        grid-template-columns: 1fr 1fr;
    }

    .project-package-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .project-pkg-meta {
        flex-wrap: wrap;
        gap: 8px;
    }

    .my-packages-grid {
        grid-template-columns: 1fr;
    }

    .activity-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .my-package-details {
        grid-template-columns: 1fr;
    }

    .packages-table {
        font-size: 0.78rem;
    }

    .packages-table th,
    .packages-table td {
        padding: 8px 6px;
    }
}

/* ============================================
   Mobile Header & Sidebar Toggle
   ============================================ */

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 999;
}

.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    border: none;
    background: none;
    cursor: pointer;
}

.hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: all 0.2s;
}

.mobile-logo-img {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.btn-cart-mobile {
    position: relative;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
}

.btn-cart-mobile .cart-badge {
    position: absolute;
    top: 2px;
    right: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

/* Mobile Header Right Group */
.mobile-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Mobile User Button & Dropdown */
.mobile-user-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Avatar inside bottom nav: smaller */
.mobile-nav-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mobile-user-dropdown {
    display: none;
    position: fixed;
    bottom: 62px;
    right: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px 16px;
    z-index: 1002;
    min-width: 220px;
}

.mobile-user-dropdown.show {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-user-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.mobile-user-logout {
    padding: 8px 12px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    min-width: 56px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.mobile-nav-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }
}

/* ============================================
   Photo Modal Actions (download, link, cart)
   ============================================ */

.photo-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.photo-modal-actions .btn {
    padding: 10px 14px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.2s;
    text-align: center;
    width: 100%;
}

.photo-modal-actions .btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.photo-modal-actions .btn.btn-primary {
    background: var(--primary);
    color: var(--primary-text);
    border-color: var(--primary);
}

.photo-modal-actions .btn.btn-primary:hover {
    background: var(--primary-hover);
}

.photo-modal-actions .modal-cart-action {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.photo-description,
.photo-tags,
.photo-camera-info,
.photo-directory {
    margin-bottom: 14px;
}

/* Fullscreen button on photo */
.btn-fullscreen {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.4rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-fullscreen:hover {
    background: var(--primary);
}

.photo-modal-image img {
    cursor: zoom-in;
}

/* ============================================
   Fullscreen Photo Viewer
   ============================================ */

.fullscreen-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 5000;
    align-items: center;
    justify-content: center;
}

.fullscreen-viewer.show {
    display: flex;
}

.fullscreen-viewer-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
    overflow: hidden;
}

.fullscreen-viewer-content img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    transition: transform 0.15s ease;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

.fullscreen-zoom-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.fullscreen-zoom-hint.show {
    opacity: 1;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.8rem;
    transition: background 0.2s;
}

.fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fullscreen-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 2.2rem;
    transition: background 0.2s;
}

.fullscreen-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.fullscreen-prev {
    left: 24px;
}

.fullscreen-next {
    right: 24px;
}

/* Search results container */
.search-results-container {
    display: block;
}

/* ============================================
   Bulk Select for Search Results
   ============================================ */

.bulk-actions-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--primary-light);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.bulk-actions-bar .btn-select-all {
    padding: 6px 14px;
    font-size: 0.85rem;
    border: 1px solid var(--primary);
    background: var(--bg-card);
    color: var(--primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.bulk-actions-bar .btn-select-all:hover,
.bulk-actions-bar .btn-select-all.active {
    background: var(--primary);
    color: white;
}

.bulk-actions-bar .btn-add-selected {
    padding: 6px 14px;
    font-size: 0.85rem;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.bulk-actions-bar .btn-add-selected:hover {
    background: var(--primary-hover);
}

.bulk-actions-bar .btn-add-selected:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bulk-actions-bar .selected-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.file-item.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

.file-select-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 4px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
    align-self: center;
}

/* ============================================
   CRUD Screens (Accounts, Contacts, Locations)
   ============================================ */

.crud-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.crud-filters input,
.crud-filters select {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 180px;
}

.crud-filters input {
    flex: 1;
    min-width: 220px;
    max-width: 400px;
}

.crud-filters input:focus,
.crud-filters select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.crud-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.crud-stat-badge {
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 4px 12px;
    border-radius: 20px;
}

.crud-stat-badge strong {
    color: var(--text-primary);
}

.crud-table-container {
    overflow-x: auto;
}

.crud-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.crud-table th,
.crud-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.crud-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

.crud-table tbody tr {
    transition: background 0.12s;
}

.crud-table tbody tr:hover {
    background: var(--bg-hover);
}

.crud-table code {
    font-size: 0.82rem;
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--primary);
}

.crud-table .crud-coords {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
}

/* Locations table column widths */
.crud-table-locations {
    table-layout: fixed;
}

.crud-table-locations th:nth-child(1),
.crud-table-locations td:nth-child(1) {
    width: 12%;
}

.crud-table-locations th:nth-child(2),
.crud-table-locations td:nth-child(2) {
    width: 25%;
}

.crud-table-locations th:nth-child(3),
.crud-table-locations td:nth-child(3) {
    width: 18%;
}

.crud-table-locations th:nth-child(4),
.crud-table-locations td:nth-child(4) {
    width: 45%;
    word-break: break-word;
}

/* Accounts table column widths */
.crud-table-accounts {
    table-layout: fixed;
}

.crud-table-accounts th:nth-child(1),
.crud-table-accounts td:nth-child(1) {
    width: 25%;
}

.crud-table-accounts th:nth-child(2),
.crud-table-accounts td:nth-child(2) {
    width: 20%;
    word-break: break-word;
}

.crud-table-accounts th:nth-child(3),
.crud-table-accounts td:nth-child(3) {
    width: 15%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crud-table-accounts th:nth-child(4),
.crud-table-accounts td:nth-child(4) {
    width: 40%;
    word-break: break-word;
}

.btn-edit-crud {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-edit-crud:hover {
    background: var(--primary) !important;
    color: white !important;
}

/* CRUD Pagination */
.crud-pagination {
    margin-top: 16px;
}

.crud-pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.btn-page {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-page:disabled,
.btn-page.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* CRUD responsive */
@media (max-width: 768px) {
    .crud-filters {
        flex-direction: column;
    }

    .crud-filters input,
    .crud-filters select {
        width: 100%;
        min-width: 0;
    }

    .crud-table {
        font-size: 0.78rem;
    }

    .crud-table th,
    .crud-table td {
        padding: 8px 8px;
    }

    .crud-table th:nth-child(n+4),
    .crud-table td:nth-child(n+4) {
        display: none;
    }

    .crud-table th:last-child,
    .crud-table td:last-child {
        display: table-cell;
    }

    /* Locations: hide categoría, show dirección on mobile */
    .crud-table-locations th:nth-child(3),
    .crud-table-locations td:nth-child(3) {
        display: none;
    }

    .crud-table-locations th:nth-child(4),
    .crud-table-locations td:nth-child(4) {
        display: table-cell;
    }

    /* Accounts: hide web, show dir. facturación on mobile */
    .crud-table-accounts th:nth-child(3),
    .crud-table-accounts td:nth-child(3) {
        display: none;
    }

    .crud-table-accounts th:nth-child(4),
    .crud-table-accounts td:nth-child(4) {
        display: table-cell;
    }

    /* AccContacts: keep contacto, cuenta, cargo; hide the rest on mobile */
    .crud-table-acccontacts th:nth-child(n+4),
    .crud-table-acccontacts td:nth-child(n+4) {
        display: none;
    }

    .crud-table-acccontacts th:last-child,
    .crud-table-acccontacts td:last-child {
        display: table-cell;
    }

    .crud-pagination-controls {
        gap: 8px;
    }

    .btn-page {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* ============================================
   CRUD Modals - Form Grid Override
   ============================================ */

.project-form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 600px) {
    .project-form-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* CRUD Detail Modal */
.crud-detail-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    margin-top: 8px;
}

.crud-detail-field {
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}

.crud-detail-field:nth-last-child(-n+2) {
    border-bottom: none;
}

.crud-detail-field.full-width {
    grid-column: 1 / -1;
}

.crud-detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 1px;
    line-height: 1.2;
}

.crud-detail-value {
    font-size: 0.88rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.3;
}

.crud-detail-value:empty::after,
.crud-detail-value .detail-empty {
    color: var(--text-muted);
    font-style: italic;
}

.crud-table tbody tr {
    cursor: pointer;
}

/* Detail view: section headers */
.crud-detail-section {
    grid-column: 1 / -1;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--primary);
    padding: 8px 0 3px;
    border-bottom: 2px solid var(--primary);
    margin-top: 2px;
}

.crud-detail-section:first-child {
    padding-top: 0;
    margin-top: 0;
}

/* ---- Inline detail view (replaces modal) ---- */
.crud-detail-inline {
    animation: fadeIn 0.2s ease;
}

.crud-detail-inline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.crud-detail-inline-title {
    flex: 1;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crud-detail-inline-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-back-list {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    padding: 4px 12px;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .crud-detail-inline-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .crud-detail-inline-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ---- Location Photo Gallery ---- */
.loc-photos-gallery {
    padding: 8px 0;
}

.loc-photos-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 12px;
}

.loc-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.loc-photo-card {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary, #f3f4f6);
    border: 1px solid var(--border-color, #e5e7eb);
    transition: transform 0.15s, box-shadow 0.15s;
}

.loc-photo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.loc-photo-thumb {
    width: 100%;
    padding-bottom: 75%;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-tertiary, #e5e7eb);
}

.loc-photo-name {
    padding: 6px 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 600px) {
    .loc-photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
}

/* ---- Photo Multi-Select ---- */

.photo-select-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.photo-select-toolbar .loc-photos-count {
    margin: 0;
}

.photo-select-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-elevated, #f0f4ff);
    border: 1px solid var(--accent, #4f46e5);
    border-radius: 8px;
    margin-bottom: 12px;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.photo-card.photo-selectable,
.loc-photo-card.photo-selectable {
    position: relative;
}

.photo-card.photo-selectable::after,
.loc-photo-card.photo-selectable::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.3);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 2;
    pointer-events: none;
}

.photo-card.selected::after,
.loc-photo-card.selected::after {
    content: '\2713';
    background: var(--accent, #4f46e5);
    border-color: var(--accent, #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.photo-card.selected,
.loc-photo-card.selected {
    outline: 3px solid var(--accent, #4f46e5);
    outline-offset: -3px;
}

/* ---- Inline Edit Form ---- */
.crud-inline-edit-body {
    padding: 8px 0 0;
}

.crud-inline-edit-body .project-form-grid {
    margin-bottom: 4px;
}

.crud-inline-edit-body .form-group {
    margin-bottom: 8px;
}

/* Ensure subcategory tag selector's dropdown floats above subsequent form sections */
.crud-inline-edit-body .form-group:has(.subcat-tag-selector),
#crudLocationModal .form-group:has(.subcat-tag-selector) {
    position: relative;
    z-index: 10;
}

/* Ensure the grid row containing subcategory selector sits above following sections in the modal */
#crudLocationModal .project-form-grid:has(.subcat-tag-selector) {
    position: relative;
    z-index: 10;
}

.crud-inline-edit-body .project-form-section-title {
    margin-top: 16px;
    margin-bottom: 8px;
}

.crud-inline-edit-body .project-form-section-title:empty {
    border-bottom: none;
    margin-top: 4px;
    margin-bottom: 0;
    padding-bottom: 0;
}

.crud-inline-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
    .crud-inline-edit-actions {
        flex-direction: column;
    }
    .crud-inline-edit-actions button {
        width: 100%;
        min-height: 44px;
    }
}

/* Detail view: tags (subcategorias) */
.crud-tag {
    display: inline-block;
    font-size: 0.78rem;
    background: var(--bg-hover);
    color: var(--text-primary);
    padding: 2px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin: 2px 4px 2px 0;
}

/* Detail view: boolean badges */
.crud-badge {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
}

.crud-badge.badge-yes {
    background: #dcfce7;
    color: #166534;
}

.crud-badge.badge-no {
    background: #fef2f2;
    color: #991b1b;
}

.crud-badge.crud-badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.crud-badge.crud-badge-danger {
    background: #fef2f2;
    color: #991b1b;
}
.crud-badge.crud-badge-success {
    background: #f0fdf4;
    color: #166534;
}
.crud-badge.crud-badge-principal {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    font-weight: 600;
}

/* Boolean checkbox display */
.bool-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.92em;
    font-weight: 500;
}
.bool-check.bool-yes {
    color: #166534;
}
.bool-check.bool-no {
    color: #991b1b;
}
.bool-check.bool-null {
    color: #9ca3af;
    font-style: italic;
    font-weight: 400;
}

/* ============================================
   Diccionarios — Tabs
   ============================================ */

.dict-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.dict-tab {
    padding: 10px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.dict-tab:hover {
    color: var(--text-primary);
}

.dict-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.dict-tab-content {
    display: none;
}

.dict-tab-content.active {
    display: block;
}

.crud-actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 6px;
}

.crud-actions-cell .btn-small {
    padding: 4px 10px;
    font-size: 0.78rem;
}

@media (max-width: 768px) {
    .dict-tabs {
        overflow-x: auto;
    }
    .dict-tab {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* ============================================
   Gestión Tablas — Etiquetas (color picker)
   ============================================ */

.gt-color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gt-color-input {
    width: 44px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.gt-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.gt-color-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.gt-color-input::-moz-color-swatch { border: none; border-radius: 4px; }

.gt-color-hex {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.gt-color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.gt-color-preset {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
}

.gt-color-preset:hover {
    border-color: var(--text-primary);
    transform: scale(1.2);
}

.gt-color-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

.gt-badge-local {
    display: inline-block;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Location badges (blue, clickable)
   ============================================ */

.loc-badge {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 3px 12px;
    border-radius: 12px;
    margin: 2px 4px 2px 0;
}

.loc-badge-blue {
    background: var(--primary-light);
    color: var(--primary-hover);
    border: 1px solid var(--primary);
}

.loc-badge-clickable {
    cursor: pointer;
    transition: background 0.15s;
}

.loc-badge-clickable:hover {
    background: var(--primary);
    color: var(--primary-text);
}

.loc-badge-add {
    cursor: pointer;
    background: none;
    border: 1px dashed var(--primary);
    color: var(--primary);
    font-size: 0.78rem;
}

.loc-badge-add:hover {
    background: var(--primary-light);
}

/* Inline selector popup */
.loc-selector-popup {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    min-width: 260px;
    max-width: 360px;
    padding: 12px;
    margin-top: 4px;
}

.loc-selector-header {
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.loc-selector-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.loc-selector-scroll {
    max-height: 220px;
    overflow-y: auto;
}

.loc-selector-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.1s;
}

.loc-selector-option:hover {
    background: var(--bg-hover);
}

.loc-selector-option input {
    margin: 0;
}

.loc-selector-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

/* Multiselect checkboxes in edit form */
.gt-multiselect-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    max-height: 180px;
    overflow-y: auto;
}

.gt-multiselect-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
    white-space: nowrap;
}

.gt-multiselect-option:hover {
    background: var(--bg-hover);
}

.gt-multiselect-option:has(input:checked) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-hover);
}

.gt-multiselect-option input {
    margin: 0;
    width: 14px;
    height: 14px;
}

/* Searchable tag selector for subcategorías */
.subcat-tag-selector {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    padding: 6px;
    position: relative;
    z-index: 10;
}

.subcat-tags-area {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
    min-height: 0;
}

.subcat-tags-area:empty {
    margin-bottom: 0;
}

.subcat-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--primary);
    color: var(--primary-text);
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.subcat-tag-remove {
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.8;
    margin-left: 2px;
}

.subcat-tag-remove:hover {
    opacity: 1;
}

.subcat-search-input {
    width: 100%;
    border: none;
    outline: none;
    padding: 4px 6px;
    font-size: 0.85rem;
    background: transparent;
    color: var(--text-primary);
}

.subcat-search-input::placeholder {
    color: var(--text-muted);
}

.subcat-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    max-height: 180px;
    overflow-y: auto;
    margin-top: 2px;
}

.subcat-dropdown.show {
    display: block;
}

.subcat-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.1s;
}

.subcat-dropdown-item:hover {
    background: var(--bg-hover);
}

.subcat-dropdown-empty {
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.loc-selector-popup-wide {
    min-width: 320px;
}

/* Map button in detail view */
.btn-map-open {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: var(--primary);
    color: var(--primary-text);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-map-open:hover {
    background: var(--primary-hover);
}

.btn-map-icon {
    font-size: 1rem;
}

/* Readonly inputs in edit forms */
input[readonly] {
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Location map modal */
.location-map-modal-content {
    width: 90vw;
    max-width: 900px;
    height: 80vh;
    max-height: 700px;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.location-map-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.location-map-modal-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    padding-right: 12px;
}

.location-map-modal-map {
    flex: 1;
    min-height: 0;
}

.location-map-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-dark);
}

.location-map-coords {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: monospace;
}

@media (max-width: 600px) {
    .location-map-modal-content {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
}

/* Related records section (embedded in detail views) */
.crud-related-section {
    margin-top: 1.2rem;
    border-top: 2px solid var(--border);
    padding-top: 0.8rem;
}
.crud-related-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.5rem;
}
.crud-related-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
.crud-related-header .btn-sm {
    padding: 3px 12px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    margin-left: auto;
}
.crud-related-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    padding: 0.5rem 0;
}
.crud-related-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}
.crud-related-table th,
.crud-related-table td {
    padding: 5px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.crud-related-table th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}
.crud-related-row {
    cursor: pointer;
    transition: background 0.15s;
}
.crud-related-row:hover {
    background: var(--bg-secondary);
}
@media (max-width: 768px) {
    .crud-related-table th:nth-child(n+3),
    .crud-related-table td:nth-child(n+3) { display: none; }
}

/* Enriched contact cards */
.crud-enriched-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.crud-enriched-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.crud-enriched-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.crud-enriched-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.crud-enriched-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.crud-enriched-edit-btn {
    padding: 2px 10px !important;
    font-size: 0.75rem !important;
    border-radius: var(--radius-sm) !important;
}
.crud-enriched-card-body {
    padding: 8px 12px;
}
.crud-enriched-card-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px 16px;
}
.crud-enriched-field {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.crud-enriched-field-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    line-height: 1.2;
}
.crud-enriched-field-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.3;
}
.crud-enriched-card-badges {
    margin-top: 6px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.crud-enriched-card-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    margin: 0;
}
@media (max-width: 600px) {
    .crud-enriched-card-fields {
        grid-template-columns: 1fr;
    }
    .crud-enriched-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ---- Location thumbnail in account cards ---- */
.crud-loc-card-with-thumb > .crud-loc-card-content {
    display: flex;
    gap: 0;
}
.crud-loc-card-content {
    display: flex;
}
.crud-loc-thumb-container {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    position: relative;
    background: var(--bg-tertiary, #e5e7eb);
    border-left: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s;
    overflow: hidden;
}
.crud-loc-thumb-container:hover {
    opacity: 0.85;
}
.crud-loc-thumb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.crud-loc-thumb-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: locThumbSpin 0.7s linear infinite;
}
@keyframes locThumbSpin {
    to { transform: rotate(360deg); }
}
.crud-loc-thumb-grid {
    display: flex;
    gap: 2px;
    width: 100%;
    height: 100%;
    min-height: 80px;
}
.crud-loc-thumb-img {
    flex: 1;
    min-width: 0;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}
.crud-loc-thumb-count {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 10px;
    line-height: 1.3;
}
.crud-loc-thumb-nophoto {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    min-height: 100px;
    background: var(--bg-secondary, #f9fafb);
}
.crud-loc-thumb-nophoto-icon {
    font-size: 1.8rem;
    opacity: 0.35;
    filter: grayscale(1);
}
.crud-loc-thumb-nophoto-text {
    font-size: 0.7rem;
    font-weight: 700;
    color: #dc2626;
    letter-spacing: 0.04em;
}
.crud-loc-card-content > .crud-enriched-card-body {
    flex: 0 0 auto;
    max-width: 280px;
    min-width: 0;
}
@media (max-width: 480px) {
    .crud-loc-card-content {
        flex-direction: column;
    }
    .crud-loc-thumb-container {
        flex: unset;
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

/* ---- Green phone icon for phone numbers ---- */
.phone-link-green {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity 0.15s;
}
.phone-link-green:hover {
    opacity: 0.8;
    text-decoration: underline;
}
.phone-icon-green {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    order: 1;
}
.phone-icon-green svg {
    width: 100%;
    height: 100%;
}

/* ---- Blue badge for account name ---- */
.badge-account-blue {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

/* ---- Clickable email links ---- */
.email-link {
    color: var(--primary, #2563eb);
    text-decoration: none;
}
.email-link:hover {
    text-decoration: underline;
}

.crud-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.crud-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Catastral reference validation */
.input-catastral-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.input-catastral-wrap input {
    flex: 1;
    padding-right: 34px;
}
.catastral-status {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.catastral-status svg {
    width: 18px;
    height: 18px;
}
.catastral-status.loading {
    animation: catastral-spin 0.8s linear infinite;
}
@keyframes catastral-spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}
.input-catastral-wrap input.catastral-valid {
    border-color: #22c55e;
    background: #f0fdf4;
}
.input-catastral-wrap input.catastral-invalid {
    border-color: #ef4444;
    background: #fef2f2;
}

/* Checks grid for location checks (localizador / propietario) */
.checks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 6px 10px;
    padding: 4px 0;
}
.checks-grid .crud-checkbox-label {
    padding: 5px 8px;
    border-radius: var(--radius-sm, 6px);
    background: var(--bg-secondary, #f7f7f8);
    transition: background .15s;
    font-size: 0.85rem;
}
.checks-grid .crud-checkbox-label:hover {
    background: var(--bg-tertiary, #eee);
}

/* Detail view: expandable JSON block */
.btn-json-toggle {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-json-toggle:hover {
    background: var(--primary);
    color: white;
}

.crud-json-block {
    display: none;
    margin-top: 8px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.crud-json-block.open {
    display: block;
}

@media (max-width: 600px) {
    .crud-detail-body {
        grid-template-columns: 1fr;
    }

    .crud-detail-field:last-child {
        border-bottom: none;
    }

    .crud-detail-field:nth-last-child(2) {
        border-bottom: 1px solid var(--border);
    }

    .crud-detail-section {
        padding-top: 6px;
    }
}

/* ============================================
   Development mode — yellow background
   Applied when body has class "dev-mode"
   ============================================ */

body.dev-mode {
    --bg-main: #fffde7;
    --bg-dark: #fff9c4;
    --bg-card: #fffef5;
    --bg-input: #fffef5;
}

body.dev-mode,
body.dev-mode .main-content,
body.dev-mode .file-item,
body.dev-mode .zoho-badges,
body.dev-mode .folder-thumbnail-card,
body.dev-mode .sync-modal,
body.dev-mode .auth-screen {
    background: #fffde7 !important;
}

body.dev-mode .sidebar {
    background: #fff9c4 !important;
}

body.dev-mode .mobile-bottom-nav {
    background: #fff9c4 !important;
}

/* ============================================================
   MESSAGING — Shared styles (used by Sunlocs Chat section)
   ============================================================ */

.msg-loading, .msg-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.msg-role-tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.msg-role-sunlocs {
    background: #e8f5e9;
    color: #2e7d32;
}

.msg-role-productora {
    background: #e3f2fd;
    color: #1565c0;
}

.msg-role-director {
    background: #fce4ec;
    color: #c62828;
}

.msg-role-tecnico {
    background: #fff3e0;
    color: #e65100;
}

.msg-badge-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 10px;
    line-height: 1;
    vertical-align: middle;
    margin-left: 4px;
}

.msg-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   Zoho Tags — colored chips
   ============================================ */

.zoho-tag-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin: 1px 3px 1px 0;
    white-space: nowrap;
    line-height: 1.4;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: 1px solid rgba(0,0,0,0.08);
}

.zoho-tag-chip-remove {
    cursor: pointer;
    margin-left: 5px;
    font-size: 0.85rem;
    opacity: 0.65;
    line-height: 1;
    font-weight: 700;
}

.zoho-tag-chip-remove:hover {
    opacity: 1;
}

/* Tag strip in detail view header */
.crud-detail-tags-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 0 4px;
}

/* Tag filter in list views */
.crud-tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 0;
    align-items: center;
}

.crud-tag-filter-bar .zoho-tag-chip {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s, box-shadow 0.15s;
}

.crud-tag-filter-bar .zoho-tag-chip:hover {
    opacity: 0.8;
}

.crud-tag-filter-bar .zoho-tag-chip.active {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}

.crud-tag-filter-bar .tag-filter-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 4px;
    white-space: nowrap;
}

.crud-tag-filter-bar .tag-filter-clear {
    font-size: 0.72rem;
    color: var(--primary);
    cursor: pointer;
    margin-left: 4px;
    text-decoration: underline;
    white-space: nowrap;
}

.crud-tag-filter-bar .tag-filter-clear:hover {
    color: var(--primary-hover);
}

/* Tags row in table */
.crud-table td .zoho-tag-chip {
    font-size: 0.65rem;
    padding: 1px 6px;
}

/* Tag editor widget (edit mode) */
.zoho-tag-editor {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    position: relative;
}

.zoho-tag-editor-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
    min-height: 0;
}

.zoho-tag-editor-tags:empty {
    margin-bottom: 0;
}

.zoho-tag-editor-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 0.85rem;
    padding: 4px 0;
    background: transparent;
    color: var(--text-primary);
}

.zoho-tag-editor-input::placeholder {
    color: var(--text-muted);
}

.zoho-tag-editor-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.zoho-tag-editor-dropdown.open {
    display: block;
}

.zoho-tag-editor-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.1s;
}

.zoho-tag-editor-dropdown-item:hover {
    background: var(--bg-hover);
}

.zoho-tag-editor-dropdown-empty {
    padding: 10px 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================================
   Cronología (Audit Log) Styles
   ============================================================ */

.btn-cronologia {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-cronologia:hover {
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.4);
    transform: translateY(-1px);
}

.cronologia-icon {
    display: inline-flex;
    align-items: center;
}

/* Modal layout */
.cronologia-modal-content {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    padding: 0 !important;
}

.cronologia-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border);
}

.cronologia-modal-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.cronologia-filters {
    display: flex;
    gap: 10px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.cronologia-filters input,
.cronologia-filters select {
    padding: 7px 12px;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.cronologia-filters input {
    flex: 1;
    min-width: 0;
}

.cronologia-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px 24px;
}

/* Timeline */
.cronologia-timeline {
    position: relative;
    padding-left: 28px;
}

.cronologia-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
}

.cronologia-entry {
    position: relative;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.15s;
}

.cronologia-entry:hover {
    border-color: rgba(124, 58, 237, 0.3);
}

.cronologia-entry::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 18px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.cronologia-entry.action-create::before {
    background: #22c55e;
}

.cronologia-entry.action-update::before {
    background: #3b82f6;
}

.cronologia-entry.action-delete::before {
    background: #ef4444;
}

.cronologia-entry-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.cronologia-action-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: 4px;
    line-height: 1.6;
}

.cronologia-action-badge.badge-create {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.cronologia-action-badge.badge-update {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.cronologia-action-badge.badge-delete {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.cronologia-record-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.cronologia-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.cronologia-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cronologia-changes {
    margin-top: 8px;
}

.cronologia-change-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

.cronologia-change-row:first-child {
    border-top: none;
}

.cronologia-field-name {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 120px;
    flex-shrink: 0;
}

.cronologia-old-value {
    color: #ef4444;
    text-decoration: line-through;
    opacity: 0.7;
    word-break: break-word;
}

.cronologia-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
}

.cronologia-new-value {
    color: #22c55e;
    font-weight: 500;
    word-break: break-word;
}

.cronologia-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.cronologia-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.cronologia-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0 0;
    border-top: 1px solid var(--border);
    margin-top: 16px;
}

.cronologia-pagination .btn-page {
    padding: 6px 14px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
}

.cronologia-pagination .btn-page:hover:not(.disabled) {
    background: var(--bg-hover);
    border-color: rgba(124, 58, 237, 0.3);
}

.cronologia-pagination .btn-page.disabled {
    opacity: 0.4;
    cursor: default;
}

.cronologia-pagination .page-info {
    font-size: 0.78rem;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .btn-cronologia {
        padding: 3px 8px;
        font-size: 0.72rem;
    }
    .cronologia-filters {
        flex-direction: column;
        padding: 10px 16px;
    }
    .cronologia-content {
        padding: 12px 16px;
    }
    .cronologia-change-row {
        flex-direction: column;
        gap: 2px;
    }
    .cronologia-field-name {
        min-width: 0;
    }
}

/* ============================================================
   Onboarding Screen
   ============================================================ */
.onboarding-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
}
.onboarding-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.1);
    max-width: 600px;
    width: 100%;
    position: relative;
    padding: 40px;
}
.onboarding-header {
    text-align: center;
    margin-bottom: 32px;
}
.onboarding-back-top {
    position: absolute;
    top: 16px;
    left: 16px;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.onboarding-back-top:hover {
    background: #f3f4f6;
}
.onboarding-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    margin-bottom: 16px;
}
.onboarding-header h1 {
    font-size: 24px;
    margin: 0 0 8px;
    color: #1a1a2e;
}
.onboarding-header p {
    color: #6b7280;
    margin: 0;
}
.onboarding-step h2 {
    font-size: 18px;
    margin: 0 0 20px;
    color: #1a1a2e;
}
.onboarding-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.onboarding-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
    gap: 8px;
}
.onboarding-option:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59,130,246,.15);
}
.onboarding-option-icon {
    font-size: 32px;
}
.onboarding-option-title {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a2e;
}
.onboarding-option-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}
.onboarding-back {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    margin-bottom: 16px;
}
.onboarding-back:hover { text-decoration: underline; }
.onboarding-invitation-card {
    text-align: center;
    padding: 24px;
}
.onboarding-invitation-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}
.onboarding-invitation-card h2 {
    text-align: center;
}
@media (max-width: 480px) {
    .onboarding-options { grid-template-columns: 1fr; }
    .onboarding-container { padding: 24px; }
}

/* ============================================================
   Notifications Bell & Panel
   ============================================================ */
.btn-notifications {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #6b7280;
    border-radius: 8px;
    transition: background .2s;
    flex-shrink: 0;
}
.btn-notifications:hover { background: rgba(0,0,0,.06); color: #1a1a2e; }
.btn-notif-mobile {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #fff;
}
.notification-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.notifications-overlay {
    position: fixed;
    inset: 0;
    z-index: 998;
}
.notifications-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 360px;
    max-height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.notifications-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.notifications-panel-header h3 {
    margin: 0;
    font-size: 16px;
}
.notifications-panel-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6b7280;
}
.notifications-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px;
}
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
}
.notif-item:hover { background: #f3f4f6; }
.notif-item-unread { background: #eff6ff; }
.notif-item-icon { font-size: 20px; flex-shrink: 0; }
.notif-item-content { flex: 1; min-width: 0; }
.notif-item-title { font-weight: 600; font-size: 13px; color: #1a1a2e; }
.notif-item-text { font-size: 12px; color: #6b7280; margin-top: 2px; }
.notif-item-time { font-size: 11px; color: #9ca3af; margin-top: 4px; }
@media (max-width: 768px) {
    .notifications-panel { right: 8px; left: 8px; width: auto; top: 56px; }
}

/* ============================================================
   Team Section
   ============================================================ */
.team-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.team-stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
}
.team-stat-icon { font-size: 28px; }
.team-stat-info { display: flex; flex-direction: column; }
.team-stat-value { font-size: 24px; font-weight: 700; color: #1a1a2e; }
.team-stat-label { font-size: 12px; color: #6b7280; }
.team-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.team-search-bar input { flex: 1; min-width: 200px; }
.team-search-bar select { min-width: 160px; }
.team-members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.team-member-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow .2s;
}
.team-member-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.team-member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #4338ca;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}
.team-member-info { flex: 1; min-width: 0; }
.team-member-name { font-weight: 600; color: #1a1a2e; font-size: 14px; }
.team-member-email { color: #6b7280; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-member-badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.team-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.team-badge-admin { background: #fef3c7; color: #92400e; }
.team-badge-member { background: #e0e7ff; color: #4338ca; }
.team-badge-active { background: #d1fae5; color: #065f46; }
.team-badge-pending { background: #fee2e2; color: #991b1b; }
.team-member-actions { display: flex; gap: 6px; flex-shrink: 0; }
.team-member-actions button {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    color: #6b7280;
    transition: all .15s;
}
.team-member-actions button:hover { background: #f3f4f6; color: #1a1a2e; }
.team-member-actions button.btn-danger:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
@media (max-width: 768px) {
    .team-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .team-members-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Profile Section
   ============================================================ */
.profile-container { max-width: 800px; }
.profile-header-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}
.profile-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    flex-shrink: 0;
}
.profile-header-info h2 {
    margin: 0 0 4px;
    font-size: 20px;
    color: #1a1a2e;
}
.profile-email-display {
    color: #6b7280;
    margin: 0 0 8px;
    font-size: 14px;
}
.profile-role-badge, .profile-type-badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
}
.profile-role-badge { background: #e0e7ff; color: #4338ca; }
.profile-type-badge { background: #fef3c7; color: #92400e; }
.profile-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.profile-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}
.profile-card-title {
    margin: 0 0 16px;
    font-size: 15px;
    color: #1a1a2e;
}
.profile-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}
.profile-field label {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 2px;
}
.profile-field span {
    font-size: 14px;
    color: #1a1a2e;
}
.profile-activity-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    text-align: center;
}
.profile-activity-item {
    display: flex;
    flex-direction: column;
}
.profile-activity-value {
    font-size: 28px;
    font-weight: 700;
    color: #3b82f6;
}
.profile-activity-label {
    font-size: 12px;
    color: #6b7280;
}
.profile-session-actions {
    margin-top: 12px;
}

/* ============================================================
   Tecnico Profile (user_type=tecnico)
   ============================================================ */
.tecnico-profile-container {
    max-width: 900px;
}
.tecnico-profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.tecnico-photo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.tecnico-photo-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e5e7eb;
}
.tecnico-photo-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    border: 3px dashed #d1d5db;
}
.tecnico-photo-upload-btn {
    font-size: 12px;
    color: #3b82f6;
    cursor: pointer;
    font-weight: 500;
}
.tecnico-photo-upload-btn:hover { text-decoration: underline; }
.tecnico-availability-toggle, .tecnico-visibility-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tecnico-availability-toggle label, .tecnico-visibility-toggle label {
    font-size: 12px;
    color: #6b7280;
}
.tecnico-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.tecnico-field-group {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}
.tecnico-field-group h3 {
    margin: 0 0 16px;
    font-size: 15px;
    color: #1a1a2e;
}
.tecnico-field-full {
    grid-column: 1 / -1;
}
@media (max-width: 768px) {
    .tecnico-profile-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Technician Directory (user_type=productora)
   ============================================================ */
.tec-dir-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tec-dir-filters input { flex: 1; min-width: 200px; }
.tec-dir-filters select { min-width: 160px; }
.tec-dir-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.tec-dir-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}
.tec-dir-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-1px); }
.tec-dir-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}
.tec-dir-photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #f3f4f6;
}
.tec-dir-photo-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e0e7ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #4338ca;
    font-weight: 700;
    flex-shrink: 0;
}
.tec-dir-name { font-weight: 600; font-size: 15px; color: #1a1a2e; }
.tec-dir-specialty { font-size: 13px; color: #6b7280; }
.tec-dir-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #6b7280;
}
.tec-dir-meta span { display: flex; align-items: center; gap: 4px; }
.tec-dir-fav-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #d1d5db;
    transition: color .2s;
}
.tec-dir-fav-btn.is-favorite { color: #f59e0b; }
.tec-dir-fav-btn:hover { color: #f59e0b; }
.tec-dir-availability {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.tec-dir-availability-available { background: #d1fae5; color: #065f46; }
.tec-dir-availability-busy { background: #fef3c7; color: #92400e; }
.tec-dir-availability-unavailable { background: #fee2e2; color: #991b1b; }

/* Tecnico Detail Modal */
.tecnico-detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}
.tecnico-detail-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}
.tecnico-detail-name { font-size: 20px; font-weight: 700; color: #1a1a2e; }
.tecnico-detail-section {
    margin-bottom: 20px;
}
.tecnico-detail-section h3 {
    font-size: 14px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 0 0 8px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 4px;
}
.tecnico-detail-field {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}
.tecnico-detail-field label { color: #6b7280; }
.tecnico-detail-field span { color: #1a1a2e; font-weight: 500; }
.tecnico-detail-fav-section {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}
.tecnico-detail-fav-section h3 {
    margin: 0 0 8px;
    font-size: 14px;
    border: none;
    padding: 0;
}
.tecnico-detail-fav-section textarea {
    width: 100%;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
}

/* ============================================================
   Tecnico Calendar & Work Requests
   ============================================================ */
.tecnico-calendar-container {
    max-width: 1000px;
}
.tecnico-calendar-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #6b7280;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot {
    width: 12px; height: 12px; border-radius: 50%; display: inline-block;
}
.legend-pending { background: #f59e0b; }
.legend-accepted { background: #10b981; }
.legend-rejected { background: #ef4444; }

#tecnicoCalendar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
}
#tecnicoCalendar .fc-toolbar-title { font-size: 18px !important; }
#tecnicoCalendar .fc-button { font-size: 13px; }
#tecnicoCalendar .fc-event { cursor: pointer; border-radius: 4px; padding: 2px 6px; font-size: 12px; }

/* Work Request Detail */
.wr-status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin: 8px 0 16px;
}
.wr-status-pending { background: #fef3c7; color: #92400e; }
.wr-status-accepted { background: #d1fae5; color: #065f46; }
.wr-status-rejected { background: #fee2e2; color: #991b1b; }

.wr-detail-grid {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}
.wr-detail-field {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}
.wr-detail-field label { color: #6b7280; font-weight: 500; }
.wr-detail-field span { color: #1a1a2e; }

.wr-detail-section { margin-bottom: 16px; }
.wr-detail-section h3 {
    font-size: 13px;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: .5px;
    margin: 0 0 6px;
}
.wr-detail-section p { font-size: 14px; color: #374151; line-height: 1.5; margin: 0; }

.wr-response-section {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}
.wr-response-section h3 {
    font-size: 14px;
    margin: 0 0 8px;
    color: #065f46;
}
.wr-response-section textarea {
    width: 100%;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    resize: vertical;
    min-height: 50px;
}

/* ============================================================
   Productora Calendar / Agenda
   ============================================================ */

/* Nav badge for new events */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    margin-left: 6px;
    line-height: 1;
}
.mobile-nav-item .nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
}
.mobile-nav-item { position: relative; }

/* Stats cards */
.prod-cal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.prod-cal-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.prod-cal-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.prod-cal-stat-icon.total { background: #ede9fe; }
.prod-cal-stat-icon.pending { background: #fef3c7; }
.prod-cal-stat-icon.accepted { background: #d1fae5; }
.prod-cal-stat-icon.rejected { background: #fee2e2; }
.prod-cal-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1;
}
.prod-cal-stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

/* Tabs */
.prod-cal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
}
.prod-cal-tab {
    padding: 10px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .2s, border-color .2s;
}
.prod-cal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.prod-cal-tab:hover { color: var(--primary); }

/* Calendar container */
#productoraCalendar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
}
#productoraCalendar .fc-toolbar-title { font-size: 18px !important; }
#productoraCalendar .fc-button { font-size: 13px; }
#productoraCalendar .fc-event {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
}

/* List filters */
.prod-cal-list-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.prod-cal-list-filters select,
.prod-cal-list-filters input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
}
.prod-cal-list-filters input { flex: 1; min-width: 180px; }

/* List cards */
.prod-cal-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.prod-cal-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all .2s;
    display: grid;
    grid-template-columns: 4px 1fr auto;
    gap: 16px;
    align-items: center;
}
.prod-cal-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    transform: translateY(-1px);
}
.prod-cal-card-stripe {
    width: 4px;
    height: 100%;
    min-height: 40px;
    border-radius: 2px;
}
.prod-cal-card-stripe.pending { background: #f59e0b; }
.prod-cal-card-stripe.accepted { background: #10b981; }
.prod-cal-card-stripe.rejected { background: #ef4444; }

.prod-cal-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.prod-cal-card-title {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 8px;
}
.prod-cal-card-title .prod-cal-new-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    flex-shrink: 0;
}
.prod-cal-card-tecnico {
    font-size: 13px;
    color: #6b7280;
}
.prod-cal-card-dates {
    font-size: 13px;
    color: #374151;
}
.prod-cal-card-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.prod-cal-card-rate {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a2e;
}
.prod-cal-card-sent {
    font-size: 11px;
    color: #9ca3af;
}

/* Detail modal timeline */
.prod-wr-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 16px 0;
    position: relative;
    padding-left: 24px;
}
.prod-wr-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: #e5e7eb;
}
.prod-wr-timeline-item {
    position: relative;
    padding: 8px 0;
}
.prod-wr-timeline-dot {
    position: absolute;
    left: -21px;
    top: 12px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #d1d5db;
}
.prod-wr-timeline-dot.sent { background: #3b82f6; box-shadow: 0 0 0 2px #93c5fd; }
.prod-wr-timeline-dot.responded { background: #10b981; box-shadow: 0 0 0 2px #6ee7b7; }
.prod-wr-timeline-dot.pending { background: #f59e0b; box-shadow: 0 0 0 2px #fcd34d; }
.prod-wr-timeline-dot.rejected { background: #ef4444; box-shadow: 0 0 0 2px #fca5a5; }
.prod-wr-timeline-label {
    font-size: 12px;
    color: #6b7280;
}
.prod-wr-timeline-date {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a2e;
}

/* Project color block in detail */
.prod-wr-project-banner {
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}
.prod-wr-project-banner h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}
.prod-wr-project-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .prod-cal-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .prod-cal-card {
        grid-template-columns: 4px 1fr;
    }
    .prod-cal-card-meta {
        grid-column: 2;
        text-align: left;
        align-items: flex-start;
        flex-direction: row;
        gap: 12px;
    }
}

/* Tecnico profile new fields */
.tecnico-field-hint {
    font-size: 11px;
    color: #9ca3af;
    margin: 8px 0 0;
    font-style: italic;
}
.tecnico-tarifa-row {
    display: flex;
    gap: 12px;
    align-items: center;
}
.tecnico-tarifa-row input[type="range"] { flex: 1; }
.tecnico-tarifa-row select { width: 110px; }

.tecnico-historico-placeholder {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: #9ca3af;
}
.tecnico-historico-empty { color: #9ca3af; font-style: italic; }
.tecnico-historico-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    gap: 12px;
}
.tecnico-historico-item:last-child { border-bottom: none; }
.historico-project { font-weight: 600; color: #1a1a2e; flex: 1; }
.historico-dates { color: #6b7280; font-size: 12px; }
.historico-productora { color: #3b82f6; font-size: 12px; }

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.btn-danger:hover { background: #dc2626; }

/* ============================================================
   Permission Modal
   ============================================================ */
.perm-modal-content {
    max-height: 400px;
    overflow-y: auto;
}
.perm-group {
    margin-bottom: 16px;
}
.perm-group-title {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a2e;
    margin-bottom: 8px;
    text-transform: capitalize;
}
.perm-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.perm-group-items label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}

/* Nav separator */
.nav-separator {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 16px;
}

/* ============================================================
   Admin Platform
   ============================================================ */

.admin-platform-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
}
.admin-platform-tab {
    padding: 10px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.admin-platform-tab:hover {
    color: #374151;
}
.admin-platform-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.platform-table-container {
    overflow-x: auto;
}
.platform-table-info {
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    margin-top: 12px;
}

/* Badges for user types */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-localizador_empresa { background: #dbeafe; color: #1e40af; }
.badge-localizador_individual { background: #e0e7ff; color: #3730a3; }
.badge-film_commission { background: #fef3c7; color: #92400e; }
.badge-tecnico { background: #fce7f3; color: #9d174d; }
.badge-productora { background: #d1fae5; color: #065f46; }
.badge-admin { background: #fee2e2; color: #991b1b; }
.badge-member { background: #f3f4f6; color: #374151; }

/* Status dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}
.status-active { background: #10b981; }
.status-pending { background: #f59e0b; }
.status-inactive { background: #ef4444; }

.text-muted { color: #9ca3af; }

/* ============================================================ */
/* SUNLOCS PROJECT SYSTEM STYLES                                */
/* ============================================================ */

/* Dashboard */
.sl-dashboard-container { max-width: 1200px; }
.sl-dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.sl-dash-stat-card {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.sl-dash-stat-icon { font-size: 2rem; }
.sl-dash-stat-info { display: flex; flex-direction: column; }
.sl-dash-stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text, #e2e8f0); }
.sl-dash-stat-label { font-size: 0.85rem; color: var(--text-muted, #9ca3af); }

.sl-dash-section { margin-bottom: 24px; }
.sl-dash-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text, #e2e8f0);
}

.sl-dash-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sl-dash-task-item {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.sl-dash-task-item:hover { border-color: var(--accent, #6366f1); }
.sl-dash-task-type {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--accent, #6366f1);
    color: #fff;
    white-space: nowrap;
}
.sl-dash-task-info { flex: 1; min-width: 0; }
.sl-dash-task-title { font-weight: 500; color: var(--text, #e2e8f0); }
.sl-dash-task-project { font-size: 0.8rem; color: var(--text-muted, #9ca3af); }
.sl-dash-task-date { font-size: 0.8rem; color: var(--text-muted, #9ca3af); white-space: nowrap; }

.sl-dash-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.sl-dash-project-card {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}
.sl-dash-project-card:hover {
    border-color: var(--accent, #6366f1);
    transform: translateY(-2px);
}
.sl-dash-project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.sl-dash-project-title { font-weight: 600; font-size: 1rem; color: var(--text, #e2e8f0); }
.sl-dash-project-code { font-size: 0.8rem; color: var(--text-muted, #9ca3af); }
.sl-dash-project-role {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--accent, #6366f1);
    color: #fff;
    text-transform: uppercase;
}
.sl-dash-project-stats {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}
.sl-dash-project-stats span {
    font-size: 0.8rem;
    color: var(--text-muted, #9ca3af);
}

.sl-dash-notif-list { display: flex; flex-direction: column; gap: 6px; }
.sl-dash-notif-item {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}
.sl-dash-notif-item.unread { border-left: 3px solid var(--accent, #6366f1); }
.sl-dash-notif-icon { font-size: 1.2rem; }
.sl-dash-notif-text { flex: 1; color: var(--text, #e2e8f0); }
.sl-dash-notif-time { font-size: 0.75rem; color: var(--text-muted, #9ca3af); white-space: nowrap; }

/* Sunlocs Projects */
.sl-projects-tabs, .sl-contracts-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border, #2d2d3d);
    padding-bottom: 0;
}
.sl-tab {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.sl-tab:hover { color: var(--text, #e2e8f0); }
.sl-tab.active {
    color: var(--accent, #6366f1);
    border-bottom-color: var(--accent, #6366f1);
    font-weight: 600;
}

.sl-projects-filter-bar, .sl-contracts-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.sl-projects-filter-bar input,
.sl-projects-filter-bar select,
.sl-contracts-filter-bar select {
    padding: 6px 12px;
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 6px;
    background: var(--input-bg, #12121a);
    color: var(--text, #e2e8f0);
    font-size: 0.85rem;
}
.sl-projects-filter-bar input { flex: 1; min-width: 200px; }


.sl-perm-level-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}
.sl-perm-basico { background: rgba(107,114,128,0.2); color: #9ca3af; }
.sl-perm-avanzado { background: rgba(59,130,246,0.2); color: #3b82f6; }
.sl-perm-administrador { background: rgba(168,85,247,0.2); color: #a855f7; }

/* Productora badges in project detail */
.sl-productora-list { display: flex; flex-direction: column; gap: 8px; }
.sl-productora-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(99,102,241,0.05);
    border-radius: 8px;
}
.sl-productora-name { font-weight: 500; flex: 1; }
.sl-productora-principal {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(168,85,247,0.2);
    color: #a855f7;
}
.sl-productora-areas {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.sl-area-tag {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(99,102,241,0.15);
    color: var(--accent, #6366f1);
}

/* Calendar */
.sl-calendar-container { max-width: 1200px; }
.sl-cal-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.sl-cal-filters select {
    padding: 6px 12px;
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 6px;
    background: var(--input-bg, #12121a);
    color: var(--text, #e2e8f0);
    font-size: 0.85rem;
}
.sl-cal-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-muted, #9ca3af);
}

/* Chat — Light theme */
.sl-chat-container { max-width: 1200px; height: calc(100vh - 200px); min-height: 500px; }
.sl-chat-layout {
    display: flex;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.sl-chat-sidebar {
    width: 320px;
    min-width: 280px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}
.sl-chat-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sl-chat-sidebar-header input,
.sl-chat-sidebar-header select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 100%;
    box-sizing: border-box;
}
.sl-chat-thread-list {
    flex: 1;
    overflow-y: auto;
}
.sl-chat-thread-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s;
}
.sl-chat-thread-item:hover { background: var(--bg-hover); }
.sl-chat-thread-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.sl-chat-thread-item.has-unread { font-weight: 600; }
.sl-chat-thread-subject { font-size: 0.9rem; color: var(--text-primary); margin-bottom: 4px; }
.sl-chat-thread-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sl-chat-thread-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.sl-chat-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
    margin-left: 6px;
}

.sl-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
}
.sl-chat-main-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}
.sl-chat-header-info h3 { margin: 0; font-size: 1rem; color: var(--text-primary); }
.sl-chat-project-tag {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--primary-light);
    color: var(--primary);
}
.sl-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sl-chat-msg {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}
.sl-chat-msg.sent {
    align-self: flex-end;
    background: var(--primary);
    color: var(--primary-text);
    border-bottom-right-radius: 4px;
}
.sl-chat-msg.received {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.sl-chat-msg-sender {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
}
.sl-chat-msg.sent .sl-chat-msg-sender { color: rgba(255,255,255,0.7); }
.sl-chat-msg-time {
    font-size: 0.7rem;
    margin-top: 4px;
    color: var(--text-muted);
}
.sl-chat-msg-system {
    align-self: center;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: 8px;
}

.sl-chat-compose {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}
.sl-chat-compose-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.sl-chat-compose-row textarea {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    resize: none;
    font-family: inherit;
}
.sl-chat-participants-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    min-height: 40px;
}
.sl-chat-participant-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
}
.sl-chat-participant-chip.selected {
    background: var(--primary);
    color: var(--primary-text);
}

@media (max-width: 768px) {
    .sl-chat-layout { flex-direction: column; }
    .sl-chat-sidebar { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid var(--border); max-height: 40vh; }
}

/* Contracts */
.sl-contracts-list { display: flex; flex-direction: column; gap: 12px; }
.sl-contract-card {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 12px;
    padding: 16px 20px;
    transition: border-color 0.2s;
}
.sl-contract-card:hover { border-color: var(--accent, #6366f1); }
.sl-contract-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.sl-contract-title { font-weight: 600; color: var(--text, #e2e8f0); font-size: 1rem; }
.sl-contract-status {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}
.sl-contract-pending { background: rgba(245,158,11,0.2); color: #f59e0b; }
.sl-contract-accepted { background: rgba(16,185,129,0.2); color: #10b981; }
.sl-contract-rejected { background: rgba(239,68,68,0.2); color: #ef4444; }
.sl-contract-expired { background: rgba(107,114,128,0.2); color: #6b7280; }
.sl-contract-open { background: rgba(59,130,246,0.2); color: #3b82f6; }
.sl-contract-paid { background: rgba(16,185,129,0.2); color: #10b981; }

.sl-contract-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted, #9ca3af);
    flex-wrap: wrap;
}
.sl-contract-amount {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text, #e2e8f0);
    margin-top: 8px;
}
.sl-contract-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

/* Quote items */
.sl-quote-items { display: flex; flex-direction: column; gap: 8px; }
.sl-quote-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 8px;
    align-items: center;
}
.sl-quote-item-row input {
    padding: 6px 10px;
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 6px;
    background: var(--input-bg, #12121a);
    color: var(--text, #e2e8f0);
    font-size: 0.85rem;
}

/* Audit Log */
.sl-audit-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.sl-audit-filters select {
    padding: 6px 12px;
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 6px;
    background: var(--input-bg, #12121a);
    color: var(--text, #e2e8f0);
}
.sl-audit-log-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.sl-audit-entry {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #2d2d3d);
    font-size: 0.85rem;
}
.sl-audit-time { font-size: 0.75rem; color: var(--text-muted, #9ca3af); white-space: nowrap; min-width: 100px; }
.sl-audit-action {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(99,102,241,0.15);
    color: var(--accent, #6366f1);
    white-space: nowrap;
}
.sl-audit-detail { flex: 1; color: var(--text, #e2e8f0); }
.sl-audit-actor { font-size: 0.75rem; color: var(--text-muted, #9ca3af); }

/* Transfer warning */
.sl-transfer-warning {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #f59e0b;
    font-size: 0.9rem;
}

/* NDA content */
.sl-nda-content { }
.sl-nda-header {
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #3b82f6;
    font-size: 0.85rem;
}
.sl-nda-template {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
}
.sl-nda-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Professional Profile Section */
.profile-card-full { grid-column: 1 / -1; }
.profile-professional-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.profile-field-full { grid-column: 1 / -1; }
.profile-professional-grid textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 6px;
    background: var(--input-bg, #12121a);
    color: var(--text, #e2e8f0);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    box-sizing: border-box;
}
.profile-professional-grid select,
.profile-professional-grid input[type="url"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 6px;
    background: var(--input-bg, #12121a);
    color: var(--text, #e2e8f0);
    font-size: 0.9rem;
    box-sizing: border-box;
}
.profile-cv-upload {
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-specialties-container { display: flex; flex-direction: column; gap: 8px; }
.profile-specialties-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.profile-specialty-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(99,102,241,0.15);
    color: var(--accent, #6366f1);
    font-size: 0.8rem;
}
.profile-specialty-tag .remove-specialty {
    cursor: pointer;
    opacity: 0.6;
    font-size: 1rem;
    line-height: 1;
}
.profile-specialty-tag .remove-specialty:hover { opacity: 1; }
.profile-specialty-input {
    display: flex;
    gap: 6px;
}
.profile-specialty-input input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 6px;
    background: var(--input-bg, #12121a);
    color: var(--text, #e2e8f0);
    font-size: 0.85rem;
}
.profile-professional-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

/* Project History */
.profile-project-history { display: flex; flex-direction: column; gap: 8px; }
.profile-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(99,102,241,0.05);
    border-radius: 8px;
}
.profile-history-project { font-weight: 500; flex: 1; color: var(--text, #e2e8f0); }
.profile-history-role {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(99,102,241,0.15);
    color: var(--accent, #6366f1);
}
.profile-history-dates { font-size: 0.8rem; color: var(--text-muted, #9ca3af); }

/* Ratings */
.profile-ratings { display: flex; flex-direction: column; gap: 8px; }
.profile-rating-item {
    padding: 12px 14px;
    background: rgba(99,102,241,0.05);
    border-radius: 8px;
}
.profile-rating-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.profile-rating-author { font-weight: 500; font-size: 0.9rem; color: var(--text, #e2e8f0); }
.profile-rating-stars { color: #f59e0b; }
.profile-rating-comment { font-size: 0.85rem; color: var(--text-muted, #9ca3af); }
.profile-rating-project { font-size: 0.75rem; color: var(--text-muted, #9ca3af); margin-top: 4px; }

/* Permissions Grid (modal) */
.sl-perms-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.sl-perm-group {
    background: rgba(99,102,241,0.03);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 8px;
    padding: 12px;
}
.sl-perm-group-title {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: capitalize;
    margin-bottom: 8px;
    color: var(--text, #e2e8f0);
}
.sl-perm-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted, #9ca3af);
    padding: 2px 0;
    cursor: pointer;
}
.sl-perm-group label:hover { color: var(--text, #e2e8f0); }

/* User Profile Modal */
.sl-user-profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}
.sl-user-profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
}
.sl-user-profile-info h2 { margin: 0 0 4px; }
.sl-user-profile-info p { margin: 0; color: var(--text-muted, #9ca3af); }
.sl-user-profile-badges {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

@media (max-width: 600px) {
    .sl-dash-stats { grid-template-columns: 1fr 1fr; }
    .sl-dash-projects-grid { grid-template-columns: 1fr; }
    .profile-professional-grid { grid-template-columns: 1fr; }
    .sl-perms-grid { grid-template-columns: 1fr; }
    .sl-quote-item-row { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   Photo Upload Section (Location form)
   ============================================================ */

.photo-upload-section {
    margin: 8px 0 16px;
}

.photo-upload-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.photo-upload-actions .btn-secondary {
    font-size: 13px;
    padding: 6px 14px;
}

.photo-upload-count {
    font-size: 13px;
    color: var(--text-secondary, #888);
    margin-bottom: 8px;
}

.photo-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding: 2px;
}

.photo-upload-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--border, #333);
    background: var(--bg-secondary, #1a1a1a);
    transition: border-color 0.2s;
}

.photo-upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-upload-thumb .photo-upload-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 15px;
    line-height: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0;
}

.photo-upload-thumb:hover .photo-upload-remove {
    opacity: 1;
}

.photo-upload-thumb .photo-upload-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 10px;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.photo-upload-thumb .photo-upload-status {
    position: absolute;
    top: 3px;
    left: 3px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-upload-thumb.uploaded {
    border-color: #22c55e;
}

.photo-upload-thumb.uploaded .photo-upload-status {
    background: #22c55e;
}

.photo-upload-thumb.failed {
    border-color: #ef4444;
}

.photo-upload-thumb.failed .photo-upload-status {
    background: #ef4444;
}

.photo-upload-thumb .photo-upload-error {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(239, 68, 68, 0.92);
    color: #fff;
    font-size: 9px;
    padding: 4px 3px;
    text-align: center;
    line-height: 1.2;
    border-radius: 0 0 6px 6px;
    word-break: break-word;
}

.photo-upload-progress {
    margin-top: 10px;
}

.progress-bar-container {
    height: 6px;
    background: var(--border, #333);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary, #3b82f6);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary, #888);
    margin-top: 4px;
}

.photo-upload-inline-section {
    grid-column: 1 / -1;
    margin: 12px 0;
}

@media (max-width: 600px) {
    .photo-upload-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    .photo-upload-actions {
        flex-direction: column;
    }
}

/* Detail view photo upload panel */
.detail-photo-upload-panel {
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.detail-photo-upload-btn-row {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

