:root {
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #eff6ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --radius: 0.8rem;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --sidebar-width: 17rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    font-size: 0.875rem;
}

body.htmx-swapping {
    opacity: 1;
    transition: opacity 0.1s ease;
}

/* App Layout - Sidebar + Content */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
}

.sidebar-brand {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-brand-logo {
    width: 55px;
    height: 55px;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1.20rem;
    color: var(--gray-900);
    letter-spacing: -0.025em;
    font-weight: 200;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.sidebar-icon {
    width: 15px;
    height: 15px;
    display: inline-flex;
}
.sidebar-icon svg {
    width: 100%;
    height: 100%;
}
.icon-picker-preview svg {
    max-width: 1.2rem;
    height: auto;
}
.sidebar-link {
    display: flex;
    padding: 0.5rem 0.75rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: calc(var(--radius) / 2);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.15s;
    gap: 0.5rem;
    align-items: center;
    margin: 0.10rem 0rem;
}

.sidebar-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.sidebar-link.active {
    background: var(--gray-100);
    color: var(--gray-900);
}

.sidebar-divider {
    height: 1px;
    background: var(--gray-100);
    margin: 0.5rem 0;
}

.sidebar-section-label {
    padding: 0.375rem 0.75rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

.sidebar-footer {
    padding: 0.75rem 0.5rem;
    border-top: 1px solid var(--gray-100);
}

.sidebar-logout {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    text-align: left;
    transition: all 0.15s;
}

.sidebar-logout:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1rem;
    width: calc(100vw - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
}

.sidebar-partition-group {
    margin-bottom: 0;
}

.sidebar-submenu {
    margin-left: 1.25rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--gray-200);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.sidebar-partition-group:has(.sidebar-link.active) .sidebar-submenu {
    max-height: 500px;
}

.sidebar-submenu-link {
    display: block;
    padding: 0.25rem 0.75rem;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 400;
    border-radius: var(--radius);
    transition: all 0.15s;
}

.sidebar-submenu-link:hover {
    color: var(--gray-900);
}

.sidebar-submenu-link.active {
    position: relative;
    color: var(--gray-900);
    font-weight: 400;
}

.sidebar-submenu-link.active::before {
    content: '';
    position: absolute;
    left: calc(-1rem + 1px);
    top: 50%;
    transform: translateY(-50%);
    width: calc(1.35rem - 1px);
    height: 1px;
    background: var(--gray-200);
}

.partition-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.partition-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
    color: var(--gray-600);
}

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

.partition-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.125rem;
}

.partition-info p {
    font-size: 0.75rem;
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.partition-actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

.partition-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray-500);
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-200);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.storage-overview-wrap {
    padding: 0.75rem 1.25rem !important;
}

.storage-overview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.storage-overview h3 {
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.storage-overview-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.storage-stat {
    font-size: 0.8125rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.storage-stat strong {
    font-weight: 700;
    color: var(--gray-900);
}

.storage-stat-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
}

/* Partition layout with type filter */
.partition-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.type-filter-panel {
    width: 14rem;
    flex-shrink: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    position: sticky;
    top: 1.5rem;
}

.type-filter-panel h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.type-filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.type-filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--gray-600);
    transition: all 0.15s;
}

.type-filter-item:hover {
    background: var(--gray-100);
}

.type-filter-item input[type="checkbox"] {
    accent-color: var(--accent);
}

.type-filter-item span:first-of-type {
    flex: 1;
}

.type-count {
    font-size: 0.6875rem;
    color: var(--gray-400);
    background: var(--gray-100);
    padding: 0.0625rem 0.375rem;
    border-radius: 9999px;
}

.partition-content {
    flex: 1;
    min-width: 0;
}

/* Upload modal */
.upload-modal-content {
    max-width: 40rem !important;
}

.upload-modal-body .form-group {
    margin-bottom: 0.75rem;
}

/* Upload */
.upload-container {
    max-width: 36rem;
}

