:root {
    --primary: #1E4E8C;
    --primary-hover: #163b69;
    --sidebar-bg: #F3F4F6;
    --sidebar-text: #475569;
    --sidebar-active: #0f172a;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --transition: all 0.2s ease-in-out;
    --menu-bg: #ffffff;
    --overlay-bg: rgba(15, 23, 42, 0.5);
    --tooltip-bg: #1e293b;
}

[data-theme="dark"] {
    --primary: #4f8ed9;
    --primary-hover: #3d78bf;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #e2e8f0;
    --bg-color: #020617;
    --card-bg: #0b1220;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #1e293b;
    --success-bg: rgba(16, 185, 129, 0.18);
    --warning-bg: rgba(245, 158, 11, 0.2);
    --danger-bg: rgba(239, 68, 68, 0.2);
    --menu-bg: #111827;
    --overlay-bg: rgba(2, 6, 23, 0.72);
    --tooltip-bg: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.45);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.55), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

input[type="checkbox"] {
    accent-color: var(--primary);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Typography */
h1 { font-size: 1.5rem; font-weight: 600; color: var(--text-main); }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 500; }
p { color: var(--text-muted); font-size: 0.95rem; }
.hint { font-size: 0.85rem; color: var(--text-muted); margin-top: 5px; }

/* Buttons */
button { cursor: pointer; border: none; font-weight: 500; border-radius: var(--radius-md); transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.95rem; }
.btn-primary { background-color: var(--primary); color: white; padding: 10px 20px; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background-color: #f1f5f9; color: var(--text-main); padding: 10px 20px; border: 1px solid var(--border-color); }
.btn-secondary:hover { background-color: #e2e8f0; }
.btn-secondary.danger-text { color: var(--danger); border-color: var(--danger); }
.btn-secondary.danger-text:hover { background: var(--danger-bg); }
.btn-text { background: transparent; color: var(--primary); padding: 5px 10px; }
.btn-text:hover { background: #e8eff8; }
.text-danger { color: var(--danger); }
.icon-btn { background: transparent; color: var(--text-muted); padding: 8px; border-radius: 50%; }
.icon-btn:hover { background: #f1f5f9; color: var(--text-main); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }

.theme-toggle-btn {
    width: 100%;
    margin-top: 12px;
    background: transparent;
    color: var(--sidebar-text);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-main);
}

.sidebar-end-actions {
    margin-top: 12px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    justify-content: center;
}

.sidebar-end-actions .top-action-btn {
    width: 40px;
    justify-content: center;
    height: 36px;
    padding: 0;
    gap: 6px;
    margin: 0;
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.sidebar-end-actions .top-action-btn:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    color: var(--text-main);
    z-index: 10;
}
.sidebar-header {
    height: auto;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(15,23,42,0.08);
}
.brand-info { display: flex; flex-direction: column; }
.brand-family { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--sidebar-text); font-weight: 600; margin-bottom: 4px; }
.brand-family-logo { display: block; width: 185px; max-width: 100%; height: auto; }
.brand-module { display: flex; align-items: center; gap: 8px; }
.brand-module h2 { margin: 0; font-size: 1.25rem; }
.logo-icon-sm { color: var(--primary); font-size: 22px; }
.sidebar-nav { flex: 1; padding: 24px 12px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-maintenance-sep {
    margin: 10px 8px 2px;
    padding-top: 10px;
    border-top: 1px solid rgba(15, 23, 42, 0.14);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sidebar-text);
    opacity: 0.8;
}
.nav-item {
    width: 100%;
    background: transparent;
    color: var(--sidebar-text);
    justify-content: flex-start;
    padding: 12px 16px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}
.nav-item:hover, .nav-item.active {
    background: rgba(15,23,42,0.06);
    color: var(--sidebar-active);
}
.admin-only { display: none; }
.nav-item.active { position: relative; font-weight: 500; }
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 10%; height: 80%; width: 4px; background: var(--primary); border-radius: 0 4px 4px 0;
}
.sidebar-footer { padding: 20px; border-top: 1px solid rgba(15,23,42,0.08); }
.user-profile { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; color: white; }
.user-info .name { color: var(--text-main); font-size: 0.9rem; font-weight: 500; margin: 0; }
.user-info .role { color: var(--sidebar-text); font-size: 0.8rem; margin: 0; }

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Topbar */
.topbar {
    height: 70px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
}
.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    padding: 8px 16px;
    border-radius: 30px;
    gap: 8px;
    width: 300px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 78, 140, 0.1); }
