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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    padding: 0;
}

.container {
    max-width: 100%;
    margin: 0;
    background: white;
    overflow: hidden;
    min-height: 100vh;
}

.header {
    background: #ffffff;
    color: #37352f;
    padding: 30px 40px;
    border-bottom: 1px solid #e9e9e7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.header p {
    color: #9b9a97;
    font-size: 14px;
}

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

.content {
    display: flex;
    padding: 0;
    min-height: 600px;
}

.sidebar {
    width: 260px;
    background: #fafafa;
    border-right: 1px solid #e5e5e5;
    padding: 16px 12px;
    overflow-y: auto;
}

.main-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    background: #ffffff;
}

/* (month-selector styles removed - actions moved to sidebar) */

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #171717;
    color: white;
}

.btn-primary:hover {
    background: #333333;
}

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

.btn-secondary {
    background: white;
    color: #37352f;
    border: 1px solid #e5e5e5;
}

.btn-secondary:hover {
    background: #fafafa;
    border-color: #d4d4d4;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f7f7f5;
}

.btn-success {
    background: #171717;
    color: white;
}

.btn-success:hover {
    background: #333333;
}

.btn-info {
    background: #171717;
    color: white;
}

.btn-info:hover {
    background: #333333;
}

.actions {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #37352f;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: #171717;
    border-radius: 2px;
}

.folder-tree {
    font-size: 13px;
}

.tree-node {
    margin-left: 0;
}

.tree-node-children {
    margin-left: 16px;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s;
}

.tree-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.tree-item.selected {
    background: #e0e0e0;
}

.tree-toggle {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    color: #9b9a97;
    font-size: 10px;
    transition: transform 0.2s;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-toggle.hidden {
    visibility: hidden;
}

.tree-icon {
    margin-right: 8px;
    color: #9b9a97;
}

.tree-label {
    flex: 1;
    color: #37352f;
}

.tree-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.tree-status.has-data {
    background: #f0fdfa;
    color: #0f7b6c;
}

.tree-status.empty {
    background: #fef2f2;
    color: #e03e3e;
}

.tree-status.missing {
    background: #fef2f2;
    color: #e03e3e;
}

.tree-upload-btn {
    margin-left: 8px;
    cursor: pointer;
    font-size: 14px;
}

.tree-upload-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.results-container {
    background: #fafafa;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #f0f0f0;
}

.result-section {
    margin-bottom: 24px;
}

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

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

.result-title {
    font-weight: 550;
    color: #171717;
    font-size: 14px;
}

.result-count {
    font-size: 12px;
    color: #9b9a97;
}

.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #fafafa;
    padding: 10px 14px;
    text-align: left;
    font-weight: 500;
    color: #525252;
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    color: #37352f;
}

tr:hover {
    background: #fafafa;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #9b9a97;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e5e5e5;
    border-top-color: #525252;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    animation: slideIn 0.2s ease;
    max-width: 400px;
    font-size: 13px;
    border: 1px solid #e5e5e5;
}

.notification.success {
    border-left: 3px solid #22c55e;
}

.notification.error {
    border-left: 3px solid #ef4444;
}

.notification.info {
    border-left: 3px solid #171717;
}

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

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid #e5e5e5;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #171717;
    margin-bottom: 16px;
}