.upload-header {
    margin-bottom: 1rem;
}

.upload-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.upload-partition-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.upload-partition-label strong {
    color: var(--gray-900);
}

/* PDF Preview */
.pdf-preview {
    max-width: 64rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.preview-actions {
    display: flex;
    gap: 0.5rem;
}

.pdf-viewer {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.dashboard-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.stat-card h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* Share */
.share-list {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.share-list h4 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.table-sm th, .table-sm td {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
}
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}
table {
    border-collapse: collapse;
    width: 100%;
}
th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-100);
}
td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-100);
}
tr:last-child td {
    border-bottom: none;
}
tr:hover td {
    background: var(--gray-100);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    align-items: center;
    display: inline-flex;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

.search-bar {
    margin-bottom: 1rem;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--gray-900);
    background: white;
    transition: all 0.2s ease;
}
.search-bar input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-100);
}

.partition-search-bar {
    margin-bottom: 1rem;
}

.partition-search-bar form:first-child {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.partition-search-bar input[type="text"] {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) / 2);
    font-size: 0.875rem;
    color: var(--gray-900);
    background: white;
    transition: all 0.2s ease;
    min-width: 0;
}

.partition-search-bar input[type="text"]:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.partition-search-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.filter-dropdown {
    position: relative;
}

.filter-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) / 2);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.filter-dropdown-btn:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

.filter-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.filter-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.375rem);
    width: 16rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) / 2);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    padding: 0.75rem;
}

.filter-dropdown-section {
    margin-bottom: 0.5rem;
}

.filter-dropdown-section:last-of-type {
    margin-bottom: 0.75rem;
}

.filter-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-dropdown-section input[type="date"] {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: var(--gray-900);
    background: white;
    transition: all 0.15s;
}

.filter-dropdown-section input[type="date"]:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.filter-dropdown-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
}

.partition-search-bar .btn-primary {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.partition-search-bar .btn-secondary {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
    gap: 0.5rem;
}

.page-info {
    color: var(--gray-500);
    font-size: 0.875rem;
}
.upload-container {
    margin-bottom: 1rem;
}
.upload-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}
.upload-partition-label {
    color: var(--gray-500);
    font-size: 0.875rem;
}
.tab-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    background: white;
    transition: all 0.2s ease;
}
.drop-zone {
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1rem;
    
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-100);
}

.drop-zone.drag-over {
    transform: scale(1.02);
}
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    border: 1px solid var(--gray-200);
}
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-close {
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1.25rem;
    background: none;
    border: none;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-900);
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.bulk-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}
.tab {

    border: 1px solid var(--gray-200);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    background: white;
    transition: all 0.2s ease;
}

.tab.active {
    border-bottom: 1px solid white;
    color: var(--accent);
}
.tab:hover {
    background: var(--gray-700);
}
.card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.table-container {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}
/* Versions */
.upload-version {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    border: 1px solid var(--gray-200);
}

.upload-version h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

/* Flash */
.flash {
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid;
}

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.flash-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    margin-left: 0.5rem;
    font-size: 1rem;
    line-height: 1;
}

.alert-close:hover {
    opacity: 1;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
}
.auth-container {
    width: 24rem;
    padding: 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-200);
}
.auth-container h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

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

.form-group label {
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: calc(var(--radius) / 2);
    font-size: 0.875rem;
    color: var(--gray-900);
    background: white;
    transition: border-color 0.2s ease;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) / 2);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: var(--accent);
    color: white;
    height: 2.5rem;
    line-height: 1.25;
    text-decoration: none;
    gap: 0.375rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

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

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

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

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

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

.btn-warning {
    background: var(--warning);
    color: var(--gray-900);
}

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

