/* ==========================================================================
   iDO Task & Delegation System - DAT Electronics
   Clean, Modern, Intuitive & Responsive Stylesheet
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --success: #10b981;
  --success-dark: #059669;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

/* Dark Theme Variables */
body.dark-theme {
  --bg-page: #0b1120;
  --bg-card: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --primary-soft: #1e3a8a33;
  --primary-border: #1e40af;
  --slate-100: #1e293b;
  --slate-50: #0f172a;
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Container */
.ido-app {
  max-width: 1380px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

/* Header & Top Bar */
.ido-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0284c7 100%);
  color: #ffffff;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.ido-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ido-brand-logo {
  width: 44px;
  height: 44px;
  background: #ffffff;
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.ido-brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ido-brand-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ido-brand-sub {
  font-size: 12.5px;
  opacity: 0.9;
  margin-top: 2px;
}

.ido-top-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ido-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.ido-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

/* Action Buttons */
.ido-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.3;
}

.ido-btn:active {
  transform: scale(0.98);
}

.ido-btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.ido-btn-primary:hover {
  background: var(--primary-hover);
}

.ido-btn-success {
  background: var(--success);
  color: #ffffff;
}
.ido-btn-success:hover {
  background: var(--success-dark);
}

.ido-btn-outline {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}
.ido-btn-outline:hover {
  background: var(--slate-100);
}

.ido-btn-light {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}
.ido-btn-light:hover {
  background: rgba(255, 255, 255, 0.28);
}

.ido-btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.ido-btn-danger-outline:hover {
  background: var(--danger-soft);
}

.ido-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Tabs Navigation */
.ido-tabs-nav {
  display: flex;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow-x: auto;
}

.ido-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.ido-tab-btn:hover {
  color: var(--text-main);
  background: var(--slate-100);
}

.ido-tab-btn.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.ido-tab-badge {
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

.ido-tab-btn.active .ido-tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Tab Panels */
.ido-tab-pane {
  display: none;
}
.ido-tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* Cards & Layout */
.ido-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.ido-card-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.ido-card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* KPI Summary Cards Grid */
.ido-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width: 1024px) {
  .ido-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .ido-kpi-grid { grid-template-columns: minmax(0, 1fr); }
}

.ido-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.ido-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--kpi-color, var(--primary));
}

.ido-kpi-lbl {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ido-kpi-val {
  font-size: 26px;
  font-weight: 800;
  margin-top: 4px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.ido-kpi-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.ido-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--slate-200);
  border-radius: var(--radius-full);
  margin-top: 10px;
  overflow: hidden;
}
body.dark-theme .ido-progress-bar-wrap {
  background: var(--slate-700);
}

.ido-progress-bar-fill {
  height: 100%;
  background: var(--kpi-color, var(--primary));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Quick Add Bar */
.ido-quick-add-wrap {
  background: var(--bg-card);
  border: 1.5px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}

.ido-quick-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.ido-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ido-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.ido-input, .ido-select, .ido-textarea {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 38px;
}

.ido-input:focus, .ido-select:focus, .ido-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Filter & Search Bar */
.ido-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.ido-filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ido-pill {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ido-pill:hover {
  background: var(--slate-100);
  color: var(--text-main);
}

.ido-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* 2 Columns Layout for Todo List */
.ido-todo-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .ido-todo-cols { grid-template-columns: minmax(0, 1fr); }
}

/* Task Item Card */
.ido-task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.ido-task-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--slate-300);
}

.ido-task-item.is-urgent {
  border-left: 4px solid var(--danger);
}

.ido-task-item.is-overdue {
  border-left: 4px solid var(--danger);
  background: #fff8f8;
}
body.dark-theme .ido-task-item.is-overdue {
  background: #2a1518;
}

.ido-task-item.is-done {
  opacity: 0.65;
  background: var(--slate-50);
}

.ido-task-checkbox {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--success);
  flex-shrink: 0;
}

.ido-task-body {
  flex: 1;
  min-width: 0;
}

.ido-task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  word-break: break-word;
}

.ido-task-item.is-done .ido-task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.ido-task-note {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: pre-line;
}

.ido-task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
}

.ido-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.ido-badge-urgent { background: var(--danger-soft); color: var(--danger); }
.ido-badge-normal { background: var(--primary-soft); color: var(--primary); }
.ido-badge-low { background: var(--slate-100); color: var(--slate-600); }
.ido-badge-overdue { background: #fee2e2; color: #991b1b; font-weight: 700; }
.ido-badge-category { background: var(--slate-100); color: var(--slate-700); }
.ido-badge-assignee { background: #fef3c7; color: #92400e; }

.ido-task-actions {
  display: flex;
  gap: 4px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.ido-task-item:hover .ido-task-actions {
  opacity: 1;
}

.ido-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ido-icon-btn:hover {
  background: var(--slate-100);
  color: var(--text-main);
}
.ido-icon-btn.text-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* Delegation Matrix & Table */
.ido-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.ido-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.ido-table th {
  background: var(--slate-100);
  padding: 10px 14px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.ido-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

.ido-table tr:hover td {
  background: var(--slate-50);
}

/* Modals */
.ido-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ido-modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.15s ease;
}

.ido-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.ido-modal-title {
  font-size: 16px;
  font-weight: 700;
}

.ido-modal-body {
  padding: 20px;
  overflow-y: auto;
}

.ido-modal-ftr {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--slate-50);
}

/* Lockscreen / Login Gate */
.ido-lockscreen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top right, #1e3a8a, #0f172a);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ido-lockbox {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  color: #ffffff;
  text-align: center;
}

.ido-lock-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4);
}

.ido-pin-input {
  font-size: 24px;
  letter-spacing: 8px;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #ffffff;
  width: 100%;
  margin: 18px 0;
}

.ido-pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.ido-key-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.ido-key-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.ido-key-btn:active {
  transform: scale(0.95);
}

/* Empty States */
.ido-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.ido-empty-icon {
  font-size: 40px;
  margin-bottom: 8px;
  opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .ido-app { padding: 10px 12px 30px; }
  .ido-header { padding: 14px 16px; }
  .ido-brand-title { font-size: 17px; }
  .ido-tab-btn { padding: 8px 12px; font-size: 13px; }
  .ido-card { padding: 14px 14px; }
}
