:root {
    --bg-dark: #f0f4f8;
    --bg-surface: #ffffff;
    --bg-dropdown: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);
    --border-color-light: rgba(0, 0, 0, 0.05);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --radius: 12px;
    --transition: all 0.2s ease;
    
    --body-bg-1: rgba(230, 240, 255, 1);
    --body-bg-2: rgba(220, 255, 230, 0.5);
    --body-bg-3: rgba(255, 230, 240, 0.5);
    --input-bg: rgba(0,0,0,0.05);
    --input-color: #1e293b;
}

[data-theme="dark"] {
    --bg-dark: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --bg-dropdown: #1e293b;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-light: rgba(255, 255, 255, 0.05);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --radius: 12px;
    --transition: all 0.2s ease;
    
    --body-bg-1: hsla(253,16%,7%,1);
    --body-bg-2: hsla(225,39%,30%,0.2);
    --body-bg-3: hsla(339,49%,30%,0.2);
    --input-bg: rgba(0,0,0,0.2);
    --input-color: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, var(--body-bg-1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, var(--body-bg-2) 0, transparent 50%), 
        radial-gradient(at 100% 0%, var(--body-bg-3) 0, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 1rem;
}

.app-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.stats-container {
    display: flex;
    gap: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.header-stats {
    padding: 0.5rem 1rem;
    gap: 1rem;
    box-shadow: none;
    margin: 0;
}

.header-stats .stat-value {
    font-size: 2rem;
}

.header-stats .stat-label {
    font-size: 0.65rem;
}

.header-stats .stat-card {
    min-width: 100px;
    padding: 0 0.75rem;
}

.stat-card {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
    border-right: 1px solid var(--border-color);
}

.stat-card:last-child {
    border-right: none;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-1px);
}

.btn-tertiary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-tertiary:hover {
    background: var(--border-color-light);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    padding: 0.5rem;
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.table-container {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: var(--input-bg);
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    padding: 14px;
    font-size: 14px;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color-light);
}

.highlight-copied {
    animation: fadeCopy 3s ease-out forwards;
}

@keyframes fadeCopy {
    0% { background-color: rgba(66, 133, 244, 0.2); }
    100% { background-color: transparent; }
}

.highlight-clipboard {
    background-color: rgba(66, 133, 244, 0.15) !important;
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 16px;
    text-align: center;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.4;
    background-color: var(--primary-color) !important;
}

.editable {
    position: relative;
    cursor: text;
}

.editable input {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--input-color);
    padding: 0.5rem;
    border-radius: 4px;
    width: 100%;
    min-width: 60px;
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

.editable input[type="number"] {
    min-width: 80px;
}

.editable input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-add-row {
    margin-top: 1rem;
    width: 100%;
    background: var(--border-color-light);
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    justify-content: center;
    padding: 1rem;
}

.btn-add-row:hover {
    background: var(--border-color);
    color: white;
}

.actions-col {
    width: 80px;
    text-align: center;
}

a.task-link {
    color: #60a5fa;
    text-decoration: none;
    transition: var(--transition);
}

a.task-link:hover {
    text-decoration: underline;
    color: #93c5fd;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-surface);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-left: 4px solid var(--secondary); }
.toast.error { border-left: 4px solid var(--danger); }

/* Tabs */
.tabs-container {
    margin-bottom: 1.5rem;
}

.tabs-nav {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}

.tabs-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tab-btn {
    background: var(--border-color-light);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    border-radius: 9999px; /* Pill shape */
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: var(--transition);
}

.tab-btn:hover:not(.active) {
    background: var(--border-color);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }
    .actions {
        flex-direction: column;
    }
    .actions .btn {
        width: 100%;
        justify-content: center;
    }
    th, td {
        padding: 0.75rem 0.5rem;
    }
    .table-container {
        border-radius: 8px;
    }
    .tab-btn {
        padding: 0.5rem 1rem;
    }
}

/* Modal Styling */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5); 
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-surface);
    margin: 0; 
    padding: 0;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.close {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: var(--text-primary);
    text-decoration: none;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-body p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

/* Add Form */
.add-form .form-group {
    display: block;
    margin-bottom: 12px;
}
.add-form label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}
.add-form input {
    width: 100%;
    padding: 12px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
    font-size: 14px;
}
.add-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: white;
}

.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}


/* Filter Dropdown Styles */
.filter-icon {
    width: 14px;
    height: 14px;
    margin-left: 4px;
    cursor: pointer;
    vertical-align: middle;
    opacity: 0.5;
    transition: opacity 0.2s, stroke 0.2s;
}
.filter-icon:hover {
    opacity: 1;
}
.filter-icon.active {
    opacity: 1;
    stroke: var(--primary);
}
.filterable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.filter-dropdown {
    position: absolute;
    background-color: var(--bg-dropdown);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    width: 220px;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

.filter-header {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.filter-header button {
    text-align: left;
    padding: 6px 8px;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-primary);
}
.filter-header button:hover {
    background-color: var(--border-color-light);
}

.filter-search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}
.filter-search input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    outline: none;
}
.filter-search input:focus {
    border-color: var(--primary);
}

.filter-body {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}
.filter-body label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    cursor: pointer;
}
.filter-body input[type="checkbox"] {
    cursor: pointer;
}

.filter-footer {
    padding: 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.filter-footer .btn {
    flex: 1;
    padding: 6px;
    font-size: 12px;
}


/* Dashboard Styles */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 2rem; }
.chart-container { background: var(--surface); padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; }
.chart-container h3 { margin-top: 0; margin-bottom: 1rem; color: var(--text); }
.chart-container canvas { width: 100% !important; max-height: 400px; }

