/* @font-face for IRANSansX Variable Font */
@font-face {
  font-family: 'IRANSansX';
  src: url('/fonts/IRANSansXV.woff2') format('woff2-variations'),
       url('/fonts/IRANSansXV.woff') format('woff-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-app: #0c0e14;
  --bg-sidebar: #13151f;
  --bg-card: #181b27;
  --bg-card-hover: #1f2333;
  --bg-input: #10121a;
  --bg-modal: #181b27;
  --bg-overlay: rgba(0, 0, 0, 0.78);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border-subtle: #24293d;
  --border-focus: #6366f1;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.15);

  --p1-color: #ef4444;
  --p1-bg: rgba(239, 68, 68, 0.12);
  --p1-border: rgba(239, 68, 68, 0.35);

  --p2-color: #f59e0b;
  --p2-bg: rgba(245, 158, 11, 0.12);
  --p2-border: rgba(245, 158, 11, 0.35);

  --p3-color: #3b82f6;
  --p3-bg: rgba(59, 130, 246, 0.12);
  --p3-border: rgba(59, 130, 246, 0.35);

  --p4-color: #64748b;
  --p4-bg: rgba(100, 116, 139, 0.1);
  --p4-border: rgba(100, 116, 139, 0.25);

  --overdue-bg: rgba(239, 68, 68, 0.08);
  --overdue-border: rgba(239, 68, 68, 0.25);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-family: 'IRANSansX', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-app: #f8fafc;
    --bg-sidebar: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    --bg-modal: #ffffff;
    --bg-overlay: rgba(15, 23, 42, 0.6);

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;

    --border-subtle: #e2e8f0;
    --border-focus: #6366f1;

    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: rgba(79, 70, 229, 0.1);

    --p1-color: #dc2626;
    --p1-bg: #fef2f2;
    --p1-border: #fca5a5;

    --p2-color: #d97706;
    --p2-bg: #fffbeb;
    --p2-border: #fcd34d;

    --p3-color: #2563eb;
    --p3-bg: #eff6ff;
    --p3-border: #bfdbfe;

    --p4-color: #94a3b8;
    --p4-bg: #f1f5f9;
    --p4-border: #e2e8f0;

    --overdue-bg: #fff1f2;
    --overdue-border: #fecdd3;
  }
}

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

html, body {
  direction: rtl;
  text-align: right;
  font-family: var(--font-family);
  font-feature-settings: "ss01" 1; /* Persian numbers feature in IRANSansX */
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  direction: ltr;
}

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

/* Sidebar */
.sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  border-right: none;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 14px;
}

.brand-icon {
  font-size: 1.3rem;
}

.brand-name {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.badge-local {
  margin-right: auto;
  margin-left: 0;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  direction: ltr;
}

.sidebar-quick-add {
  padding: 0 16px 16px;
}

.btn-quick-add-sidebar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-quick-add-sidebar:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-quick-add-sidebar kbd {
  margin-right: auto;
  margin-left: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.15s ease;
}

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

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
}

.nav-icon {
  font-size: 1.05rem;
}

.nav-icon-tag {
  color: var(--accent);
  font-weight: 800;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 1px 7px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.badge-overdue-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: var(--p1-color);
  padding: 1px 8px;
  border-radius: 12px;
}

.nav-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 12px 0;
}

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 6px;
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  padding: 0;
}

.btn-add-project-minimal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-add-project-minimal:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: var(--border-subtle);
}

.project-nav-row {
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: all 0.15s ease;
  position: relative;
}

.project-nav-row:hover {
  background: var(--bg-card-hover);
}

.project-nav-row.active {
  background: var(--accent-light);
}

.project-nav-row.active .nav-item-link {
  color: var(--accent);
  font-weight: 700;
}

.project-nav-row .nav-item-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 0;
}

.btn-project-manage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  margin-left: 6px;
  opacity: 0;
  transition: all 0.15s ease;
}

.project-nav-row:hover .btn-project-manage,
.btn-project-manage:focus {
  opacity: 1;
}

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