.search-bar input { border: none; background: transparent; outline: none; width: 100%; color: var(--text-main); }
.search-bar .material-symbols-rounded { color: var(--text-muted); font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }

/* Content Area */
.content-area { flex: 1; padding: 32px; overflow-y: auto; }
.view { display: none; animation: fadeIn 0.4s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-header { margin-bottom: 24px; }
.flex-between { display: flex; justify-content: space-between; align-items: flex-end; }

/* Dashboard Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 32px; }
.kpi-card { background: var(--card-bg); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border-color); display: flex; gap: 16px; align-items: flex-start; box-shadow: var(--shadow-sm); transition: var(--transition); }
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.pending .kpi-icon { background: var(--warning-bg); color: var(--warning); }
.signed .kpi-icon { background: var(--success-bg); color: var(--success); }
.rejected .kpi-icon { background: var(--danger-bg); color: var(--danger); }
.total .kpi-icon { background: #e8eff8; color: var(--primary); }
.kpi-details h3 { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; margin-bottom: 4px; }
.kpi-value { font-size: 1.8rem; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.trend { font-size: 0.8rem; font-weight: 500; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }

/* Table */
.recent-documents { background: var(--card-bg); border-radius: var(--radius-lg); border: 1px solid var(--border-color); padding: 24px; box-shadow: var(--shadow-sm); }
.recent-documents h3 { margin-bottom: 16px; margin-top: 0; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 12px 16px; color: var(--text-muted); font-weight: 500; font-size: 0.9rem; border-bottom: 1px solid var(--border-color); }
.data-table td { padding: 16px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--bg-color); }
.data-table tbody tr:last-child td { border-bottom: none; }

