@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─────────────────────────── TOKENS ─────────────────────────── */
:root {
  --accent: #5b6af0;
  --accent-2: #7c3aed;
  --accent-glow: #5b6af022;
  --lime: #a3e635;
  --green: #22c55e;
  --green-dark: #166534;
  --orange: #f97316;
  --red: #ef4444;
  --yellow: #eab308;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-3: #eef0f4;
  --border: #e2e4e9;
  --border-2: #c8ccd6;

  --ink: #111827;
  --ink-2: #374151;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;

  --sidebar-bg: #0f172a;
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active: #1e3a5f;
  --sidebar-accent: #60a5fa;

  --shadow-sm: 0 1px 3px #0001, 0 1px 2px #0001;
  --shadow: 0 4px 16px #0000000d;
  --shadow-lg: 0 8px 30px #00000014;
  --shadow-xl: 0 20px 60px #00000020;

  --radius: 0px;
  --radius-sm: 0px;
  --radius-lg: 0px;
  --radius-xl: 0px;

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;

  --sidebar-w: 240px;
  --header-h: 80px;
  --transition: 0.18s ease;
}

/* ─────────────────────── DARK MODE ─────────────────────── */
[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2230;
  --surface-3: #21262d;
  --border: #30363d;
  --border-2: #484f58;

  --ink: #e6edf3;
  --ink-2: #c9d1d9;
  --ink-3: #8b949e;
  --ink-4: #6e7681;

  --sidebar-bg: #090d13;
  --sidebar-hover: #161b22;
  --sidebar-active: #1a2744;

  --shadow: 0 4px 16px #00000040;
  --shadow-lg: 0 8px 30px #00000060;
  --shadow-xl: 0 20px 60px #00000080;
}

/* ─────────────────────────── RESET ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* ────────────────────────── APP HEADER (TOP BAR) ────────────────────────── */
.app-header {
  width: 100%;
  height: 62px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(2vw, 20px);
  gap: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(91, 106, 240, 0.35);
}

.brand-text strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  line-height: 1.2;
}
.brand-text small {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* Main Navigation Bar (Horizontal on Desktop) */
nav#nav.nav-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 6px;
  border-radius: 8px;
}

nav#nav button {
  border: none;
  background: transparent;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 6px;
  font: 600 13px var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

nav#nav button svg {
  flex-shrink: 0;
}

nav#nav button:hover {
  color: var(--ink);
  background: var(--surface-3);
}

nav#nav button.active {
  color: var(--accent);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  font-weight: 700;
}

/* Header Tools (Right) */
.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.telegram-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(36, 161, 222, 0.12);
  color: #24a1de;
  border: 1px solid rgba(36, 161, 222, 0.28);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.telegram-toggle:hover {
  background: rgba(36, 161, 222, 0.22);
  border-color: #24a1de;
}

.theme-toggle,
.lock-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.theme-toggle:hover,
.lock-toggle:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-2);
}
.lock-toggle svg {
  color: var(--accent);
}

/* ──────────────────────────── MAIN ──────────────────────────── */
main {
  margin-left: 0;
  flex: 1;
  min-height: calc(100vh - 62px);
  min-width: 0;
  width: 100%;
  max-width: 100vw;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.page-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px max(2.5vw, 24px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  padding: 7px;
  cursor: pointer;
  border-radius: 0;
}
.mobile-menu-btn:hover {
  background: var(--surface-3);
}

#eyebrow {
  font: 500 10px var(--mono);
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 5px;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─────────────────────── VIEW TOGGLE ─────────────────────── */
.view-toggle {
  display: flex;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.view-btn {
  border: none;
  background: transparent;
  color: var(--ink-3);
  padding: 6px 9px;
  border-radius: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition);
}
.view-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.view-btn:hover:not(.active) { background: var(--border); color: var(--ink-2); }

/* ─────────────────────── SEARCH BOX ─────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--ink-3);
  transition: border var(--transition), box-shadow var(--transition);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#searchInput {
  border: none;
  background: transparent;
  font: 13px var(--font);
  color: var(--ink);
  outline: none;
  width: 180px;
}
#searchInput::placeholder { color: var(--ink-4); }

/* ─────────────────────── PRIMARY BTN ─────────────────────── */
.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font: 600 13px var(--font);
  cursor: pointer;
  box-shadow: 0 2px 8px #5b6af030;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.primary:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 4px 16px #5b6af040; }
.primary:active { transform: translateY(0); }

/* ──────────────────────── APP SECTION ──────────────────────── */
#app {
  padding: 24px max(2.5vw, 24px);
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ─────────────────────── STAT CARDS ─────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent)08, transparent);
  pointer-events: none;
}