/* Touch screens always show manage button */
@media (hover: none) {
  .btn-project-manage {
    opacity: 0.7;
  }
}

/* Project Modal Styles */
.project-modal-card {
  max-width: 440px !important;
}

.project-name-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.project-hash-prefix {
  position: absolute;
  right: 12px;
  font-weight: 800;
  color: var(--accent);
  font-size: 1.1rem;
}

.project-input {
  padding-right: 28px !important;
  width: 100%;
}

.project-color-palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.color-dot-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-dot-btn:hover {
  transform: scale(1.15);
}

.color-dot-btn.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--border-focus);
  transform: scale(1.15);
}

.modal-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.modal-actions-end {
  display: flex;
  gap: 8px;
  margin-right: auto;
}

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  color: var(--p1-color);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger-outline:hover {
  background: var(--p1-color);
  color: #fff;
}

/* Project View Header Settings Button */
.project-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-manage-project-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-manage-project-header:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
}

.btn-shortcuts {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
}

.search-box {
  flex: 1;
  max-width: 480px;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  right: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-form input {
  width: 100%;
  padding: 8px 38px 8px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.15s ease;
}

.search-form input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.kbd-hint {
  position: absolute;
  left: 10px;
  right: auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-add-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-add-top:hover {
  background: var(--accent-hover);
}

.btn-add-top kbd {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border: none;
}

/* View Container */
.view-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 36px 60px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.view-header {
  margin-bottom: 24px;
}

.view-title-group h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.view-date-subtitle {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* Sections */
.task-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.task-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

.collapsible-header {
  cursor: pointer;
  user-select: none;
}

.collapse-arrow {
  font-size: 0.75rem;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

/* Overdue Pinned Section */
.section-overdue {
  background: var(--overdue-bg);
  border: 1px solid var(--overdue-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.overdue-header {
  border-bottom-color: var(--overdue-border);
  padding-bottom: 8px;
}

.icon-overdue {
  color: var(--p1-color);
}

.overdue-header h2 {
  color: var(--p1-color);
}

/* Task List & Rows */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  cursor: pointer;
  outline: none;
}

.task-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.task-row.selected,
.task-row:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
  background: var(--bg-card-hover);
}

.task-row.overdue {
  border-right: 4px solid var(--p1-color);
  border-left: 1px solid var(--border-subtle);
}

.task-row.completed {
  opacity: 0.6;
}

.task-row.completed .task-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

.task-checkbox-wrapper {
  padding-top: 2px;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--p4-color);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #fff;
}

.task-row.p1 .task-checkbox { border-color: var(--p1-color); }
.task-row.p2 .task-checkbox { border-color: var(--p2-color); }
.task-row.p3 .task-checkbox { border-color: var(--p3-color); }

.task-checkbox:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.1);
}

.task-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-main-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-priority-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-priority-indicator.p1 { background: var(--p1-color); }
.task-priority-indicator.p2 { background: var(--p2-color); }
.task-priority-indicator.p3 { background: var(--p3-color); }
.task-priority-indicator.p4 { display: none; }

.task-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  word-break: break-word;
}

.task-notes-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.badge-due {
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}

.badge-overdue {
  color: var(--p1-color);
  background: var(--p1-bg);
  border-color: var(--p1-border);
  font-weight: 700;
}

.badge-recurrence {
  color: var(--accent);
  background: var(--accent-light);
}

.badge-project {
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
}

.badge-project:hover {
  color: var(--text-main);
  border-color: var(--accent);
}