.btn-info {
    background: var(--info);
    color: var(--gray-900);
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}
.btn-outline:hover {
    background: var(--accent);
    color: white;
}
/* Auth link */
.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.auth-link a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }

    .app-layout {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
        padding: 1rem;
        width: 100vw;
    }

    .page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .actions {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .preview-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .bulk-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .partition-layout {
        flex-direction: column;
    }

    .type-filter-panel {
        width: 100%;
        position: static;
    }
}
.file-item-name {
    margin-left: 0.5rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-item-size {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin: 0 0.75rem;
    white-space: nowrap;
}
.file-item-remove {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    line-height: 1;
}
.file-item-remove:hover {
    color: var(--danger);
    background: var(--danger-100, rgba(239, 68, 68, 0.1));
}
/* Trash modal */
.trash-modal-content {
    max-width: 50rem;
    width: 95%;
}

.trash-modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* Profile page */
.profile-page {
    width: 100%;
}

.profile-tab-nav {
    background: white;
    border-radius: var(--radius);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-200);
}

.profile-tab-link {
    display: inline-flex;
    align-items: center;
    padding: 1rem 0;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
    position: relative;
}

.profile-tab-link:hover {
    color: var(--gray-900);
}

.profile-tab-link.active {
    color: var(--gray-900);
}

.profile-tab-link.active::after {
    content: '';
    position: absolute;
    bottom: 7px;
    left: 0;
    right: 0;
    height: 1.2px;
    background: var(--gray-300);
}

.partition-tab-nav {
    background: white;
    border-radius: var(--radius);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
}

.partition-tab-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.partition-tab-link {
    display: inline-flex;
    align-items: center;
    padding: 1rem 0;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
    position: relative;
}

.partition-tab-link:hover {
    color: var(--gray-900);
}

.partition-tab-link.active {
    color: var(--gray-700);
}

.partition-tab-link.active::after {
    content: '';
    position: absolute;
    bottom: 7px;
    left: 0;
    right: 0;
    height: 1.2px;
    background: var(--gray-300);
}

.partition-tab-separator {
    color: var(--gray-400);
    font-size: 0.875rem;
}

.partition-tab-current {
    display: inline-flex;
    align-items: center;
    padding: 1rem 0;
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 600;
    position: relative;
}

.partition-tab-current::after {
    content: '';
    position: absolute;
    bottom: 7px;
    left: 0;
    right: 0;
    height: 1.2px;
    background: var(--gray-300);
}

.partition-new-btn {
    border-radius: calc(var(--radius) / 2);
}