.stat-card .stat-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--ink);
  margin: 8px 0 4px;
  line-height: 1;
}
.stat-card .stat-value small { font-size: 16px; font-weight: 600; color: var(--ink-3); }

.stat-card .stat-sub {
  font-size: 11.5px;
  color: var(--ink-3);
}
.stat-card .stat-sub.up { color: var(--green); }
.stat-card .stat-sub.warn { color: var(--orange); }

.stat-card .progress {
  height: 5px;
  background: var(--surface-3);
  border-radius: 0;
  overflow: hidden;
  margin-top: 12px;
}
.stat-card .progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 0;
  transition: width 0.6s ease;
}

.stat-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 0;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--accent);
}

/* ─────────────────────── GRID PANELS ─────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: visible;
  position: relative;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.panel-body {
  padding: 0;
  overflow: visible;
  position: relative;
}

/* ─────────────────────── TASK ROW ─────────────────────── */
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--surface-2); }

.check-circle {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-2);
  border-radius: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}
.check-circle.done {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.grow { flex: 1; min-width: 0; }
.task-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ─────────────────────── BADGES ─────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 0;
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.badge.high, .badge.blocked { background: #fef2f2; color: #dc2626; }
.badge.medium { background: #fff7ed; color: #ea580c; }
.badge.low { background: #f0fdf4; color: #16a34a; }
.badge.to-do { background: var(--surface-3); color: var(--ink-3); }
.badge.in-progress { background: #eff6ff; color: #2563eb; }
.badge.done { background: #f0fdf4; color: #16a34a; }
[data-theme="dark"] .badge.high, [data-theme="dark"] .badge.blocked { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge.medium { background: #431407; color: #fb923c; }
[data-theme="dark"] .badge.low { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge.to-do { background: var(--surface-3); color: var(--ink-3); }
[data-theme="dark"] .badge.in-progress { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge.done { background: #052e16; color: #86efac; }

/* ─────────────── MINI STATS (WEEKLY PULSE) ─────────────── */
.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}
.mini {
  background: var(--surface);
  padding: 16px 20px;
}
.mini .label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}
.mini b { font-size: 22px; font-weight: 800; color: var(--ink); display: block; margin-top: 6px; }

/* ─────────────────────── DAY ROW ─────────────────────── */
.day-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.day-row:last-child { border-bottom: none; }
.day-row:hover { background: var(--surface-2); }
.day-row .score-pill {
  font-size: 12px;
  font-weight: 700;
  min-width: 44px;
  text-align: right;
  color: var(--accent);
}

/* ─────────────── TASK HEALTH ROWS ─────────────── */
.health-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-2);
  transition: background var(--transition);
}
.health-row:last-child { border-bottom: none; }
.health-row:hover { background: var(--surface-2); }
.health-row strong { font-weight: 700; color: var(--ink); }

/* ─────────────────── EMPTY STATE ─────────────────── */
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-4);
  font-size: 13px;
  line-height: 1.6;
}
.empty svg { display: block; margin: 0 auto 12px; opacity: 0.35; }

/* ═══════════════════════════════════════════════════════════ */
/*                    EXCEL SPREADSHEET VIEW                   */
/* ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════ */
/*                    EXCEL SPREADSHEET VIEW                   */
/* ═══════════════════════════════════════════════════════════ */

.excel-wrap {
  position: relative;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  background: var(--surface);
  max-height: calc(100vh - 185px);
}

.excel-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: -0.01em;
}

/* Sticky header */
.excel-table thead {
  position: sticky;
  top: 0;
  z-index: 20;
}

.excel-table th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-2);
  border-right: 1px solid var(--border);
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  user-select: none;
  white-space: nowrap;
}

.th-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.th-inner:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.th-center .th-inner {
  justify-content: center;
}

.sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0.45;
  transition: opacity var(--transition), color var(--transition);
  flex-shrink: 0;
  user-select: none;
}
th.sorted .sort-icon {
  opacity: 1;
  color: var(--accent);
  font-weight: 800;
}

/* Row number column */
.excel-table .col-row-num {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  color: var(--ink-4);
  font: 500 11.5px var(--mono);
  text-align: center;
  background: var(--surface-2);
  border-right: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  left: 0;
  z-index: 10;
  user-select: none;
}

.excel-table tbody tr {
  transition: background var(--transition);
}
.excel-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.04);
}
.excel-table tbody tr:hover .col-row-num {
  background: var(--surface-3);
  color: var(--ink-2);
}
.excel-table tbody tr.selected {
  background: rgba(99, 102, 241, 0.08);
}