.icon-inline {
  vertical-align: -1px;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-row:hover .task-actions,
.task-row:focus-within .task-actions,
.task-row.selected .task-actions {
  opacity: 1;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

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

.btn-danger:hover {
  color: var(--p1-color);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.empty-hint {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 12px 0;
}

.day-empty {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 8px 12px;
  font-style: italic;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 48px);
  padding: 22px;
  margin: auto;
  position: relative;
  animation: slideDown 0.15s ease;
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Quick Add Form */
.quick-add-input-wrapper {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.quick-add-input-wrapper input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.98rem;
}

.quick-add-input-wrapper input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  padding: 10px 16px;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger-outline {
  padding: 10px 16px;
  background: transparent;
  color: var(--p1-color);
  border: 1px solid var(--p1-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger-outline:hover {
  background: var(--p1-bg);
}

.quick-add-preview {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.quick-add-preview.hidden {
  display: none;
}

.preview-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 6px;
}

.preview-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-preview-title {
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.quick-add-footer {
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.syntax-tips {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  flex: 1;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-text,
.select-input,
.textarea-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.92rem;
  font-family: inherit;
}

.input-text:focus,
.select-input:focus,
.textarea-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.form-row {
  display: flex;
  gap: 14px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.actions-right {
  display: flex;
  gap: 10px;
}

/* Jalali DatePicker Widget */
.jalali-picker-wrapper {
  position: relative;
  width: 100%;
}

.jalali-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: right;
  transition: border-color 0.15s ease;
}

.jalali-picker-btn:hover,
.jalali-picker-btn:focus {
  border-color: var(--border-focus);
}

.picker-label {
  flex: 1;
}

.picker-clear-btn {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.picker-clear-btn:hover {
  color: var(--p1-color);
  background: var(--p1-bg);
}

.jalali-picker-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  padding: 14px;
  width: 290px;
  z-index: 1200;
  animation: slideDown 0.15s ease;
}

.jalali-picker-dropdown.open-upwards {
  top: auto;
  bottom: calc(100% + 6px);
  animation: slideUp 0.15s ease;
}

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

.cal-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.cal-nav-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.cal-weekday {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-grid,
.cal-days-grid {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  gap: 3px;
  margin-bottom: 12px;
}

.cal-empty {
  display: block;
  aspect-ratio: 1;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.cal-day:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
}

.cal-day.today {
  border: 1px solid var(--accent);
  font-weight: 700;
}

.cal-day.selected {
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 700;
}

.cal-time-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 10px;
}

.time-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.time-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
  direction: ltr;
}

.cal-time-input {
  width: 44px;
  text-align: center;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
}

.cal-presets {
  display: flex;
  gap: 6px;
}

.preset-btn {
  flex: 1;
  padding: 5px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* Recurrence Picker Widget */
.recurrence-picker-wrapper {
  position: relative;
  width: 100%;
}

.recurrence-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: right;
  transition: border-color 0.15s ease;
}

.recurrence-picker-btn:hover,
.recurrence-picker-btn:focus {
  border-color: var(--border-focus);
}

.recurrence-label {
  flex: 1;
}

.recurrence-clear-btn {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.recurrence-clear-btn:hover {
  color: var(--p1-color);
  background: var(--p1-bg);
}

.recurrence-picker-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  padding: 12px;
  width: 300px;
  z-index: 1200;
  animation: slideDown 0.15s ease;
}

.recurrence-picker-dropdown.open-upwards {
  top: auto;
  bottom: calc(100% + 6px);
  animation: slideUp 0.15s ease;
}

.rec-presets-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 240px;
  overflow-y: auto;
}

.rec-preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: right;
  transition: all 0.12s ease;
}

.rec-preset-item:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
}

.rec-preset-item.selected {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
}

.rec-check {
  font-weight: 800;
  color: var(--accent);
}

.rec-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.rec-custom-toggle-btn {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.rec-custom-toggle-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.rec-custom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.rec-custom-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
}

.rec-back-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.rec-custom-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rec-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-custom-text {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.rec-custom-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: block;
}

.rec-interval-input {
  width: 50px;
  padding: 6px;
  text-align: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
}

.rec-freq-select {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
}

.rec-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.rec-day-pill {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.rec-day-pill:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
}

.rec-day-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

.rec-monthday-input {
  width: 60px;
  padding: 6px;
  text-align: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  margin-left: 6px;
}

.rec-apply-btn {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

/* Help Modal */
.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.shortcuts-table td {
  padding: 8px 6px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-subtle);
}

.shortcuts-table td:first-child {
  width: 130px;
}

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

.help-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.help-examples {
  padding-right: 20px;
  padding-left: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-examples code {
  font-family: var(--font-mono);
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  direction: ltr;
  display: inline-block;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.2s ease;
}

.hidden {
  display: none !important;
}

/* Notifications Bell & Popover */
.notif-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-bell {
  position: relative;
  color: var(--text-muted);
}

.btn-bell:hover {
  color: var(--text-main);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--p1-color);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--p1-color);
}

.notifications-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  animation: slideDown 0.15s ease;
  overflow: hidden;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-input);
  gap: 8px;
}

