/* ==========================================
   THEME VARIABLES (Glassmorphism & Cyan/Blue)
========================================== */
:root {
  /* Light Mode (Sky Blue / Cyan Gradient base) */
  --bg-app: #f0f9ff;
  --bg-surface: rgba(255, 255, 255, 0.7);
  --bg-sidebar: rgba(255, 255, 255, 0.85);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;
  
  --border-color: rgba(255, 255, 255, 0.5);
  --border-hover: rgba(255, 255, 255, 0.8);
  --border-focus: #0891b2; /* Cyan-600 */
  
  --primary: #0891b2; /* Cyan-600 */
  --primary-hover: #0e7490; /* Cyan-700 */
  --secondary: #0ea5e9; /* Light Blue */
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-panel: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --btn-primary-bg: #0891b2;
  --btn-primary-text: #ffffff;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --glass-blur: blur(16px);

  /* Status Colors */
  --status-bg-1: #fef3c7; --status-text-1: #d97706; /* Yellow */
  --status-bg-2: #e0f2fe; --status-text-2: #0284c7; /* Blue */
  --status-bg-3: #d1fae5; --status-text-3: #059669; /* Green */
  --status-bg-4: #fee2e2; --status-text-4: #dc2626; /* Red */
  --status-bg-5: #ede9fe; --status-text-5: #7c3aed; /* Purple */

  --overlay-bg: rgba(15, 23, 42, 0.4);
  --hover-bg: rgba(255, 255, 255, 0.5);
  --active-bg: rgba(8, 145, 178, 0.1);
  --active-text: #0891b2;
  --bg-header: #f1f5f9; /* Slate-100 for distinct header */
}

[data-theme="dark"] {
  /* Dark Mode (Deep Cyan/Blue Gradient) */
  --bg-app: #083344; /* Cyan-900 */
  --bg-surface: rgba(15, 23, 42, 0.6); /* Slate-900 with transparency */
  --bg-sidebar: rgba(15, 23, 42, 0.8);
  
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-light: #64748b;
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);
  --border-focus: #22d3ee; /* Cyan-400 */
  
  --primary: #06b6d4; /* Cyan-500 */
  --primary-hover: #0891b2; /* Cyan-600 */
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-panel: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  
  --btn-primary-bg: #06b6d4;
  --btn-primary-text: #0f172a;
  
  /* Status Colors Dark */
  --status-bg-1: rgba(217, 119, 6, 0.2); --status-text-1: #fcd34d;
  --status-bg-2: rgba(2, 132, 199, 0.2); --status-text-2: #7dd3fc;
  --status-bg-3: rgba(5, 150, 105, 0.2); --status-text-3: #6ee7b7;
  --status-bg-4: rgba(220, 38, 38, 0.2); --status-text-4: #fca5a5;
  --status-bg-5: rgba(124, 58, 237, 0.2); --status-text-5: #c4b5fd;

  --overlay-bg: rgba(0, 0, 0, 0.6);
  --hover-bg: rgba(255, 255, 255, 0.05);
  --active-bg: rgba(6, 182, 212, 0.15);
  --active-text: #22d3ee;
  --bg-header: #1e293b; /* Slate-800 for dark mode header */
}

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

body {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background: linear-gradient(135deg, #083344 0%, #172554 100%);
  background-attachment: fixed;
}

/* Typography Utilities */
h1, h2, h3, h4 { color: var(--text-main); font-weight: 600; }
.text-orange { color: var(--status-text-1); }
.text-blue { color: var(--status-text-2); }
.text-green { color: var(--status-text-3); }
.text-purple { color: var(--status-text-5); }

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
}

/* ==========================================
   SETTINGS VIEW
========================================== */
.settings-container {
  display: flex;
  flex-direction: row;
  gap: 0;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  min-height: 600px;
  margin-top: 16px;
}

.settings-sidebar {
  width: 250px;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  padding: 24px 0;
}

.settings-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.settings-tab {
  padding: 14px 24px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
  border-right: 4px solid transparent;
}

.settings-tab:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

.settings-tab.active {
  background: var(--active-bg);
  color: var(--active-text);
  border-right-color: var(--primary);
  font-weight: 600;
}

.settings-content {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

/* ==========================================
   SIDEBAR (Global Nav)
========================================== */
.sidebar {
  width: 72px; /* Slim sidebar like Asana/Monday */
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  z-index: 20;
  flex-shrink: 0;
}

.logo {
  margin-bottom: 32px;
  display: flex;
  justify-content: center;
  width: 100%;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  align-items: center;
}

.nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

.nav-btn.active {
  background: var(--active-bg);
  color: var(--active-text);
}

.theme-toggle {
  margin-top: auto;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

/* ==========================================
   MAIN WORKSPACE
========================================== */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* background transparent so body gradient shows */
  background: transparent;
}

.view {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  padding: 0 32px 32px;
}

.view.active {
  display: flex;
  animation: fadeSlideUp 0.3s ease-out;
}

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

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 16px;
  margin-bottom: 24px;
}