.doc-info { display: flex; align-items: center; gap: 12px; }
.doc-info .material-symbols-rounded { color: var(--text-muted); font-size: 28px; }
.doc-name { font-weight: 500; color: var(--text-main); margin: 0; }
.doc-date { color: var(--text-muted); font-size: 0.8rem; margin: 0; }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 500; }
.status-badge.pending { background: var(--warning-bg); color: var(--warning); }
.status-badge.signed { background: var(--success-bg); color: var(--success); }
.status-badge.rejected { background: var(--danger-bg); color: var(--danger); }
.status-badge.draft { background: #e2e8f0; color: #475569; }
.status-badge.in-review { background: #d8e4f2; color: #1a4277; }
.status-badge.obsolete { background: var(--danger-bg); color: var(--danger); text-decoration: line-through; }

.progress-bar-container { display: flex; align-items: center; gap: 10px; }
.progress-bar { height: 6px; background: var(--primary); border-radius: 3px; }
.progress-bar-container > div:first-child { flex: 1; background: var(--border-color); border-radius: 3px; overflow: hidden; }
.progress-bar.success { background: var(--success); }
.progress-bar.danger { background: var(--danger); }
.progress-bar-container span { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

/* Upload View */
.upload-container { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.upload-dropzone { border: 2px dashed var(--border-color); border-radius: var(--radius-lg); padding: 32px 24px; text-align: center; background: var(--card-bg); transition: var(--transition); display: flex; flex-direction: column; align-items: center; gap: 12px; cursor: pointer; }
.upload-dropzone.drag-over { border-color: var(--primary); background: #f0fdf4; color: var(--primary); }
.upload-dropzone .lg { font-size: 48px; color: var(--text-muted); }

.upload-settings { background: var(--card-bg); padding: 32px; border-radius: var(--radius-lg); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.form-group { margin-bottom: 24px; margin-top: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 8px; }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); outline: none; transition: var(--transition); font-size: 0.95rem; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(30, 78, 140, 0.1); }
.password-input-wrap {
    position: relative;
}
.password-input-wrap .form-control {
    padding-right: 42px;
}
.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
}
.password-toggle-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

/* Keep reveal button anchored inside password input even when it has data-tooltip */
.password-toggle-btn[data-tooltip] {
    position: absolute;
}

/* Badges */
.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Priority Badges */
.badge.priority-normal { background: #f1f5f9; color: #64748b; }
.badge.priority-high { background: #fef3c7; color: #d97706; }
.badge.priority-urgent { background: #fee2e2; color: #dc2626; }
.badge[onclick] { cursor: pointer; position: relative; transition: var(--transition); }
.badge[onclick]:hover { filter: brightness(0.92); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* Priority Dropdown Menu */
.priority-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 140px;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.priority-menu.active {
    display: flex;
    animation: slideDown 0.2s ease;
}

.priority-menu-item {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    color: var(--text-main);
}

.priority-menu-item:hover {
    background: #f1f5f9;
}

.priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Status Badges (Misc) */
.badge.status-pending { background: #e8eff8; color: #1E4E8C; }
.badge.status-review { background: #f0fdf4; color: #16a34a; }
.badge.status-draft { background: #f1f5f9; color: #475569; }

/* Compatibility with previous types */
.type-serie { background: #f1f5f9; color: #475569; }
.type-parallel { background: #fef3c7; color: #d97706; }
select[multiple] { height: 120px; }

.designer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.signer-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.signer-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-color); border: 1px solid var(--border-color); border-radius: var(--radius-md); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.signer-item.dragging { opacity: 0.5; transform: scale(0.98); box-shadow: var(--shadow-lg); border: 1px dashed var(--primary); }
.drag-handle { color: var(--text-muted); cursor: grab; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.signer-info { flex: 1; font-weight: 500; }

.hidden { display: none !important; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border-color); }
.right { justify-content: flex-end; }

/* Workflows View */
.workflows-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); 
    gap: 24px; 
}
.flow-card { 
    background: var(--card-bg); 
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-color); 
    padding: 24px; 
    box-shadow: var(--shadow-sm); 
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.flow-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.flow-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: transparent;
    transition: var(--transition);
}
.flow-card:hover::before {
    background: var(--primary);
}

.flow-card-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 16px; 
}
.flow-card-header h3 { 
    margin: 0; 
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
}
.badge { 
    padding: 4px 10px; 
    border-radius: 6px; 
    font-size: 0.7rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}
.type-serie { background: #d8e4f2; color: #1a4277; }
.type-paralelo { background: #fbe1e8; color: #881337; }

.flow-desc { 
    margin-bottom: 20px; 
    min-height: 40px; 
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.flow-steps { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 24px; 
    padding: 20px; 
    background: #f8fafc; 
    border-radius: var(--radius-md); 
    border: 1px solid #f1f5f9;
    min-height: 100px;
    overflow-x: auto;
}
.flow-steps::-webkit-scrollbar {
    height: 6px;
}
.flow-steps::-webkit-scrollbar-track {
    background: transparent;
}
.flow-steps::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.flow-steps::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.flow-steps.parallel { 
    flex-wrap: wrap; 
    justify-content: center;
}

.step { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 8px; 
    flex: 0 0 auto;
    width: 80px;
}
.avatar-sm { 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    background: var(--primary); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 0.85rem; 
    color: white;
    font-weight: 700; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 2px solid white;
}
.step span { 
    font-size: 0.75rem; 
    font-weight: 600; 
    color: var(--text-main);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.arrow { 
    color: var(--text-muted); 
    font-size: 20px;
    opacity: 0.5;
}
.flow-actions { 
    display: flex; 
    justify-content: flex-end; 
    gap: 8px;
    border-top: 1px solid var(--border-color); 
    padding-top: 16px; 
    margin-top: auto; 
}

/* Distribution View */
.distribution-panel { background: var(--card-bg); padding: 32px; border-radius: var(--radius-lg); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.distribution-search { margin-bottom: 32px; }
.distribution-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.dist-card { border: 2px solid var(--border-color); border-radius: var(--radius-lg); padding: 24px; cursor: pointer; transition: var(--transition); }
.dist-card.active { border-color: var(--primary); background: #e8eff8; }
.dist-card .material-symbols-rounded { font-size: 32px; color: var(--text-muted); margin-bottom: 16px; }
.dist-card.active .material-symbols-rounded { color: var(--primary); }
.dist-card h4 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; }

/* My Signatures View */
.signatures-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 24px; }
.signature-card { 
    background: var(--card-bg); 
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-color); 
    padding: 24px; 
    box-shadow: var(--shadow-sm); 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
    transition: var(--transition); 
    position: relative;
    /* overflow: hidden; */ /* Eliminado para permitir tooltips */
}
.signature-card:hover { 
    transform: translateY(-4px); 
    box-shadow: var(--shadow-md); 
    border-color: var(--primary); 
}
.signature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: transparent;
    transition: var(--transition);
}
.signature-card:hover::before {
    background: var(--primary);
}
.signature-card .doc-icon { width: 48px; height: 48px; border-radius: 12px; background: #e8eff8; color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.sig-details h3 { 
    font-size: 1.1rem; 
    margin-bottom: 8px; 
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sig-details p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.sig-actions { 
    display: flex; 
    gap: 8px; 
    margin-top: auto; 
    border-top: 1px solid var(--border-color); 
    padding-top: 16px; 
    flex-wrap: wrap;
}
.sig-actions button {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    white-space: nowrap;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 50; animation: fadeIn 0.2s ease; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--card-bg); width: 100%; max-width: 600px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 1.25rem; }
.modal-body { padding: 24px; }
.modal-body p { margin-bottom: 16px; }
.sign-pad-container { background: var(--bg-color); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 16px; }
.sign-pad { height: 150px; background: white; border: 2px dashed var(--border-color); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; cursor: crosshair; margin-top: 8px; }
.sign-pad .material-symbols-rounded { font-size: 48px; opacity: 0.2; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 12px; background: #f8fafc; }

/* Icon Selector */
.icon-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 8px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    max-height: 210px;
    overflow-y: auto;
    overflow-x: hidden;
}

.icon-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    gap: 6px;
}

.icon-option:hover {
    background: #fff1f3;
    border-color: var(--primary);
}

.icon-option.selected {
    background: #e8eff8;
    border-color: var(--primary);
}

.icon-option .heroicon-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--text-muted);
    transition: var(--transition);
}

.icon-option .heroicon {
    width: 28px;
    height: 28px;
    stroke: currentColor;
}

.icon-option.selected .heroicon-slot {
    color: var(--primary);
}

.icon-option:hover .heroicon-slot {
    color: var(--primary);
}

.icon-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.icon-option.selected .icon-label {
    color: var(--primary);
}

.icon-option:hover .icon-label {
    color: var(--primary);
}

/* Tabs */
.tabs-container { display: flex; gap: 24px; border-bottom: 1px solid var(--border-color); margin-bottom: 24px; }
.tab-btn { background: transparent; border: none; padding: 12px 16px; font-weight: 500; font-size: 1rem; color: var(--text-muted); border-bottom: 3px solid transparent; cursor: pointer; transition: var(--transition); border-radius: 0; }
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content.hidden { display: none; }

/* Custom Flow Builder Visualization */
#signer-list { 
    transition: var(--transition);
    max-height: 265px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
}
#signer-list::-webkit-scrollbar { width: 6px; }
#signer-list::-webkit-scrollbar-track { background: var(--bg-color); border-radius: 4px; }
#signer-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
#signer-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
#signer-list.mode-serie { display: flex; flex-direction: column; gap: 24px; padding-bottom: 24px; }
#signer-list.mode-serie .signer-item { position: relative; width: 100%; max-width: 400px; margin: 0 auto; box-shadow: var(--shadow-sm); z-index: 2; }
#signer-list.mode-serie .signer-item:not(:last-child)::after {
    content: 'arrow_downward';
    font-family: 'Material Symbols Rounded';
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 24px;
    z-index: 1;
}

#signer-list.mode-paralelo {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 24px;
}

#signer-list.mode-paralelo .signer-item { position: relative; width: 100%; max-width: 400px; margin: 0 auto; box-shadow: var(--shadow-sm); z-index: 2; }

/* Hide ordering features when in parallel */
#signer-list.mode-paralelo .drag-handle { visibility: hidden; }
#signer-list.mode-paralelo + .hint { display: none; }

/* Document Tree Styles */
.document-tree {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.tree-item {
    position: relative;
}

.tree-item-header {
    display: flex;
    align-items: center;
    padding: 0 8px; /* Changed from 6px 8px to handle height via min-height */
    height: 32px;   /* Fixed height to prevent vertical shifts */
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease; /* Transition only background */
    margin-bottom: 2px;
}

.tree-item-header:hover {
    background: var(--bg-color);
}

.tree-item-header.drag-over {
    background: #ffe4e6;
    border: 2px dashed var(--primary);
    padding-top: 4px;
    padding-bottom: 4px;
}

.tree-item-header .toggle-icon {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 18px;
}

.tree-item-header .folder-icon,
.tree-item-header .material-symbols-rounded {
    margin-right: 8px;
    color: var(--text-muted);
    font-size: 20px;
}

.tree-item-header .folder-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.tree-item-header .folder-icon .heroicon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.label-and-actions {
    display: flex;
    align-items: center;
    flex: 1;
}

.tree-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    margin-right: 40px; /* Even more separation from text */
}

.tree-item-actions {
    display: none; /* Changed back to none but with fixed height parent to avoid jump */
    gap: 0px; /* Icons closer together */
    align-items: center;
}

.tree-item-header:hover .tree-item-actions {
    display: flex;
}

.tree-item-actions .icon-btn {
    padding: 0;
    width: 24px;
    height: 24px;
    font-size: 18px; /* Slightly larger for better visibility */
    margin-right: 0px;
}

.tree-item-actions .icon-btn:hover {
    background: transparent;
    color: var(--primary);
}

.doc-type-indicator {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 700;
    text-transform: uppercase;
}
.doc-type-indicator.simple { background: #f1f5f9; color: #64748b; }
.doc-type-indicator.reviewable { background: #dcfce7; color: #166534; }
.doc-type-indicator.revision { background: #fef9c3; color: #854d0e; }

/* Modal Inline Edit */
.editable-text {
    display: block;
    padding: 10px 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}
.editable-text:hover {
    background: var(--bg-color);
    border-color: var(--border-color);
}

/* Version Dropzone */
.version-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 20px;
    background: #fdfdfd;
    transition: var(--transition);
    margin-bottom: 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
}
.version-dropzone.drag-over {
    border-color: var(--primary);
    background: #e8eff8;
    color: var(--primary);
}
.dropzone-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.version-dropzone .main-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}
.version-dropzone .sub-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}
.version-dropzone .material-symbols-rounded {
    font-size: 24px;
}

.tree-input {
    border: none;
    border-bottom: 1px solid var(--primary);
    background: transparent;
    outline: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    padding: 2px 4px;
    border-radius: 3px;
    width: 100%;
}

.tree-children {
    margin-left: 24px;
    border-left: 1px solid var(--border-color);
    padding-left: 8px;
}

.tree-children.hidden {
    display: none;
}

/* Toolbar */
.tree-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.tree-controls {
    display: flex;
    gap: 8px;
}

/* Tree Actions */
.tree-actions {
    display: flex;
    gap: 12px;
}

/* Shuttle / Dual Listbox */
.shuttle-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.shuttle-box {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 250px;
}

.shuttle-header {
    background: var(--bg-color);
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

.shuttle-filter {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.shuttle-filter input {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
}

.shuttle-filter input:focus {
    border-color: var(--primary);
}

.shuttle-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    padding: 0;
}

.shuttle-item {
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f8fafc;
    transition: var(--transition);
}

.shuttle-item:hover {
    background: #f1f5f9;
}

.shuttle-item.selected {
    background: #e8eff8;
    color: var(--primary);
    font-weight: 500;
}

.shuttle-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.shuttle-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shuttle-controls .icon-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
}

.shuttle-controls .icon-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.distribution-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-main);
}

/* Distribution Groups Maintenance */
.dist-pro-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.dist-pro-left,
.dist-pro-right {
    min-width: 0;
}

#users-maintenance .dist-pro-left {
    height: calc(100vh - 220px);
    display: flex;
}