.excel-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0;
  vertical-align: middle;
}

.excel-table td:last-child {
  border-right: none;
}
.excel-table th:last-child {
  border-right: none;
}

.cell-inner {
  padding: 12px 16px;
  min-height: 48px;
  display: flex;
  align-items: center;
  word-break: break-word;
  line-height: 1.45;
  cursor: pointer;
  position: relative;
  font-size: 13px;
  color: var(--ink);
}

.cell-inner-center {
  justify-content: center;
}

.cell-text {
  word-break: break-word;
  line-height: 1.45;
}
.cell-date {
  font-family: var(--font);
  white-space: nowrap;
  color: var(--ink-2);
  font-weight: 500;
}
.cell-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* Custom modern checkbox for Excel view matching screenshot */
.excel-check-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.excel-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 2px solid #3b4461;
  background: #111524;
  cursor: pointer;
  position: relative;
  outline: none;
  transition: all 0.15s ease;
  display: inline-grid;
  place-content: center;
  margin: 0;
  flex-shrink: 0;
}
.excel-checkbox:hover {
  border-color: #60a5fa;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.25);
}
.excel-checkbox:checked {
  background: #3b82f6;
  border-color: #3b82f6;
}
.excel-checkbox:checked::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Actions column */
.col-actions {
  width: 80px;
  position: sticky;
  right: 0;
  background: var(--surface);
  border-left: 1px solid var(--border-2) !important;
  z-index: 8;
}
.excel-table thead .col-actions {
  background: var(--surface-2);
}
.excel-table tr:hover .col-actions {
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  opacity: 0;
  transition: opacity var(--transition);
}
.excel-table tr:hover .row-actions {
  opacity: 1;
}

.row-btn {
  border: none;
  background: transparent;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition);
}
.row-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.row-btn.delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
}

/* Add row button at bottom of table */
.add-row-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: var(--surface);
  text-align: left;
  width: 100%;
  border-top: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
}
.add-row-btn:hover {
  background: var(--surface-2);
  color: var(--accent);
}

/* ─────────────────── CARD TABLE (old style, improved) ─────────────────── */
.card-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card-table {
  width: 100%;
  border-collapse: collapse;
}
.card-table th {
  background: var(--surface-2);
  text-align: left;
  padding: 11px 16px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.card-table td {
  padding: 11px 16px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--ink-2);
  max-width: 250px;
  word-break: break-word;
}
.card-table tr:last-child td { border-bottom: none; }
.card-table tbody tr:hover { background: var(--surface-2); }
.card-table td strong { font-weight: 600; color: var(--ink); }