.header-title h1 {
  font-size: 28px;
  letter-spacing: -0.5px;
  font-weight: 700;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* ==========================================
   DASHBOARD STATS
========================================== */
.stats-row {
  display: flex;
  align-items: stretch;
  gap: 24px;
  margin-bottom: 32px;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

/* ==========================================
   ACTION BAR
========================================== */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 16px;
  z-index: 10;
}

.action-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  position: relative;
  flex: 2; /* Make search box twice as wide as filters */
}

.search-box input {
  width: 100%;
  height: 40px; /* Fixed height for exact match */
  padding: 8px 12px 8px 36px; /* Icon on the left */
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 1px var(--primary);
}

.search-icon {
  position: absolute;
  left: 12px;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.filter-dropdown {
  padding: 8px 32px 8px 12px; /* Extra padding right for the arrow */
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236b6b76%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px top 50%;
  background-size: 10px auto;
}

.filter-dropdown:focus {
  border-color: var(--primary);
}

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

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

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--hover-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

/* ==========================================
   TABLE
========================================== */
.table-container {
  padding: 0; /* Remove padding to fix sticky gaps */
  margin: 0 16px 32px;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  flex: 1;
  overflow: auto; /* Changed from overflow-x to auto to support sticky y */
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  min-width: 1400px;
}

thead th {
  padding: 16px 20px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background-color: var(--bg-header) !important;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

thead tr {
  background-color: var(--bg-header) !important;
}

thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

thead th.sortable:hover {
  color: var(--text-main);
}

.sort-icon {
  display: inline-block;
  margin-right: 4px; /* RTL margin right */
  font-size: 10px;
  opacity: 0.5;
}

thead th.sortable.active {
  /* No special color/background for active header */
}

tbody tr {
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  transition: background 0.1s;
}

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

td {
  padding: 14px 20px;
  font-size: 13px;
  vertical-align: middle;
}

.inline-edit-select {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  min-width: 120px;
}

.inline-edit-select:hover {
  background: var(--hover-bg);
  border-color: var(--border-color);
}

.inline-edit-select:focus {
  outline: none;
  background: var(--bg-header);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.1);
}

[data-theme="dark"] .inline-edit-select option {
  background-color: #1e293b;
  color: #f8fafc;
}

.task-id {
  color: var(--text-light);
  font-family: monospace;
}

.task-name {
  font-weight: 500;
}

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: 12px; /* Pills */
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.badge-color-1 { background: var(--status-bg-1); color: var(--status-text-1); }
.badge-color-2 { background: var(--status-bg-2); color: var(--status-text-2); }
.badge-color-3 { background: var(--status-bg-3); color: var(--status-text-3); }
.badge-color-4 { background: var(--status-bg-4); color: var(--status-text-4); }
.badge-color-5 { background: var(--status-bg-5); color: var(--status-text-5); }

.text-left { text-align: left; }

.action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.1s;
}

.action-btn:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.action-btn.delete:hover {
  color: #de350b; /* Jira Red */
}

/* Empty State */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  text-align: center;
}

.empty-state.active {
  display: flex;
}

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

.empty-state h3 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
}

/* ==========================================
   SETTINGS DROPDOWN VIEW
========================================== */
#view-settings {
  background: var(--bg-app);
}

.settings-content-header {
  margin-bottom: 24px;
}

.settings-content-header h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.settings-content-header p {
  color: var(--text-muted);
}

.row {
  display: flex;
  gap: 16px;
}

.grid-3 {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-3 .form-group {
  margin-bottom: 0;
}

.settings-add-box {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.settings-add-box input {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
}

.settings-add-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.settings-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: all 0.2s;
  cursor: default;
}

.setting-item:hover {
  border-color: var(--primary);
  background: var(--hover-bg);
}

.setting-edit-input {
  background: var(--bg-app);
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  width: 100%;
}

.setting-item-delete {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.setting-item-delete:hover {
  background: rgba(222, 53, 11, 0.1);
  color: #de350b;
}

/* Drag and Drop Styles */
.setting-item {
  cursor: grab;
  position: relative;
  transition: transform 0.2s, background-color 0.2s, opacity 0.2s;
}

.setting-item.dragging {
  opacity: 0.5;
  background: var(--active-bg);
  cursor: grabbing;
}

.setting-item::before {
  content: "⋮⋮";
  margin-left: 12px;
  color: var(--text-light);
  font-size: 14px;
  cursor: grab;
}

.setting-item:hover::before {
  color: var(--primary);
}

.setting-item.drag-over {
  border-top: 2px solid var(--primary);
}

/* ==========================================
   SIDE PANEL (Slide Out)
========================================== */
.side-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--overlay-bg);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.side-panel-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.side-panel {
  position: fixed;
  top: 0;
  left: -500px; /* Hidden off-screen to the left (RTL) */
  width: 100%;
  max-width: 500px;
  height: 100vh;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border-color);
  box-shadow: var(--shadow-panel);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.side-panel.active {
  transform: translateX(500px); /* Slide in */
}

.side-panel-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.side-panel-header h2 {
  font-size: 18px;
}

/* Close buttons */
.close-panel-btn, .close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
}

.close-panel-btn:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

.side-panel-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

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