.profile-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.profile-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-card-right {
    margin-left: auto;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.profile-member-label {
    font-size: 0.75rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-member-date {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.profile-avatar {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-avatar-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    border-radius: 50%;
}

.profile-avatar:hover .profile-avatar-overlay {
    opacity: 1;
}

.profile-avatar-initials {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
}

.profile-heading {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.profile-heading h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.profile-role-badge {
    display: inline-flex;
    align-items: center;
    background: var(--gray-100);
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    text-transform: capitalize;
    width: fit-content;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.75rem;
}

.profile-stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: calc(var(--radius) / 2);
}

.profile-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.profile-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-tab-panel {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-inline-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.form-inline-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-inline-row .btn {
    height: 2.625rem;
    min-width: 6rem;
    flex-shrink: 0;
}

.form-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.profile-section {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.profile-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    margin-bottom: 0;
}

.section-info {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.partition-note {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: #1e40af;
    line-height: 1.5;
}

.partition-note strong {
    color: #1e3a8a;
    font-weight: 600;
}

.partition-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: border-color 0.15s;
}

.partition-card:hover {
    border-color: var(--gray-300);
}

.partition-card-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border-radius: var(--radius);
    flex-shrink: 0;
}

.partition-card-icon svg {
    width: 1rem;
    height: 1rem;
    color: var(--gray-600);
}

.partition-card-main {
    flex: 1;
    min-width: 0;
}

.partition-card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.3;
}

.partition-card-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.type-tag {
    display: inline-block;
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 3px;
    white-space: nowrap;
}

.type-tag-more {
    background: var(--blue-50, #eff6ff);
    color: var(--blue-600, #2563eb);
}

.no-types {
    font-size: 0.6875rem;
    color: var(--gray-400);
    font-style: italic;
}

.partition-card-stats {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.partition-card-stats .stat {
    font-size: 0.6875rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.partition-card-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-200);
}

.btn-icon-danger:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.modal-lg {
    max-width: 600px !important;
}

.modal-sm {
    max-width: 420px !important;
}

.modal-xl {
    max-width: 800px !important;
}

.modal-tabs {
    background: white;
    border-radius: var(--radius);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.modal-tab-link {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 0;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
    position: relative;
    cursor: pointer;
    background: none;
    border: none;
}

.modal-tab-link:hover {
    color: var(--gray-900);
}

.modal-tab-link.active {
    color: var(--gray-900);
}

.modal-tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gray-900);
}

.modal-tab-panel {
    display: none;
}

.modal-tab-panel.active {
    display: block;
}

.doctype-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.doctype-add {
    background: var(--gray-50);
    padding: 0.75rem;
    border-radius: var(--radius);
}

.doctype-add h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin: 0 0 0.5rem 0;
}

.doctype-form-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.doctype-form-row .form-group {
    margin-bottom: 0;
}

.doctype-form-row input {
    font-size: 0.8125rem;
    padding: 0.375rem 0.5rem;
}

.confirm-message {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
    margin: 0 0 1.25rem 0;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.doctype-form-row .form-group label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.doctype-form-row .flex-0 input {
    width: 70px;
}

.doctype-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 300px;
    overflow-y: auto;
}

.doctype-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.doctype-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.doctype-item-name-wrap {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

.doctype-item-info strong {
    font-size: 0.8125rem;
    color: var(--gray-900);
}

.doctype-item-info .doctype-badges {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.doctype-item-info span {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.doctype-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.doctype-item-meta > span {
    font-size: 0.6875rem;
    color: var(--gray-500);
}

.doctype-item-actions {
    display: flex;
    gap: 0.125rem;
}

.doctype-edit-row {
    background: var(--blue-50, #eff6ff);
    border: 1px solid var(--blue-200, #bfdbfe);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
}

.doctype-empty {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
}

.doctype-require-badge {
    display: inline-block;
    font-size: 0.6875rem;
    color: var(--blue-600, #2563eb);
    background: var(--blue-50, #eff6ff);
    border: 1px solid var(--blue-200, #bfdbfe);
    border-radius: 4px;
    padding: 0.1rem 0.375rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

.doctype-preset-label {
    display: inline-block;
    font-size: 0.6875rem;
    color: var(--gray-600);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 0.1rem 0.375rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

.doctype-item[data-preset="invoice"] .doctype-preset-label {
    color: #059669;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.doctype-item[data-preset="contract"] .doctype-preset-label {
    color: #7c3aed;
    background: #f5f3ff;
    border-color: #ddd6fe;
}

.custom-select-wrapper {
    position: relative;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.5rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8125rem;
    transition: border-color 0.15s;
}

.custom-select-selected:hover {
    border-color: var(--gray-400);
}

.custom-select.open .custom-select-selected {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.custom-select-arrow {
    transition: transform 0.15s;
    flex-shrink: 0;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}

.custom-select.open .custom-select-dropdown {
    display: block;
}

.custom-select-option {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.1s;
}

.custom-select-option:hover {
    background: var(--blue-50);
}

.custom-select-option:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

.custom-select-option:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

.flex-0 { flex: 0; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group input,
.form-group textarea {
    font-size: 0.8125rem;
}

.form-group input[type="number"] {
    width: 80px;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    height: auto;
    line-height: 1.25;
}

.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.form-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.form-group-btn {
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.empty-state p {
    margin: 0;
}

.settings-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.settings-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
}

.badge-active {
    background: #f0fdf4;
    color: #166534;
}

.badge-inactive {
    background: var(--gray-100);
    color: var(--gray-500);
}

.table {
    width: 100%;
}

.date-groups {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.date-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--gray-900);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.date-group-item:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.date-group-date {
    font-size: 0.9375rem;
    font-weight: 500;
}

.date-group-count {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.date-nav-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.form-row {
    display: flex;
    gap: 0.75rem;
}

.form-row .form-group {
    flex: 1;
}

/* Document Entries */
.entries-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.entry-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.15s;
}

.entry-card:hover {
    border-color: var(--gray-300);
}

.entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    gap: 1rem;
    transition: background 0.15s;
}

.entry-header:hover {
    background: var(--gray-50);
}

.entry-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.entry-expand-icon {
    font-size: 0.625rem;
    color: var(--gray-400);
    transition: transform 0.15s;
    flex-shrink: 0;
}

.entry-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-type-badge {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.entry-file-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    flex-shrink: 0;
}

.entry-size {
    font-size: 0.75rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.entry-date,
.entry-series,
.entry-uploaded {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.entry-series {
    font-weight: 500;
    color: var(--gray-600);
}

.entry-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.entry-files {
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.entry-files-table {
    width: 100%;
    border-collapse: collapse;
}

.entry-files-table th {
    padding: 0.5rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-100);
    text-align: left;
}

.entry-files-table td {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--gray-700);
    border-top: 1px solid var(--gray-200);
}

.entry-files-table tr:hover td {
    background: var(--gray-100);
}

.entry-files-table .doc-icon {
    display: inline-block;
    width: 2rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--gray-400);
    text-align: center;
    margin-right: 0.375rem;
}

.entry-files-table .doc-link {
    color: var(--gray-900);
    text-decoration: none;
    font-weight: 500;
}

.entry-files-table .doc-link:hover {
    color: var(--accent);
}

/* File requirement indicator */
.file-requirement {
    padding: 0.5rem 0.75rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.file-requirement span {
    font-size: 0.8125rem;
    color: #92400e;
    font-weight: 500;
}

/* Doc type badges */
.doctype-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.doctype-file-badge {
    display: inline-block;
    font-size: 0.6875rem;
    color: var(--gray-600);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 0.125rem 0.375rem;
    font-weight: 500;
}

/* Required field indicator */
.required {
    color: var(--danger);
}

/* File slot management in doc type modal */
.doctype-custom-fields-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.custom-fields-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.custom-fields-header label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0;
}

.custom-fields-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.cf-group-block {
    position: relative;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) / 2);
    padding: 0.5rem;
}

.cf-group-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
}

.cf-field-item {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

.cf-field-name {
    flex: 1;
    min-width: 100px;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: calc(var(--radius) / 2);
    font-size: 0.8125rem;
    color: var(--gray-900);
    background: white;
}

.cf-field-name:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-light);
}

.cf-field-type {
    padding: 0.375rem 0.375rem;
    border: 1px solid var(--gray-300);
    border-radius: calc(var(--radius) / 2);
    font-size: 0.75rem;
    background: white;
    color: var(--gray-700);
    cursor: pointer;
    width: 75px;
    flex-shrink: 0;
}

.cf-field-type:focus {
    border-color: var(--accent);
    outline: none;
}

.cf-field-remove {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1.125rem;
    border-radius: calc(var(--radius) / 2);
    flex-shrink: 0;
}

.cf-field-remove:hover {
    color: var(--danger);
    background: #fef2f2;
}

.cf-group-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.cf-group-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) / 2);
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--gray-500);
    padding: 0.125rem 0.5rem;
    transition: background 0.15s, border-color 0.15s;
}

.cf-group-header-btn:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.cf-group-remove-btn:hover {
    color: var(--danger);
}

.doctype-file-slots-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.file-slots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.file-slots-header label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0;
}

.file-slots-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.file-slots-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 200px;
    overflow-y: auto;
}

.file-slot-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-slot-index {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-400);
    width: 1.5rem;
    flex-shrink: 0;
}

.file-slot-name {
    flex: 1;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: calc(var(--radius) / 2);
    font-size: 0.8125rem;
    color: var(--gray-900);
    background: white;
}

.file-slot-name:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-light);
}