.actions-cell {
  width: 100px;
  white-space: nowrap;
}
.act-btn {
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
}
.act-btn:hover { background: var(--surface-3); color: var(--accent); }
.act-btn.del:hover { background: #fef2f2; color: var(--red); }
[data-theme="dark"] .act-btn.del:hover { background: #450a0a; color: #fca5a5; }

/* ─────────────────── MODAL / DIALOG ─────────────────── */
dialog {
  border: 1px solid var(--border-2);
  border-radius: 0;
  box-shadow: 0 24px 50px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border);
  padding: 0;
  width: min(680px, 94vw);
  max-height: min(88vh, 760px);
  background: var(--surface);
  color: var(--ink);
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 9999;
  overflow: hidden;
}
dialog[open] {
  display: flex;
  flex-direction: column;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

#entryForm {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: min(88vh, 760px);
  overflow: hidden;
}

.modal-head {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  z-index: 10;
}
.modal-head-titles {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.modal-head h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin: 0;
  color: var(--ink);
}
.modal-head-subtitle {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}

.icon-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  padding: 6px;
  border-radius: 0;
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border);
}

/* Modal Tabs Navigation */
.modal-tabs {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  gap: 4px;
  flex-shrink: 0;
}
.modal-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--ink-3);
  font: 600 12.5px var(--font);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.modal-tab-btn:hover {
  color: var(--ink);
  background: var(--surface-3);
}
.modal-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
  background: transparent;
}
.modal-tab-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--border);
}
.modal-tab-btn.active .modal-tab-badge {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: transparent;
}

/* Modal Body */
.fields {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 22px;
  background: var(--surface);
}
.fields::-webkit-scrollbar {
  width: 6px;
}
.fields::-webkit-scrollbar-track {
  background: transparent;
}
.fields::-webkit-scrollbar-thumb {
  background: var(--border-2);
}
.fields::-webkit-scrollbar-thumb:hover {
  background: var(--ink-4);
}

.modal-tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}
.modal-tab-panel.active {
  display: flex;
}

/* Standard Date Bar */
.modal-date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px 14px;
  flex-wrap: wrap;
}
.modal-date-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 220px;
}
.modal-date-icon {
  color: var(--accent);
  display: grid;
  place-items: center;
}
.modal-date-control {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.modal-date-control label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.modal-date-control input[type="date"] {
  font: 600 13px var(--font);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 5px 10px;
  color: var(--ink);
  outline: none;
}
.modal-date-control input[type="date"]:focus {
  border-color: var(--accent);
}
.modal-date-shortcuts {
  display: flex;
  align-items: center;
  gap: 6px;
}
.date-chip {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 5px 10px;
  cursor: pointer;
  transition: all var(--transition);
}
.date-chip:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Section dividers */
.std-section-divider {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}
.std-section-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.std-section-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
}

/* Linear-style Standard Task Items */
.std-task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.std-task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 10px 12px;
  transition: border-color var(--transition), background var(--transition);
}
.std-task-item:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}
.std-task-item.done {
  background: var(--surface);
  opacity: 0.75;
}

.std-check-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  margin-top: 5px;
  flex-shrink: 0;
}
.std-check-box input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  width: 0;
  height: 0;
}
.std-check-mark {
  width: 18px;
  height: 18px;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: 0;
  display: grid;
  place-items: center;
  color: transparent;
  transition: all var(--transition);
}
.std-check-box:hover .std-check-mark {
  border-color: var(--accent);
}
.std-check-box input:checked ~ .std-check-mark {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.std-task-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.std-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.std-task-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.std-task-tag.must-do {
  color: var(--accent);
  font-weight: 800;
}
.std-task-tag.sub {
  color: var(--ink-4);
}
.std-task-state {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-4);
}
.std-task-item.done .std-task-state {
  color: var(--green);
  font-weight: 700;
}
.std-task-text {
  font: 13px var(--font);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 7px 10px;
  outline: none;
  width: 100%;
  transition: border-color var(--transition);
}
.std-task-text:focus {
  border-color: var(--accent);
}
.std-task-item.done .std-task-text {
  text-decoration: line-through;
  color: var(--ink-3);
}