.notif-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.notif-title-group h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.notif-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-text-sm {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
  white-space: nowrap;
}

.btn-text-sm:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-text-sm.text-danger:hover {
  color: var(--p1-color);
  border-color: var(--p1-color);
}

.notif-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notif-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border-right: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.12s ease;
  cursor: pointer;
}

.notif-item:hover {
  background: var(--bg-card-hover);
}

.notif-item.unread {
  background: var(--accent-light);
  border-right-color: var(--accent);
}

.notif-item-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
}

.notif-item-msg {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: pre-line;
}

.notif-item-time {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: left;
  margin-top: 3px;
}

.notif-empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.notif-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-test-push {
  width: 100%;
  font-size: 0.84rem;
  padding: 8px 12px;
  justify-content: center;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.notif-topic-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-dim);
}

.notif-topic-hint code {
  font-family: var(--font-mono);
  direction: ltr;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.78rem;
}

/* Badges for reminder & subtasks */
.badge-reminder {
  background: rgba(255, 170, 0, 0.15);
  color: #ffaa00;
  border-color: rgba(255, 170, 0, 0.3);
}

.badge-subtasks {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.badge-subtasks:hover {
  background: var(--accent);
  color: #fff;
}

.badge-subtasks.subtasks-complete {
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
  border-color: rgba(46, 213, 115, 0.3);
}

/* Inline Subtasks List in Task Row */
.inline-subtasks-list {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.inline-subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}

.inline-subtask-row.sub-done .subtask-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

.subtask-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-subtle);
  background: transparent;
  color: #fff;
  font-size: 0.65rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.subtask-checkbox:hover {
  border-color: var(--accent);
}

.subtask-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.subtask-title {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-main);
}

.badge-sm {
  font-size: 0.72rem;
  padding: 1px 6px;
}

/* Subtasks Manager in Task Edit Modal */
.subtasks-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

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

.subtasks-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subtasks-title-box h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.subtasks-progress-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.subtasks-progress-bar-bg {
  width: 100%;
  height: 5px;
  background: var(--bg-input);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
}

.subtasks-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.25s ease;
}

.modal-subtasks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.modal-subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease;
}

.modal-subtask-item:hover {
  border-color: var(--border-focus);
}

.modal-subtask-item.sub-done .modal-subtask-title-input {
  text-decoration: line-through;
  color: var(--text-dim);
}

/* ===================================================
   Todoist-Style 2-Column Task Detail Modal & Subtasks
   =================================================== */

.task-detail-todoist-card {
  max-width: 900px !important;
  width: 94vw !important;
  max-height: 90vh !important;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
}

.td-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.td-topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.td-project-icon {
  font-size: 1rem;
}

.td-project-name {
  color: var(--text-main);
}

.td-modal-layout {
  display: flex;
  flex-direction: row;
  overflow: hidden;
  height: calc(90vh - 54px);
}

/* Main Column (Right in RTL) */
.td-main-col {
  flex: 1;
  min-width: 0;
  padding: 24px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.td-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.td-parent-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--p4-color);
  background: transparent;
  cursor: pointer;
  margin-top: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.15s ease;
}

.td-parent-checkbox:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.td-parent-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.td-title-input {
  flex: 1;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  outline: none;
  padding: 2px 0;
  line-height: 1.4;
}