.file-slot-remove {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1.125rem;
    border-radius: calc(var(--radius) / 2);
    flex-shrink: 0;
}

.file-slot-remove:hover {
    color: var(--danger);
    background: #fef2f2;
}

.file-slots-empty {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-style: italic;
    text-align: center;
    padding: 0.75rem 0;
}

/* File slots display in upload modal */
.file-slots-upload {
    margin-bottom: 0.75rem;
}

.file-slots-upload label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
    display: block;
}

.file-slot-upload-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) / 2);
    margin-bottom: 0.375rem;
    transition: background-color 0.15s, border-color 0.15s;
}

.file-slot-upload-item.has-file {
    background: #f0fdf4;
    border-color: #86efac;
}

.file-slot-upload-index {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    width: 1.25rem;
    flex-shrink: 0;
}

.file-slot-upload-name {
    font-size: 0.8125rem;
    color: var(--gray-700);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-slot-upload-file-name {
    font-size: 0.75rem;
    color: var(--success);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-slot-upload-btn {
    flex-shrink: 0;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-700);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: calc(var(--radius) / 2);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.file-slot-upload-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.file-slot-upload-btn.has-file {
    color: var(--success);
    border-color: #86efac;
    background: white;
}

.file-slot-upload-btn.has-file:hover {
    background: #f0fdf4;
}

/* Doc type list header */
.doctype-list-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

/* Doc type slots text */
.doctype-slots-text {
    display: inline-block;
    font-size: 0.6875rem;
    color: var(--gray-500);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Entry file slots info */
.entry-file-slots-info {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    background: white;
}

.entry-file-slot-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.8125rem;
}

.entry-file-slot-file {
    color: var(--gray-700);
    font-weight: 500;
    margin-left: auto;
}

.entry-file-slot-missing {
    color: var(--gray-400);
    font-style: italic;
    margin-left: auto;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: center;
    margin-top: 0.25rem;
}

.tab-nav-spacer {
    flex: 1;
}

.tab-nav-add {
    height: 2rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.table th {
    padding: 0.625rem 1rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--gray-50) !important;
}

.table tbody tr:hover td {
    background: var(--gray-50) !important;
}

.cell-muted {
    color: var(--gray-500);
    font-size: 0.8125rem;
}

.cell-name {
    font-weight: 500;
    color: var(--gray-800);
}

.permissions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.permission-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 4px;
    font-weight: 500;
}

.no-perms {
    color: var(--gray-400);
    font-size: 0.75rem;
    font-style: italic;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-neutral {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-inactive {
    background: var(--gray-100);
    color: var(--gray-500);
}

.actions-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0.375rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.actions-btn:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.actions-dropdown-global {
    display: none;
    position: fixed;
    z-index: 1000;
}

.actions-dropdown-global .dropdown-menu {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: 0.375rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.875rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--gray-700);
    text-align: left;
    transition: background 0.1s;
}

.dropdown-item:hover {
    background: var(--gray-50);
}

.dropdown-item-danger {
    color: var(--danger);
}

.dropdown-item-danger:hover {
    background: #fef2f2;
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-100);
    margin: 0.375rem 0;
}

.modal-body-text {
    padding: 0.5rem 0 1rem;
}

.modal-body-text p {
    margin: 0 0 0.5rem;
}

.text-muted {
    color: var(--gray-500);
    font-size: 0.8125rem;
}

.modal-content {
    max-width: 420px;
}

.permissions-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 0.25rem;
}