/* Evening audit tab styling */
.audit-intro-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.audit-intro-icon {
  font-size: 20px;
}
.audit-intro-text strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}
.audit-intro-text p {
  font-size: 12px;
  color: var(--ink-3);
  margin: 2px 0 0;
}

.deep-work-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.deep-work-input-wrap input {
  width: 120px;
}
.deep-work-presets {
  display: flex;
  align-items: center;
  gap: 6px;
}
.preset-btn {
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  border-radius: 0;
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.preset-btn:hover {
  background: var(--surface-3);
  color: var(--accent);
  border-color: var(--accent);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.field-hint {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-4);
}

/* Generic Form Grid (for other modal forms) */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field.wide {
  grid-column: 1 / -1;
}
.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field input,
.field select,
.field textarea {
  font: 13px var(--font);
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 0;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.field textarea {
  min-height: 72px;
  resize: vertical;
}

/* Check field */
.check-field {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
}
.check-field input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  border-radius: 0;
  cursor: pointer;
}
.check-field label {
  font-size: 13px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--ink) !important;
  font-weight: 500 !important;
  cursor: pointer;
}

/* Modal Actions (Footer) */
.modal-actions {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  z-index: 10;
}
.modal-footer-hint {
  font-size: 11.5px;
  color: var(--ink-4);
}
.modal-footer-hint strong {
  color: var(--ink-3);
}
.modal-action-btns {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-actions button:not(.primary) {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 8px 16px;
  font: 600 13px var(--font);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.modal-actions button:not(.primary):hover {
  background: var(--surface-3);
  border-color: var(--ink-4);
  color: var(--ink);
}
.modal-actions button.primary {
  border-radius: 0;
  padding: 8px 18px;
  font: 600 13px var(--font);
}

/* ─────────────────── CONFIRM DIALOG ─────────────────── */
#confirmDialog {
  width: min(380px, 94vw);
  padding: 32px 28px;
  text-align: center;
}

.confirm-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 0;
  background: #fef2f2;
  display: grid;
  place-items: center;
  color: var(--red);
  margin-bottom: 4px;
}
[data-theme="dark"] .confirm-icon { background: #450a0a; }

.confirm-inner h3 { font-size: 17px; font-weight: 700; }
.confirm-inner p { font-size: 13px; color: var(--ink-3); }

.confirm-actions { display: flex; gap: 10px; margin-top: 8px; width: 100%; }
.confirm-actions button { flex: 1; padding: 10px; border-radius: var(--radius-sm); font: 600 13px var(--font); cursor: pointer; border: none; transition: opacity var(--transition); }
.confirm-actions button:first-child { background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--border); }
.confirm-actions button:first-child:hover { background: var(--border); }
.danger { background: var(--red) !important; color: white !important; }
.danger:hover { opacity: 0.9; }