.td-title-input:focus {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

.td-notes-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.td-notes-icon {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.td-notes-textarea {
  flex: 1;
  background: transparent;
  border: 1px dashed transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.6;
  resize: vertical;
  padding: 6px 8px;
  outline: none;
  transition: all 0.15s ease;
}

.td-notes-textarea:focus,
.td-notes-textarea:hover {
  border-color: var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
}

/* Subtasks Section */
.td-subtasks-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.td-subtasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
}

.td-subtasks-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.td-collapse-arrow {
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: transform 0.15s ease;
}

.td-subtasks-title-group h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.td-subtasks-count-pill {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 8px;
  border-radius: 99px;
}

.td-subtasks-hide-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.12s ease;
}

.td-subtasks-hide-btn:hover {
  color: var(--text-main);
}

.td-subtasks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Single Subtask Row */
.td-subtask-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: all 0.12s ease;
}

.td-subtask-item:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

.td-subtask-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--text-dim);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.td-subtask-check:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.td-subtask-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.td-subtask-title-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

/* Subtask Date Pill */
.td-subtask-date-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.td-subtask-date-pill:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.td-subtask-date-pill.empty {
  color: var(--text-dim);
  border-style: dashed;
}

.td-subtask-date-pill.empty:hover {
  color: var(--accent);
}

.td-subtask-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 4px 6px;
  cursor: pointer;
  opacity: 0.4;
  transition: all 0.12s ease;
}

.td-subtask-item:hover .td-subtask-delete-btn {
  opacity: 1;
}

.td-subtask-delete-btn:hover {
  color: var(--p1-color);
}

/* Completed Subtasks */
.td-subtasks-list.completed-list .td-subtask-item {
  opacity: 0.65;
  background: transparent;
  border-color: transparent;
}

.td-subtasks-list.completed-list .td-subtask-title-input {
  text-decoration: line-through;
  color: var(--text-dim);
}

/* Add Subtask Button & Inline Form */
.td-btn-add-subtask {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  width: 100%;
  text-align: right;
  transition: all 0.15s ease;
}

.td-btn-add-subtask:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.td-plus-icon {
  font-size: 1.1rem;
  font-weight: bold;
}

.td-inline-subtask-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.td-inline-subtask-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}

.td-inline-subtask-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.td-inline-subtask-btns {
  display: flex;
  gap: 6px;
}

/* Sidebar Column (Left in RTL) */
.td-sidebar-col {
  width: 290px;
  min-width: 270px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.td-prop-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.td-prop-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
}

.td-prop-input {
  font-size: 0.88rem;
  padding: 8px 12px;
}

.td-sidebar-actions {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-save-td {
  width: 100%;
  justify-content: center;
  padding: 10px;
  font-weight: 700;
}

.btn-delete-td {
  width: 100%;
  justify-content: center;
  padding: 7px;
  font-size: 0.82rem;
}

/* Floating Mini Jalali Popover for Subtasks */
.mini-jalali-popover {
  position: absolute;
  width: 280px;
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  padding: 12px;
  z-index: 2500;
  animation: slideDown 0.15s ease;
}

/* Responsive adjustment for small screens */
@media (max-width: 768px) {
  .td-modal-layout {
    flex-direction: column;
    height: auto;
  }
  .td-sidebar-col {
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--border-subtle);
  }
}

/* ===================================================
   Pomodoro & Deep Work Focus Styles
   =================================================== */

/* Topbar Pomodoro Button */
.btn-pomodoro-topbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pomodoro-topbar:hover {
  border-color: var(--p1-color);
  background: var(--bg-card-hover);
}

.btn-pomodoro-topbar.active-running {
  border-color: var(--p1-color);
  background: rgba(239, 68, 68, 0.12);
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

.pomodoro-icon {
  font-size: 1rem;
}

.pomodoro-timer-text {
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: center;
}

.pomodoro-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
}

.pomodoro-status-dot.running.focus {
  background: var(--p1-color);
}

.pomodoro-status-dot.running.short_break,
.pomodoro-status-dot.running.long_break {
  background: #10b981;
}

.btn-pomodoro-task {
  font-size: 0.95rem;
  padding: 4px;
}

.btn-pomodoro-task:hover {
  transform: scale(1.15);
}

/* Pomodoro Modal Card */
.pomodoro-modal-card {
  max-width: 580px !important;
  width: 92vw !important;
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);
  padding: 0 !important;
  overflow: hidden;
}