.form-group:has(.permissions-grid) {
    margin-bottom: 0.5rem;
}

.form-group:has(.permissions-grid) label {
    margin-bottom: 0.25rem;
}

.permission-checkbox {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0;
    border: none;
    border-bottom: 1px solid var(--gray-100);
    border-radius: 0;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: background 0.1s;
}

.permission-checkbox:last-child {
    border-bottom: none;
}

.permission-checkbox:hover {
    background: var(--gray-50);
}

.permission-checkbox input[type="checkbox"] {
    margin: 0;
    width: 1rem;
    height: 1rem;
}

.btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    height: auto;
    line-height: 1;
}

.document-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.document-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    transition: border-color 0.15s;
}

.document-card:hover {
    border-color: var(--gray-300);
}

.document-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.document-card-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.document-card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-card-type {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.document-card-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.document-card-file-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.document-card-size {
    font-size: 0.75rem;
    color: var(--gray-400);
    white-space: nowrap;
}

.document-card-date {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.document-card-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--gray-100);
}

.document-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
}

.document-file-item:hover {
    background: var(--gray-50);
}

.document-file-icon {
    width: 1.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--gray-400);
    text-align: center;
    flex-shrink: 0;
}

.document-file-name {
    flex: 1;
    min-width: 0;
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-file-name:hover {
    color: var(--accent);
}

.document-file-slot-tag {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 3px;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}

.document-file-size {
    font-size: 0.6875rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

.document-file-actions {
    display: flex;
    gap: 0.125rem;
    flex-shrink: 0;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
}

.document-file-item:hover .document-file-actions {
    max-width: 200px;
    opacity: 1;
}

.file-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.15s;
    text-decoration: none;
}

.file-action-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.file-action-btn svg {
    width: 1rem;
    height: 1rem;
}

.file-action-btn-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    height: auto;
    line-height: 1;
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
    color: var(--gray-900);
    pointer-events: auto;
    max-width: 30rem;
    animation: slideIn 0.3s ease;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    color: var(--gray-600);
}

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

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