#users-maintenance .dist-pro-left .dist-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
}

#users-maintenance #users-maint-list {
    flex: 1;
    max-height: none;
}

#users-maintenance #users-maint-list .dist-group-item:first-child {
    margin-top: 5px;
}

#distribution-groups #dist-groups-list .dist-group-item:first-child {
    margin-top: 5px;
}


.dist-pro-right {
    display: grid;
    gap: 18px;
}

.dist-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.dist-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.dist-panel-head h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.dist-panel-head p {
    margin: 2px 0 0;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.dist-counter {
    min-width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #e8eff8;
    color: var(--primary);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.dist-group-search {
    width: 100%;
    margin: 0 0 12px;
}

.dist-groups-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 530px;
    overflow: auto;
    display: grid;
    gap: 8px;
}

.dist-group-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--card-bg);
}

.dist-group-item:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(30, 78, 140, 0.15);
}

.dist-group-item.active {
    border-color: var(--primary);
    background: #edf4ff;
    box-shadow: 0 0 0 1px rgba(30, 78, 140, 0.22);
}

.dist-group-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.dist-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.3px;
}

.dist-members-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
}

.dist-group-name {
    margin: 0;
    color: var(--text-main);
    font-size: 0.93rem;
    font-weight: 500;
    line-height: 1.3;
}