.pomo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.pomo-modal-tabs {
  display: flex;
  gap: 8px;
}

.pomo-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.pomo-tab-btn.active {
  color: var(--text-main);
  background: var(--bg-input);
  border-color: var(--border-subtle);
  font-weight: 700;
}

.pomo-modal-body {
  padding: 24px;
  max-height: 80vh;
  overflow-y: auto;
}

.pomo-tab-content {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.pomo-tab-content.active {
  display: flex;
}

/* Mode Selector */
.pomo-mode-selector {
  display: flex;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.pomo-mode-btn {
  flex: 1;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.pomo-mode-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  font-weight: 700;
}

/* Task Selector */
.pomo-task-selector-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pomo-task-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
}

.pomo-task-select {
  font-size: 0.88rem;
  padding: 8px 12px;
}

/* Timer Display */
.pomo-timer-display-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.pomo-progress-ring-wrapper {
  position: relative;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pomo-progress-ring {
  transform: rotate(-90deg);
}

.pomo-ring-fill {
  transition: stroke-dashoffset 0.35s ease, stroke 0.3s ease;
}

.pomo-timer-center {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pomo-digits {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -1px;
}

.pomo-current-mode {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 6px;
  font-weight: 600;
}

/* Controls */
.pomo-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.btn-pomo-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--p1-color);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  transition: all 0.15s ease;
}

.btn-pomo-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.55);
}

.btn-pomo-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pomo-secondary:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.pomo-today-badge {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.pomo-today-badge strong {
  color: var(--accent);
  margin-right: 4px;
}

/* Deep Work Stats Tab */
.pomo-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.pomo-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.stat-icon {
  font-size: 1.8rem;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-weight: 600;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 2px 0;
}

.stat-sub {
  font-size: 0.74rem;
  color: var(--accent);
  font-weight: 600;
}

.pomo-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

/* 7 Days Bar Chart */
.pomo-barchart-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 140px;
  padding: 16px 12px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  gap: 8px;
}

.pomo-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.pomo-bar-val {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 700;
  height: 16px;
}

.pomo-bar-track {
  flex: 1;
  width: 18px;
  background: var(--bg-input);
  border-radius: 4px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  margin: 4px 0;
}

.pomo-bar-fill {
  width: 100%;
  background: var(--text-dim);
  border-radius: 4px;
  transition: height 0.3s ease;
}

.pomo-bar-fill.has-data {
  background: linear-gradient(180deg, var(--p1-color), var(--accent));
}

.pomo-bar-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Project distribution */
.pomo-projects-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pomo-proj-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.pomo-proj-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}

.pomo-proj-name {
  font-weight: 700;
  color: var(--accent);
}

.pomo-proj-time {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.pomo-proj-bar-track {
  height: 5px;
  background: var(--bg-input);
  border-radius: 99px;
  overflow: hidden;
}

.pomo-proj-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

/* Recent History List */
.pomo-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pomo-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.pomo-hist-icon {
  font-size: 1.1rem;
}

.pomo-hist-info {
  flex: 1;
}

.pomo-hist-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
}

.pomo-hist-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.pomo-empty-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  padding: 12px;
}