.modal-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.modal-input:focus {
    outline: none;
    border-color: #a1a1a1;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

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

.sidebar-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(250, 250, 250, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 13px;
    color: #737373;
    z-index: 10;
}

.sidebar-month-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.sidebar-month-selector select {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-width: 0;
    color: #37352f;
}

.sidebar-month-selector select:hover {
    border-color: #d4d4d4;
}

.sidebar-month-selector select:focus {
    outline: none;
    border-color: #a1a1a1;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

/* Sidebar icon button (e.g., add month) */
.sidebar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: white;
    color: #525252;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.sidebar-icon-btn:hover {
    background: #f5f5f5;
    border-color: #d4d4d4;
    color: #171717;
}

.sidebar-icon-btn:active {
    background: #e5e5e5;
}

/* Sidebar action buttons */
.sidebar-actions {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.sidebar-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #525252;
    font-size: 13px;
    font-weight: 450;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex: 1;
    justify-content: center;
}

.sidebar-action-btn:hover {
    background: #f0f0f0;
    color: #171717;
}

.sidebar-action-btn:active {
    background: #e5e5e5;
}

.sidebar-action-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-action-btn:hover svg {
    opacity: 1;
}

/* Sidebar divider */
.sidebar-divider {
    height: 1px;
    background: #e5e5e5;
    margin: 8px 0 12px 0;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 13px;
}

.sidebar {
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e5e5e5;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: #525252;
    transition: width 0.3s ease;
}

.tab-container {
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 24px;
}

.tab {
    display: inline-block;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 450;
    font-size: 13px;
    color: #a1a1a1;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab:hover {
    color: #525252;
}

.tab.active {
    color: #171717;
    border-bottom-color: #171717;
}

.tab-content {
    display: none;
}

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

/* Diff highlighting for stock by custodian table */
.positive-diff {
    color: #0f7b6c;
    font-weight: 500;
}

.negative-diff {
    color: #e03e3e;
    font-weight: 500;
}

/* File Manager Modal Styles */
.modal-large {
    width: 560px;
    max-width: 90%;
}

.modal-subtitle {
    font-size: 13px;
    color: #a1a1a1;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e5e5;
}

.file-section {
    margin-bottom: 20px;
}

.file-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #37352f;
    margin-bottom: 10px;
}

.file-list {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fafafa;
}

.file-list-empty,
.file-list-loading {
    padding: 20px;
    text-align: center;
    color: #9b9a97;
    font-size: 13px;
}

.file-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: white;
}

.file-list-item:last-child {
    border-bottom: none;
}

.file-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    margin-right: 8px;
}

.file-name {
    font-size: 13px;
    color: #37352f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 11px;
    color: #9b9a97;
    margin-top: 2px;
}

.file-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0.7;
    transition: all 0.2s;
}

.file-delete-btn:hover {
    opacity: 1;
    background: #fef2f2;
}

.file-upload-area {
    border: 2px dashed #d1d1d1;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: #525252;
    background: #f5f5f5;
}

.file-upload-placeholder {
    color: #9b9a97;
    font-size: 14px;
}

.file-upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.file-upload-hint {
    font-size: 12px;
    color: #c4c4c4;
    margin-top: 6px;
}

.selected-files-list {
    margin-top: 12px;
    max-height: 120px;
    overflow-y: auto;
}

.selected-file-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f0fdfa;
    border: 1px solid #d1fae5;
    border-radius: 4px;
    margin-bottom: 6px;
}

.selected-file-name {
    flex: 1;
    font-size: 13px;
    color: #37352f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.selected-file-size {
    font-size: 11px;
    color: #9b9a97;
    margin-right: 8px;
}

.selected-file-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #e03e3e;
    font-size: 18px;
    font-weight: 500;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.selected-file-remove:hover {
    opacity: 1;
}

/* Filter Checkbox Group Styles */
.filter-checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 16px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.filter-category {
    flex: 1;
    min-width: 180px;
}

.filter-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-category-title {
    font-size: 13px;
    font-weight: 600;
    color: #37352f;
}

.filter-category-actions {
    display: flex;
    gap: 8px;
}

.filter-action-link {
    font-size: 12px;
    color: #525252;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
}

.filter-action-link:hover {
    color: #171717;
    text-decoration: underline;
}

.filter-checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.filter-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #37352f;
    transition: background 0.15s;
    user-select: none;
}

.filter-checkbox-label:hover {
    background: #f5f5f5;
}

.filter-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #171717;
    flex-shrink: 0;
}

.filter-checkbox-text {
    white-space: nowrap;
}

.filter-empty {
    font-size: 12px;
    color: #9b9a97;
    font-style: italic;
}