.dist-empty-list {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dist-create-grid,
.dist-edit-grid {
    display: grid;
    grid-template-columns: minmax(130px, 180px) minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.dist-create-grid .form-group,
.dist-edit-grid .form-group {
    margin: 0;
}

.dist-edit-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

#dist-edit-group-code[readonly] {
    background: var(--bg-color);
    color: var(--text-muted);
}

.dist-members-shuttle {
    align-items: stretch;
}

.dist-members-shuttle .shuttle-box {
    height: 290px;
}

.dist-members-shuttle .shuttle-controls {
    align-self: stretch;
    justify-content: center;
}

.dist-empty-item {
    justify-content: center;
    color: var(--text-muted);
    cursor: default;
}

.dist-members-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

#dist-save-members-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 1280px) {
    .dist-pro-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .dist-create-grid,
    .dist-edit-grid {
        grid-template-columns: 1fr;
    }

    .dist-edit-actions {
        width: 100%;
        flex-direction: column;
    }

    .dist-edit-actions .btn-primary,
    .dist-edit-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 900px) {
    .dist-members-shuttle {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .dist-members-shuttle .shuttle-controls {
        flex-direction: row;
        justify-content: center;
    }
}

[data-theme="dark"] .dist-counter {
    background: rgba(79, 142, 217, 0.24);
    color: #bfdbfe;
}

[data-theme="dark"] .dist-code {
    background: rgba(67, 56, 202, 0.28);
    color: #c7d2fe;
}

[data-theme="dark"] .dist-group-item.active {
    background: rgba(30, 78, 140, 0.22);
}
[data-theme="dark"] .sidebar-maintenance-sep {
    border-top-color: rgba(148, 163, 184, 0.24);
}

[data-theme="dark"] .dist-members-chip {
    background: rgba(148, 163, 184, 0.12);
}

/* Status Change Menu */
.status-menu {
    position: absolute;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 8px 0;
    min-width: 140px;
    animation: fadeIn 0.15s ease;
}

.status-menu-item {
    padding: 8px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    font-weight: 500;
}

.status-menu-item:hover {
    background: var(--bg-color);
    color: var(--primary);
}

.status-menu-item .material-symbols-rounded {
    font-size: 18px;
}

.main-content.drag-over-global {
    position: relative;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}
.toast {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    max-width: 400px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease forwards;
    border-left: 4px solid var(--primary);
}
.toast.closing {
    animation: toastFadeOut 0.3s ease forwards;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--primary); }