/* ─────────────────── TOAST ─────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.25s ease, fadeOut 0.3s ease 2.5s forwards;
  pointer-events: all;
  max-width: 320px;
}
.toast-item.success svg { color: var(--green); }
.toast-item.error svg { color: var(--red); }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  to { transform: translateX(120%); opacity: 0; }
}

/* ─────────────────── FILTER BAR ─────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 0;
  padding: 5px 12px;
  font: 600 12px var(--font);
  color: var(--ink-3);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ─────────────────────── RESPONSIVE ─────────────────────── */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .daily-board-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  body {
    padding-bottom: 64px; /* Space for frozen bottom navigation bar */
  }

  /* Compact Top Header on Mobile */
  .app-header {
    height: 54px;
    padding: 0 12px;
  }
  .brand-logo {
    width: 30px;
    height: 30px;
    font-size: 11px;
    border-radius: 5px;
  }
  .brand-text strong {
    font-size: 12.5px;
  }
  .brand-text small {
    display: none;
  }
  .header-tools {
    gap: 6px;
  }
  .telegram-toggle,
  .theme-toggle,
  .lock-toggle {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 5px;
  }
  .telegram-toggle span,
  .theme-toggle span,
  .lock-toggle span {
    display: none;
  }

  /* ──────────────── FROZEN BOTTOM NAVIGATION BAR ──────────────── */
  nav#nav.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 3px 4px calc(3px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
    z-index: 999;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  nav#nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 6px;
    color: var(--ink-3);
    background: transparent;
    border: none;
    box-shadow: none;
    text-align: center;
  }
  nav#nav button svg {
    width: 17px;
    height: 17px;
  }
  nav#nav button:hover {
    background: transparent;
    color: var(--ink);
  }
  nav#nav button.active {
    color: var(--accent);
    background: var(--accent-glow);
    font-weight: 700;
  }

  /* Page Bar & Actions on Mobile */
  .page-bar {
    padding: 12px 14px;
    gap: 10px;
  }
  h1 { font-size: 18px; }
  .header-actions { width: 100%; justify-content: space-between; }
  #searchInput { width: 130px; }

  /* ──────────────── COMPACT TASK TILES (LISTVIEW STYLE) ──────────────── */
  .kanban-wrap {
    gap: 10px;
  }
  .kanban-bar {
    padding: 8px 12px;
    gap: 8px;
  }
  .kanban-board {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-bottom: 16px;
  }
  .kanban-col {
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
  }
  .kanban-col-head {
    padding: 8px 12px;
  }
  .kanban-col-body {
    padding: 6px 8px;
    gap: 6px;
    min-height: auto;
  }

  /* Compact Listview Small Card */
  .kanban-card {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.15s ease;
  }
  .kanban-card:hover {
    transform: none;
  }
  .kanban-card:active {
    background: var(--surface-3);
  }
  .kc-top {
    margin-bottom: 1px;
    gap: 4px;
  }
  .kc-badges {
    gap: 4px;
  }
  .kc-category,
  .kc-daily-badge {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
  }
  .badge {
    font-size: 9px;
    padding: 1px 5px;
  }
  .kanban-move-select {
    font-size: 10px;
    padding: 1px 4px;
    height: 22px;
    border-radius: 4px;
  }
  .kc-title-row {
    margin-top: 2px;
    gap: 7px;
    align-items: center;
  }
  .kc-quick-check {
    width: 17px;
    height: 17px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 0;
  }
  .kc-title {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
  }
  .kc-notes {
    font-size: 11px;
    margin-top: 2px;
    padding: 3px 6px;
    background: var(--surface-3);
    border-radius: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .kc-bottom {
    margin-top: 4px;
    padding-top: 6px;
    gap: 4px;
    align-items: center;
  }
  .kc-meta-left {
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
  }
  .kc-owner {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
  }
  .kc-due {
    font-size: 10px;
    gap: 3px;
  }
  .tg-alert-badge {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
  }
  .kc-effort {
    font-size: 9.5px;
  }
  .kc-act-btn {
    padding: 3px 5px;
  }

  .stats { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
  .daily-nav-bar { padding: 12px; }
  .daily-nav-left { width: 100%; }
  .daily-nav-right { width: 100%; justify-content: space-between; }
}

/* ─────────────────── SCROLLBAR STYLING ─────────────────── */
.excel-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.excel-wrap::-webkit-scrollbar-track { background: var(--surface-2); }
.excel-wrap::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 0; }
.excel-wrap::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ─────────────────── LOADING SHIMMER ─────────────────── */
.shimmer {
  animation: shimmer 1.4s infinite;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--border) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  border-radius: 0;
  height: 14px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════ */
/*                 DAILY PLANNER FOCUS BOARD                   */
/* ═══════════════════════════════════════════════════════════ */

.daily-focus-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.daily-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
}

.daily-nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.daily-nav-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  padding: 6px 12px;
  font: 600 12px var(--font);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.daily-nav-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-2);
}
.daily-nav-btn.today-btn {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent);
}

.daily-date-input {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  padding: 6px 10px;
  font: 600 12.5px var(--font);
  outline: none;
}
.daily-date-input:focus {
  border-color: var(--accent);
}