.action-bar-left {
  display: flex;
  gap: 16px;
  flex: 1;
  max-width: 900px;
}

.form-group {
  flex: 1;
}

.form-group.full-width {
  width: 100%;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.required {
  color: #de350b;
}

.filter-dropdown {
  flex: 1; /* Make filter dropdowns take equal width */
  height: 40px; /* Fixed height for exact match */
  padding: 8px 16px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

input[type="text"], input[type="date"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
}

.input-large {
  font-size: 16px !important;
  font-weight: 500;
  padding: 12px 14px !important;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 1px var(--primary);
}

textarea {
  resize: vertical;
}

.extended-fields {
  background: var(--hover-bg);
  padding: 16px;
  border-radius: 8px;
  margin-top: 24px;
  border: 1px dashed var(--border-color);
}

.divider {
  text-align: center;
  position: relative;
  margin: 16px 0;
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-color);
  z-index: 1;
}

.divider span {
  position: relative;
  background: var(--hover-bg);
  padding: 0 12px;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 500;
  z-index: 2;
}

.side-panel-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-app);
}

/* ==========================================
   RESPONSIVE
========================================== */
@media (max-width: 768px) {
  .app-container { flex-direction: column; }
  .sidebar { width: 100%; height: 60px; flex-direction: row; padding: 0 16px; justify-content: space-between; border-left: none; border-bottom: 1px solid var(--border-color); }
  .logo { margin-bottom: 0; }
  .nav-links { flex-direction: row; width: auto; gap: 8px; }
  .theme-toggle { margin-top: 0; }
  
  .stats-row { flex-wrap: wrap; padding: 0 24px 24px; gap: 16px; }
  .stat-divider { display: none; }
  
  .action-bar { flex-direction: column; align-items: stretch; gap: 16px; padding: 16px 24px; }
  .action-bar-left { flex-direction: column; align-items: stretch; }
  .search-box { width: 100%; }
  
  .settings-container { flex-direction: column; }
  .settings-nav { width: 100%; border-left: none; border-bottom: 1px solid var(--border-color); flex-direction: row; overflow-x: auto; padding: 12px 16px; }
  .settings-tab { white-space: nowrap; }
  .settings-content { padding: 24px; }
  
  .side-panel { left: -100%; max-width: 100%; }
  .side-panel.active { transform: translateX(100%); }
}

/* ==========================================
   MODAL POPUP
========================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 20px;
  color: var(--text-main);
  margin: 0;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-app);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* ==========================================
   FILE UPLOAD UI
========================================== */
.file-upload-section {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.file-input {
  margin-bottom: 12px;
  width: 100%;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
}

.file-item .file-name {
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-item .remove-file-btn {
  background: none;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  font-weight: bold;
}

/* ==========================================
   CONFIRMATION MODAL
========================================== */
.confirm-card {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.confirm-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.confirm-icon {
  font-size: 32px;
  width: 64px;
  height: 64px;
  background: rgba(222, 53, 11, 0.1);
  color: #de350b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.confirm-card p {
  color: var(--text-muted);
  line-height: 1.6;
}

.confirm-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.btn-danger {
  background: #de350b;
  color: #fff;
}

.btn-danger:hover {
  background: #bf2d08;
}

/* ==========================================
   USERS SETTINGS
========================================== */
.settings-add-box-users {
  background: var(--hover-bg);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.settings-add-box-users .form-section {
  margin-bottom: 16px;
}

.settings-add-box-users .form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.settings-add-box-users input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 14px;
}

#usersTable th, #usersTable td {
  padding: 12px;
  text-align: right;
}

#usersTable thead th {
  background: var(--hover-bg);
}

.user-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.user-action-btn:hover {
  background: var(--border-color);
  color: #de350b;
}

/* TODO List Styles */
.todo-section { margin-top: 16px; }
.todo-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.todo-input-container { display: flex; gap: 8px; margin-bottom: 12px; }
.todo-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.todo-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: var(--radius-md); transition: all 0.2s; }
.todo-item:hover { background: var(--hover-bg); }
.todo-item.completed span { text-decoration: line-through; color: var(--text-muted); }
.todo-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }
.todo-item span { flex: 1; font-size: 14px; word-break: break-word; }
.todo-delete { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; transition: color 0.2s; }
.todo-delete:hover { color: #de350b; background: rgba(222, 53, 11, 0.1); }

/* Toggle Switch Styles */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}
.toggle-label {
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
  user-select: none;
}
.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
}
[data-theme="dark"] .slider {
  background-color: #475569;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  right: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(-14px);
}
.slider.round {
  border-radius: 20px;
}
.slider.round:before {
  border-radius: 50%;
}

/* Login Overlay */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-main);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s;
}
.login-overlay.active {
  visibility: visible;
  opacity: 1;
}
.login-box {
  background: var(--bg-surface);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 30px var(--shadow-color);
  text-align: center;
  max-width: 400px;
  width: 90%;
  border: 1px solid var(--border-color);
}
.login-box h2 {
  margin-bottom: 10px;
  font-size: 24px;
}
.login-box p {
  color: var(--text-muted);
  margin-bottom: 25px;
}