.toast .material-symbols-rounded {
    font-size: 24px;
}
.toast.success .material-symbols-rounded { color: var(--success); }
.toast.error .material-symbols-rounded { color: var(--danger); }
.toast.warning .material-symbols-rounded { color: var(--warning); }
.toast.info .material-symbols-rounded { color: var(--primary); }

.toast-msg {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    flex: 1;
    line-height: 1.4;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastFadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* Custom Confirm Modal */
.confirm-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}
.confirm-modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 32px;
    text-align: center;
    transform: scale(0.95);
    animation: modalPop 0.3s ease forwards;
}
.confirm-modal .icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--warning-bg);
    color: var(--warning);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
}
.confirm-modal h2 {
    margin-bottom: 12px;
    color: var(--text-main);
}
.confirm-modal p {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
}
.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}
@keyframes modalPop {
    to { transform: scale(1); }
}
.main-content.drag-over-global::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 78, 140, 0.03);
    box-shadow: inset 0 0 50px 10px rgba(30, 78, 140, 0.2);
    z-index: 100;
    pointer-events: none;
    border-radius: inherit;
    animation: glowPulse 1.5s infinite alternate;
}

@keyframes glowPulse {
    from { box-shadow: inset 0 0 30px 5px rgba(30, 78, 140, 0.1); }
    to { box-shadow: inset 0 0 60px 15px rgba(30, 78, 140, 0.3); }
}/* Priority Options */
.priority-option {
    padding: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.priority-option:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.priority-option.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.priority-option.active[data-priority="high"] { background: #f59e0b; border-color: #f59e0b; }
.priority-option.active[data-priority="urgent"] { background: #ef4444; border-color: #ef4444; }


/* Professional Tooltips */
[data-tooltip] {
    position: relative;
}

/* Flow Dropdown Menu */
.flow-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 200px;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.flow-menu.active {
    display: flex;
    animation: slideDown 0.2s ease;
}

.flow-menu-item {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    color: var(--text-main);
}

.flow-menu-item:hover {
    background: #f1f5f9;
}

.flow-badge-icon {
    font-size: 18px;
    color: var(--text-muted);
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 10000;
    pointer-events: none;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    pointer-events: none;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.pagination-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.pagination-item:hover:not([disabled]) {
    border-color: var(--primary);
    color: var(--primary);
    background: #e8eff8;
}

.pagination-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(30, 78, 140, 0.2);
}

.pagination-item[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8fafc;
}

.pagination-item .material-symbols-rounded {
    font-size: 18px;
}

[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .pagination-item,
[data-theme="dark"] .shuttle-filter input,
[data-theme="dark"] .form-control,
[data-theme="dark"] .login-container {
    background: var(--card-bg);
}

[data-theme="dark"] .priority-menu,
[data-theme="dark"] .flow-menu,
[data-theme="dark"] .status-menu,
[data-theme="dark"] .toast,
[data-theme="dark"] .confirm-modal,
[data-theme="dark"] .sign-pad,
[data-theme="dark"] .modal-footer {
    background: var(--menu-bg);
}

[data-theme="dark"] .modal-overlay,
[data-theme="dark"] .confirm-modal-overlay {
    background: var(--overlay-bg);
}

[data-theme="dark"] [data-tooltip]::before {
    background: var(--tooltip-bg);
}

[data-theme="dark"] [data-tooltip]::after {
    border-color: var(--tooltip-bg) transparent transparent transparent;
}

[data-theme="dark"] .flow-steps,
[data-theme="dark"] .status-badge.draft,
[data-theme="dark"] .version-dropzone,
[data-theme="dark"] .shuttle-header,
[data-theme="dark"] .shuttle-item:hover,
[data-theme="dark"] .tree-item-header:hover {
    background: rgba(148, 163, 184, 0.08);
}

/* ==============================================================
   Distribution Groups View (Professional Update)
   ============================================================== */

.dist-pro-layout {
    display: flex;
    gap: 24px;
    align-items: stretch;
    height: calc(100vh - 220px);
}

.dist-pro-left {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.dist-pro-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    padding-right: 8px; /* For scrollbar */
}

.dist-pro-right::-webkit-scrollbar {
    width: 6px;
}
.dist-pro-right::-webkit-scrollbar-track {
    background: transparent;
}
.dist-pro-right::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
.dist-pro-right::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.dist-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.dist-panel:hover {
    box-shadow: var(--shadow-md);
}

.dist-pro-left .dist-panel {
    height: 100%;
}

.dist-panel-head {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.dist-panel-head h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
}

.dist-panel-head p {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dist-counter {
    background: var(--primary);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.dist-group-search {
    width: 100%;
    margin-bottom: 16px;
}

.dist-groups-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.dist-groups-list::-webkit-scrollbar {
    width: 4px;
}
.dist-groups-list::-webkit-scrollbar-track {
    background: transparent;
}
.dist-groups-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
.dist-groups-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.dist-group-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.dist-group-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.dist-group-item.active {
    background: #e8eff8;
    border-color: var(--primary);
}
[data-theme="dark"] .dist-group-item.active {
    background: rgba(79, 142, 217, 0.15);
}

.dist-group-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.dist-code {
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--card-bg);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.dist-group-item.active .dist-code {
    color: var(--primary);
    border-color: var(--primary);
}

.dist-members-chip {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: transparent;
}

.dist-group-name {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dist-empty-list {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

.dist-form-grid {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 16px;
    align-items: flex-end;
}

.dist-form-grid .form-group {
    margin: 0;
}

#users-maintenance .users-maint-form-grid {
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 18px 16px;
    align-items: end;
}

#users-maintenance .users-maint-form-grid .form-group:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}

#users-maintenance .users-maint-form-grid .form-group:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

#users-maintenance .users-maint-form-grid .form-group:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
}

#users-maintenance .users-maint-form-grid .form-group:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
}

#users-maintenance .users-maint-form-grid .form-control {
    padding: 10px 12px;
    font-size: 0.95rem;
    min-height: 40px;
}

#users-maintenance .users-maint-form-grid .form-group:nth-child(4) .password-input-wrap {
    max-width: 360px;
}

.dist-form-actions {
    display: flex;
    gap: 12px;
}

.dist-members-shuttle {
    margin-bottom: 0;
}

.dist-panel-members {
    flex: 1;
}

.dist-members-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.dist-panel-members .shuttle-box {
    height: 300px;
}

[data-theme="dark"] .dist-group-item {
    background: var(--card-bg);
}
[data-theme="dark"] .dist-group-item:hover {
    background: rgba(148, 163, 184, 0.08);
}
[data-theme="dark"] .dist-code {
    background: var(--bg-color);
}