.daily-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.daily-pill {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-3);
  padding: 5px 10px;
  font: 600 11.5px var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.daily-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.daily-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.daily-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.daily-day-score {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.daily-progress-bar-wrap {
  width: 120px;
  height: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.daily-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.3s ease;
}

.daily-board-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
}
@media (max-width: 960px) {
  .daily-board-grid { grid-template-columns: 1fr; }
}

.daily-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.daily-card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
}
.daily-card-head h3 {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.daily-card-head p {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 2px;
}

.daily-tasks-list {
  display: flex;
  flex-direction: column;
}
.daily-task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.daily-task-item:last-child {
  border-bottom: none;
}
.daily-task-item:hover {
  background: var(--surface-2);
}

.daily-check-square {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-2);
  display: grid;
  place-items: center;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  background: var(--surface);
  color: transparent;
  transition: all var(--transition);
  user-select: none;
}
.daily-check-square:hover {
  border-color: var(--accent);
}
.daily-check-square.checked {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.daily-task-content {
  flex: 1;
  min-width: 0;
}
.daily-task-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  margin-bottom: 4px;
}
.daily-task-tag.must-do {
  background: #fef3c7;
  color: #b45309;
}
[data-theme="dark"] .daily-task-tag.must-do {
  background: #78350f;
  color: #fde68a;
}
.daily-task-tag.outcome {
  background: var(--accent-glow);
  color: var(--accent);
}
.daily-task-tag.extra {
  background: var(--surface-3);
  color: var(--ink-3);
}

.daily-task-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  word-break: break-word;
}
.daily-task-text.strike {
  text-decoration: line-through;
  opacity: 0.55;
}

.daily-fast-add {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.daily-fast-add input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
  font: 500 13px var(--font);
  outline: none;
}
.daily-fast-add input:focus {
  border-color: var(--accent);
}
.daily-fast-add button {
  padding: 8px 14px;
  font: 600 12px var(--font);
  cursor: pointer;
  white-space: nowrap;
}

.daily-reflect-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.daily-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.daily-field-group label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}
.daily-field-group input,
.daily-field-group textarea {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  padding: 8px 12px;
  font: 500 13px var(--font);
  outline: none;
  transition: border-color var(--transition);
}
.daily-field-group input:focus,
.daily-field-group textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.daily-field-group textarea {
  resize: vertical;
}

.daily-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  font: 700 13px var(--font);
  cursor: pointer;
  box-shadow: 0 4px 14px #5b6af030;
  transition: opacity var(--transition), transform var(--transition);
}
.daily-close-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════ */
/*                        KANBAN BOARD                         */
/* ═══════════════════════════════════════════════════════════ */

.kanban-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.kanban-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 18px;
  box-shadow: var(--shadow-sm);
}

.kanban-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kanban-filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-right: 4px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 24px;
}

@media (max-width: 1200px) {
  .kanban-board {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}
@media (max-width: 680px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.kanban-col-head {
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-col-head.col-todo { border-bottom-color: #6b7280; }
.kanban-col-head.col-inprogress { border-bottom-color: #2563eb; }
.kanban-col-head.col-blocked { border-bottom-color: #dc2626; }
.kanban-col-head.col-done { border-bottom-color: #16a34a; }

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.kanban-col-dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
}
.kanban-count-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--border);
}

.kanban-add-card-btn {
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  transition: color var(--transition);
}
.kanban-add-card-btn:hover {
  color: var(--accent);
}

.kanban-col-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  background: var(--surface);
  transition: background 0.15s ease, outline 0.15s ease;
}
.kanban-col-body.drag-over {
  background: var(--accent-glow);
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-2);
}
.kanban-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.kc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.kc-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.kc-category {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  background: var(--surface-3);
  color: var(--ink-3);
  border: 1px solid var(--border);
}

.kc-daily-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kc-daily-badge.must-do {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 800;
}

.kc-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
}

.kc-quick-check {
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--border-2);
  background: var(--surface);
  border-radius: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: transparent;
  padding: 0;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition);
}
.kc-quick-check:hover {
  border-color: var(--accent);
}
.kc-quick-check.checked {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.kc-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  word-break: break-word;
  flex: 1;
}
.kc-title.strike {
  text-decoration: line-through;
  opacity: 0.6;
}