.trash-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.trash-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.trash-page-title {
    font-size: 1rem;
    font-weight: 300;
    color: var(--gray-900);
    margin: 0;
}

.trash-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trash-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.trash-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.trash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.trash-card-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: 1;
    min-width: 0;
}

.trash-card-icon {
    width: 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-align: center;
    flex-shrink: 0;
}

.trash-card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trash-card-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.trash-card-size {
    font-size: 0.75rem;
    color: var(--gray-400);
    white-space: nowrap;
}

.trash-card-actions {
    display: flex;
    gap: 0.25rem;
}

.trash-card-actions .btn {
    padding: 0.375rem;
    min-width: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.trash-card-details {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
}

.trash-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
}

.trash-meta-item {
    font-size: 0.75rem;
    color: var(--gray-600);
    white-space: nowrap;
}

.trash-meta-item:not(:last-child)::after {
    content: "";
    display: inline-block;
    width: 3px;
    height: 3px;
    background: var(--gray-300);
    border-radius: 50%;
    margin-left: 0.75rem;
    vertical-align: middle;
}

.trash-meta-label {
    color: var(--gray-400);
    margin-right: 0.25rem;
}

.trash-deleted-date {
    color: var(--danger) !important;
    font-weight: 500;
}

.trash-type-badge {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
}

.trash-slot-badge {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
}

.trash-encrypted-badge {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background: #fef3c7;
    color: #d97706;
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
}

/* Icon picker */
.icon-picker-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


.icon-picker-preview {
    width: 2.4rem;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) / 2);
    flex-shrink: 0;
}

.icon-picker-svg {
    width: 1rem;
    height: 1rem;
}

.icon-picker-search {
    padding: 0.75rem 0rem;
    border-bottom: 1px solid var(--gray-200);
}

.icon-picker-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: calc(var(--radius) / 2);
    font-size: 0.875rem;
    outline: none;
}

.icon-picker-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.375rem;
    padding: 1rem;
    padding-left: 0;
    max-height: 400px;
    overflow-y: auto;
}

.icon-picker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.icon-picker-item:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.icon-picker-item img,
.icon-picker-item svg {
    width: 1.25rem;
    height: 1.25rem;
}