/* Sidebar focus task section */
.pomo-focus-section {
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.btn-focus-task {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: var(--p1-color);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-focus-task:hover {
  background: var(--p1-color);
  color: #fff;
  border-color: var(--p1-color);
}

.td-task-pomo-stats {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 4px;
}

/* ===================================================
   Authentication & User Profile Styles
   =================================================== */

/* Auth Pages Body & Container */
.auth-page-body {
  background: var(--bg-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-container {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.auth-brand {
  text-align: center;
}

.auth-logo-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 6px;
}

.auth-brand-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.auth-brand-subtitle {
  font-size: 0.86rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.auth-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.auth-card-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.auth-card-desc {
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 20px;
}

.auth-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.auth-alert.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.auth-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.92rem;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-toggle-pwd {
  position: absolute;
  left: 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px;
  transition: color 0.15s ease;
}

.btn-toggle-pwd:hover {
  color: var(--text-main);
}

.form-hint {
  display: block;
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.btn-auth-submit {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 10px;
}

.btn-arrow {
  font-size: 1.1rem;
  transition: transform 0.15s ease;
}

.btn-auth-submit:hover .btn-arrow {
  transform: translateX(-4px);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-divider span {
  padding: 0 12px;
}

.auth-alt-methods {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-alt-auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-alt-auth.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-footer-link {
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-dim);
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.auth-footer-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  margin-right: 4px;
}

.auth-footer-link a:hover {
  text-decoration: underline;
}

.auth-security-tag {
  font-size: 0.76rem;
  color: var(--text-dim);
  text-align: center;
}

/* User Profile Topbar Menu */
.user-profile-wrapper {
  position: relative;
}

.btn-user-profile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  background: var(--bg-card);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.btn-user-profile:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 250px;
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  padding: 12px;
  z-index: 2100;
  animation: slideDown 0.15s ease;
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 10px;
}

.user-menu-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
}

.user-menu-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-menu-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-email {
  font-size: 0.74rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.12s ease;
}

.user-menu-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.user-menu-item.logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* ===================================================
   Mobile & Tablet Fully Responsive System
   =================================================== */

/* Hamburger Button */
.btn-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 8px;
  gap: 4px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-hamburger:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.hamburger-line {
  display: block;
  width: 18px;
  height: 2px;
  background-color: var(--text-main);
  border-radius: 2px;
  transition: all 0.2s ease;
}

/* Sidebar Close Button (Mobile Only) */
.btn-sidebar-close {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

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

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 2999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

body.sidebar-locked {
  overflow: hidden;
}

/* Floating Action Button (FAB) for Mobile */
.btn-fab-mobile {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #4338ca);
  color: #ffffff;
  border: none;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.btn-fab-mobile:active {
  transform: scale(0.92);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ---------------------------------------------------
   Breakpoints: Tablet & Large Mobile (<= 1024px)
   --------------------------------------------------- */
@media (max-width: 1024px) {
  .btn-hamburger {
    display: flex;
  }

  .btn-sidebar-close {
    display: block;
  }

  .sidebar-brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .brand-info {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Slide-in Mobile Sidebar */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: -310px;
    width: 290px;
    max-width: 85vw;
    z-index: 3000;
    box-shadow: -8px 0 36px rgba(0, 0, 0, 0.6);
    transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.mobile-open {
    right: 0;
  }

  .main-content {
    width: 100%;
  }

  .topbar {
    padding: 10px 16px;
    gap: 10px;
  }

  .search-box {
    max-width: none;
    flex: 1;
  }

  .view-container {
    padding: 20px 16px;
  }
}

/* ---------------------------------------------------
   Breakpoints: Mobile Landscape & Standard (<= 768px)
   --------------------------------------------------- */
@media (max-width: 768px) {
  /* Layout adjustments */
  .view-container {
    padding: 16px 12px 80px; /* Extra bottom padding for FAB and mobile scrolling */
  }

  .view-header {
    margin-bottom: 16px;
  }

  .view-title-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .view-title {
    font-size: 1.35rem;
  }

  .today-date-badge {
    font-size: 0.76rem;
    padding: 3px 8px;
  }

  /* Topbar compact mode */
  .topbar {
    padding: 8px 12px;
    gap: 8px;
  }

  .kbd-hint {
    display: none;
  }

  .btn-add-top {
    display: none; /* Replaced by Floating Action Button (FAB) */
  }

  .btn-fab-mobile {
    display: flex;
  }

  .topbar-actions {
    gap: 6px;
  }

  .btn-pomodoro-topbar {
    padding: 5px 8px;
    font-size: 0.8rem;
    gap: 6px;
  }

  .pomodoro-timer-text {
    min-width: 36px;
    font-size: 0.8rem;
  }

  /* Modals: Task Detail Modal full mobile stacked layout */
  .modal-overlay {
    padding: 0;
    align-items: flex-end; /* Bottom sheet behavior on phones */
  }

  .td-modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    height: 92vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
  }

  .td-modal-layout {
    flex-direction: column;
    overflow-y: auto;
  }

  .td-main-col {
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .td-sidebar-col {
    width: 100%;
    border-right: none;
    padding: 16px;
    background: var(--bg-card);
  }

  .td-task-title-input {
    font-size: 1.15rem;
  }

  .td-subtask-item {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 6px;
  }

  .td-subtask-title {
    min-width: 60%;
  }

  .td-subtask-actions {
    margin-right: auto;
  }

  /* Quick Add Modal Mobile */
  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 20px 16px !important;
  }

  /* Pomodoro Modal Mobile */
  .pomodoro-modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 20px 20px 0 0 !important;
  }

  .pomo-modal-body {
    padding: 16px;
  }

  .pomo-progress-ring-wrapper {
    width: 180px;
    height: 180px;
  }

  .pomo-progress-ring {
    width: 180px;
    height: 180px;
  }

  .pomo-digits {
    font-size: 2.3rem;
  }

  .pomo-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-pomo-primary {
    padding: 10px 24px;
    font-size: 0.92rem;
  }

  .btn-pomo-secondary {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .pomo-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Task Item Mobile */
  .task-item {
    padding: 10px 10px;
    gap: 8px;
  }

  .task-checkbox-custom {
    width: 20px;
    height: 20px;
  }

  .task-title {
    font-size: 0.92rem;
  }

  .task-meta {
    flex-wrap: wrap;
    gap: 4px;
  }

  .task-meta-tag {
    font-size: 0.72rem;
    padding: 2px 6px;
  }

  /* Always show task action buttons on touch screens */
  .task-actions {
    opacity: 1 !important;
    visibility: visible !important;
  }

  .btn-task-action {
    padding: 4px;
    font-size: 0.85rem;
  }

  /* Notification Drawer Mobile */
  .notifications-drawer {
    position: fixed !important;
    top: 55px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: none !important;
    max-height: 80vh !important;
  }

  /* User Profile Dropdown Mobile */
  .user-profile-dropdown {
    position: fixed !important;
    top: 55px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: 320px !important;
  }

  /* Mini Jalali Popover Center on Screen on Mobile */
  .mini-jalali-popover {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 92vw !important;
    max-width: 320px !important;
    z-index: 3500 !important;
  }

  /* Upcoming Days view headers */
  .upcoming-day-header {
    font-size: 0.95rem;
  }
}

/* ---------------------------------------------------
   Breakpoints: Small Phones (<= 480px)
   --------------------------------------------------- */
@media (max-width: 480px) {
  .topbar {
    padding: 6px 10px;
    gap: 6px;
  }

  .global-search-input {
    font-size: 0.8rem;
    padding: 6px 10px 6px 28px;
  }

  .btn-pomodoro-topbar .pomodoro-timer-text {
    display: none; /* Hide timer text on very narrow screens to save space */
  }

  .btn-pomodoro-topbar {
    padding: 6px 8px;
  }

  .auth-card {
    padding: 24px 18px;
  }

  .auth-brand-title {
    font-size: 1.4rem;
  }

  .task-item-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .pomo-barchart-container {
    padding: 10px 6px 4px;
    gap: 4px;
  }

  .pomo-bar-track {
    width: 14px;
  }

  .pomo-bar-label {
    font-size: 0.65rem;
  }
}

/* ===================================================
   Network Sync Status Indicator Styles
   =================================================== */
.sync-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-dim);
  transition: all 0.2s ease;
  user-select: none;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.sync-status-badge.online {
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
}
.sync-status-badge.online .sync-dot {
  background-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.sync-status-badge.offline {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}
.sync-status-badge.offline .sync-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.sync-status-badge.syncing,
.sync-status-badge.pending {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
}
.sync-status-badge.syncing .sync-dot,
.sync-status-badge.pending .sync-dot {
  background-color: var(--accent);
  animation: pulseSync 1.2s infinite ease-in-out;
}

@keyframes pulseSync {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.3); }
}

@media (max-width: 640px) {
  .sync-status-badge .sync-text {
    display: none;
  }
  .sync-status-badge {
    padding: 6px;
  }
}