.kc-notes {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kc-bottom {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.kc-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kc-owner {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
}
.kc-due {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kc-due.overdue {
  color: var(--red);
  font-weight: 700;
}
.kc-effort {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-4);
}

.kc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.kc-act-btn {
  border: none;
  background: transparent;
  color: var(--ink-4);
  padding: 4px 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color var(--transition);
}
.kc-act-btn:hover {
  color: var(--ink);
}
.kc-act-btn.del:hover {
  color: var(--red);
}

.kanban-move-select {
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-3);
  padding: 2px 4px;
  cursor: pointer;
  outline: none;
}

/* ═══════════════════════════════════════════════════════════ */
/*                   AUTHENTICATION / MPIN                     */
/* ═══════════════════════════════════════════════════════════ */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  width: min(420px, 94vw);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  animation: authCardPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardPop {
  from {
    transform: scale(0.96) translateY(8px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.auth-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: white;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(91, 106, 240, 0.35);
}

.auth-brand-text strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.auth-brand-text span {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-lock-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent);
  border-radius: 0;
}

.auth-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.45;
}

.pin-inputs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.pin-box {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 0;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  -moz-appearance: textfield;
}

.pin-box::-webkit-outer-spin-button,
.pin-box::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pin-box:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.pin-box.has-value {
  border-color: var(--border-2);
  background: var(--surface);
}

.auth-error {
  min-height: 20px;
  margin-bottom: 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--red);
  text-align: center;
}

.auth-submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  border-radius: 0;
  font: 700 13.5px var(--font);
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(91, 106, 240, 0.35);
  transition: opacity var(--transition), transform var(--transition);
}

.auth-submit-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.auth-submit-btn:active {
  transform: translateY(0);
}

.auth-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.auth-footer span {
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* Super Admin Badge */
.super-admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700 !important;
  font-size: 10px !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 3px;
}
.super-admin-pill .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* Telegram Alerts Toggle in Footer */
.telegram-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(36, 161, 222, 0.12);
  color: #24a1de;
  border: 1px solid rgba(36, 161, 222, 0.28);
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.telegram-toggle:hover {
  background: rgba(36, 161, 222, 0.24);
  border-color: #24a1de;
}

/* Telegram Modal */
.tg-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 500px;
  width: 90vw;
  margin: auto;
}
.tg-modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.tg-modal-box {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 16px;
  padding: 24px;
  color: var(--ink-1, #f8fafc);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}
.tg-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.tg-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(36, 161, 222, 0.15);
  color: #24a1de;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.tg-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--ink-1, #f8fafc);
}
.tg-modal-header p {
  font-size: 12.5px;
  color: var(--ink-3, #94a3b8);
  margin: 0;
}
.tg-modal-header .modal-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--ink-4, #64748b);
  line-height: 1;
}
.tg-modal-header .modal-close:hover {
  color: var(--ink-1, #f8fafc);
}
.tg-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tg-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tg-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2, #cbd5e1);
}
.tg-field input {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #334155);
  background: var(--bg, #0f172a);
  color: var(--ink-1, #f8fafc);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.tg-field input:focus {
  border-color: #24a1de;
}
.tg-hint {
  font-size: 11px;
  color: var(--ink-4, #94a3b8);
}
.tg-hint a {
  color: #24a1de;
  text-decoration: none;
}
.tg-hint a:hover {
  text-decoration: underline;
}
.tg-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tg-field-check {
  display: flex;
  align-items: center;
  margin-top: 14px;
}
.tg-field-check label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-2, #cbd5e1);
}
.tg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.tg-status-msg {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-top: 4px;
}
.tg-status-msg.success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.tg-status-msg.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* 30m Alert Badge on Task Cards */
.tg-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: #24a1de;
  background: rgba(36, 161, 222, 0.12);
  border: 1px solid rgba(36, 161, 222, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
}
