@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

/* ========== Theme tokens (Hexogate-inspired 2026) ========== */
:root, :root[data-theme="dark"] {
  --bg: var(--tg-bg, #0a0e17);
  --bg-elevated: #0f1520;
  --surface: var(--tg-secondary, #121a28);
  --surface-2: #182233;
  --surface-3: #1e2a3d;
  --border: rgba(120, 150, 200, 0.12);
  --border-strong: rgba(120, 160, 220, 0.22);
  --text: var(--tg-text, #eef2f8);
  --text-dim: var(--tg-hint, #8b9bb4);
  --accent: var(--tg-button, #2dd4bf);
  --accent-2: #22d3ee;
  --accent-dim: rgba(45, 212, 191, 0.14);
  --gradient: linear-gradient(135deg, #2dd4bf 0%, #22d3ee 55%, #38bdf8 100%);
  --gradient-soft: linear-gradient(160deg, rgba(45,212,191,0.18), rgba(34,211,238,0.08));
  --danger: #fb7185;
  --danger-dim: rgba(251, 113, 133, 0.14);
  --success: #34d399;
  --success-dim: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-dim: rgba(251, 191, 36, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --btn-text: var(--tg-button-text, #042f2e);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.2);
  --nav-h: calc(64px + env(safe-area-inset-bottom, 0px));
  --blur: saturate(1.2) blur(16px);
}

:root[data-theme="light"] {
  --bg: var(--tg-bg, #f0f4f8);
  --bg-elevated: #ffffff;
  --surface: var(--tg-secondary, #ffffff);
  --surface-2: #e8eef5;
  --surface-3: #dfe8f2;
  --border: rgba(30, 50, 80, 0.08);
  --border-strong: rgba(30, 50, 80, 0.14);
  --text: var(--tg-text, #0f172a);
  --text-dim: var(--tg-hint, #64748b);
  --accent: var(--tg-button, #0d9488);
  --accent-2: #0891b2;
  --accent-dim: rgba(13, 148, 136, 0.12);
  --gradient: linear-gradient(135deg, #0d9488 0%, #0891b2 100%);
  --gradient-soft: linear-gradient(160deg, rgba(13,148,136,0.12), rgba(8,145,178,0.06));
  --danger: #e11d48;
  --danger-dim: rgba(225, 29, 72, 0.1);
  --success: #059669;
  --success-dim: rgba(5, 150, 105, 0.1);
  --warn: #d97706;
  --warn-dim: rgba(217, 119, 6, 0.1);
  --btn-text: var(--tg-button-text, #ffffff);
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
}

/* Material Symbols */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined' !important;
  font-weight: 300 !important;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
  vertical-align: middle;
  user-select: none;
  flex-shrink: 0;
}
/* متن فارسی هرگز با فونت آیکن رندر نشود */
button, input, select, textarea, label, span, div, p, h1, h2, strong, a {
  font-family: 'Vazirmatn', system-ui, sans-serif;
}
button .material-symbols-outlined,
label .material-symbols-outlined,
span.material-symbols-outlined,
h1 .material-symbols-outlined,
h2 .material-symbols-outlined,
div .material-symbols-outlined {
  font-family: 'Material Symbols Outlined' !important;
}
.mi { font-size: 18px; }
.mi-sm { font-size: 15px; }
.mi-lg { font-size: 26px; }
.mi-xl { font-size: 34px; }
.mi-fill { font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 20; }

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Vazirmatn', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body {
  padding-bottom: var(--nav-h);
  min-height: 100dvh;
  background-image:
    radial-gradient(ellipse 80% 50% at 100% -20%, rgba(45, 212, 191, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(34, 211, 238, 0.05), transparent);
  background-attachment: fixed;
}
#app { min-height: 100dvh; }

/* ========== Topbar ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 16px 10px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: 24px !important;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.brand-text { min-width: 0; flex: 1; }
.topbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.topbar-subtitle .meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.35;
}
.topbar-subtitle .meta-label {
  color: var(--text-dim);
  font-weight: 600;
  white-space: nowrap;
}
.topbar-subtitle .meta-value {
  color: var(--text);
  font-weight: 600;
}
.topbar-subtitle #clock-time {
  color: var(--accent);
  font-weight: 700;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

main#content {
  padding: 14px 14px 28px;
  animation: fadeUp 0.28s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Buttons ========== */
button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  background: none;
  color: inherit;
}
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
  width: 100%;
}
.btn-primary {
  background: var(--gradient);
  color: var(--btn-text);
  box-shadow: 0 4px 20px rgba(45, 212, 191, 0.28);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; box-shadow: none; }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px dashed var(--border-strong);
}
.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  flex-shrink: 0;
}

/* ========== Cards ========== */
.hero-card {
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 20px 18px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(45,212,191,0.2), transparent 70%);
  pointer-events: none;
}
.hero-card .hero-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.4px;
}
.hero-card .hero-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}
.hero-steps {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.hero-step {
  flex: 1;
  min-width: 90px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}
.hero-step .step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 700;
  color: var(--accent);
  font-size: 12px;
  margin-bottom: 4px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
  min-width: 0;
}
.stat-card:active { border-color: var(--accent); }
.stat-card .stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 16px !important;
  margin-bottom: 2px;
}
.stat-card.danger .stat-icon { background: var(--danger-dim); color: var(--danger); }
.stat-card.warn .stat-icon { background: var(--warn-dim); color: var(--warn); }
.stat-card.success .stat-icon { background: var(--success-dim); color: var(--success); }
.stat-card .stat-value {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: 10px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.25;
}

.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  margin: 18px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.2px;
}
.section-label .material-symbols-outlined { font-size: 18px; color: var(--accent); }

/* ========== Task cards ========== */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}
.task-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.5;
  border-radius: 0 3px 3px 0;
}
.task-card.overdue::before { background: var(--danger); opacity: 1; }
.task-card.done::before { background: var(--success); opacity: 0.7; }
.task-card.done { opacity: 0.85; }
.task-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.task-id {
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 8px;
  flex-shrink: 0;
  direction: ltr;
}
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid transparent;
  font-weight: 500;
}
.chip .material-symbols-outlined { font-size: 14px; }
.chip.overdue { background: var(--danger-dim); color: var(--danger); }
.chip.done { background: var(--success-dim); color: var(--success); }
.chip.due-soon { background: var(--warn-dim); color: var(--warn); }
.chip.recurring { background: var(--accent-dim); color: var(--accent); }
.chip.prio-urgent { background: var(--danger-dim); color: var(--danger); font-weight: 700; }
.chip.prio-high { background: var(--warn-dim); color: var(--warn); }
.chip.prio-low { opacity: 0.85; }

.last-comment {
  margin: 8px 0 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid var(--border);
}
.last-comment .material-symbols-outlined { font-size: 16px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.last-comment strong { color: var(--text); font-weight: 600; }

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.task-actions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  max-width: 100%;
}
.task-actions button .material-symbols-outlined { flex-shrink: 0; }
.task-actions button .material-symbols-outlined { font-size: 16px; }
.task-actions .done-btn {
  background: var(--success-dim);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
}

/* ========== Forms ========== */
.field { margin-bottom: 14px; }
.field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.field label .material-symbols-outlined { font-size: 18px; color: var(--accent); }
.field input[type="text"],
.field input[type="search"],
.field textarea,
.field select,
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus,
.field textarea:focus,
.field select:focus,
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b9bb4' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
}
.search-input {
  margin-bottom: 12px;
  padding-right: 40px;
  background-image: none;
}
.input-with-icon {
  position: relative;
}
.input-with-icon .field-ico {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 20px !important;
  pointer-events: none;
}
.input-with-icon input,
.input-with-icon .search-input {
  padding-right: 42px;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: all 0.15s;
}
.pill .material-symbols-outlined { font-size: 16px; }
.pill.selected {
  background: var(--gradient);
  color: var(--btn-text);
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(45, 212, 191, 0.25);
}
.deadline-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
}
.deadline-picker-btn .material-symbols-outlined { color: var(--accent); }

/* ========== Filters ========== */
.filter-chips, .filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.filter-chips::-webkit-scrollbar, .filter-tabs::-webkit-scrollbar { display: none; }
.filter-chip, .filter-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-chip .material-symbols-outlined,
.filter-tabs button .material-symbols-outlined { font-size: 16px; }
.filter-chip.active, .filter-tabs button.active {
  background: var(--gradient);
  color: var(--btn-text);
  border-color: transparent;
}

/* ========== Members ========== */
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.member-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--gradient-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
}
.member-row .name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-admin {
  font-size: 11px;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 700;
}
.member-row > .material-symbols-outlined { color: var(--text-dim); }

.invite-box {
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}
.invite-code {
  display: block;
  word-break: break-all;
  font-size: 12px;
  direction: ltr;
  text-align: left;
  background: var(--surface);
  padding: 12px;
  border-radius: 12px;
  color: var(--accent);
  border: 1px solid var(--border);
  margin-top: 8px;
}

/* ========== Requests ========== */
.request-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
}
.request-title {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.request-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}
.status-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}
.status-badge.pending { background: var(--warn-dim); color: var(--warn); }
.status-badge.approved { background: var(--success-dim); color: var(--success); }
.status-badge.rejected { background: var(--danger-dim); color: var(--danger); }

/* ========== Modal ========== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 8, 16, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: min(88dvh, 720px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-bottom: none;
  animation: sheetUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  position: relative;
}
@keyframes sheetUp {
  from { transform: translateY(40%); }
  to { transform: translateY(0); }
}
.modal-sheet::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 4px;
  margin: 0 auto 14px;
}
.modal-sheet h2 {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-sheet h2 .material-symbols-outlined { color: var(--accent); }
.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-dim);
}
.modal-close .material-symbols-outlined { font-size: 20px; }

/* Date picker */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-nav button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}
.cal-title { font-weight: 800; font-size: 15px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}
.cal-grid .dow {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 0;
  font-weight: 600;
}
.cal-grid .day {
  aspect-ratio: 1;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
}
.cal-grid .day:not(.empty):not(.disabled):active {
  background: var(--surface-2);
}
.cal-grid .day.today { border-color: var(--accent); color: var(--accent); }
.cal-grid .day.selected {
  background: var(--gradient);
  color: var(--btn-text);
  border-color: transparent;
}
.cal-grid .day.disabled { opacity: 0.3; }
.cal-grid .day.empty { pointer-events: none; }
.time-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.time-grid button {
  padding: 10px 4px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}
.time-grid button.selected {
  background: var(--gradient);
  color: var(--btn-text);
  border-color: transparent;
}

/* ========== Bottom nav ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 14px;
  color: var(--text-dim);
  position: relative;
  min-width: 0;
  transition: color 0.15s, background 0.15s;
}
.nav-btn .nav-ico {
  font-size: 24px !important;
  transition: transform 0.15s;
}
.nav-btn .nav-label {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.nav-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
}
.nav-btn.active .nav-ico {
  font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 20;
  transform: scale(1.05);
}
.nav-badge {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-14px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
}
body:not(.is-admin) .admin-only { display: none !important; }
body.is-admin .member-only { display: none !important; }

/* ========== Empty / loading ========== */
.empty-state, .loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty-state .material-symbols-outlined,
.loading .material-symbols-outlined {
  font-size: 40px !important;
  opacity: 0.5;
  color: var(--accent);
}
.loading .material-symbols-outlined {
  animation: spin 1.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== PTR ========== */
#ptr-indicator {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-48px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s, opacity 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
#ptr-indicator.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-version {
  position: fixed;
  bottom: calc(var(--nav-h) + 4px);
  left: 10px;
  z-index: 4;
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.35;
  pointer-events: none;
  direction: ltr;
}

/* Quick action row */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.quick-action {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.quick-action .qa-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 24px !important;
}
.quick-action span.label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

/* History items */
.history-item {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  margin-bottom: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.history-item .hi-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding-top: 8px;
}
.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 4px;
}
.chart-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 8px 8px 4px 4px;
  background: var(--gradient);
  min-height: 4px;
  transition: height 0.3s ease;
}
.chart-bar-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.chart-bar-label {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
}
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:active { transform: scale(0.98); }

.cal-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}
.cal-selected-date {
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cal-selected-date strong { color: var(--text); }
.cal-grid button.day {
  font-family: 'Vazirmatn', system-ui, sans-serif !important;
}
.hero-card { padding: 16px 14px; margin-bottom: 12px; border-radius: 18px; }
.hero-card .hero-title { font-size: 17px; }
.hero-card .hero-desc { font-size: 12px; }
.hero-steps { margin-top: 12px; gap: 6px; }
.hero-step { padding: 8px 6px; font-size: 10px; border-radius: 12px; }

/* Skeleton */
.skeleton-wrap { display: flex; flex-direction: column; gap: 10px; }
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.sk-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  margin-bottom: 8px;
}
.sk-line.w40 { width: 40%; }
.sk-line.w60 { width: 60%; }
.sk-line.w90 { width: 90%; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Tab enter */
main#content.tab-enter {
  animation: tabFade 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes tabFade {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.task-card.in-progress::before { background: var(--accent-2); opacity: 1; }
.chip.status-progress { background: var(--accent-dim); color: var(--accent); }
.chip.status-open { background: var(--surface-2); color: var(--text-dim); }

.confirm-sheet .confirm-msg {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 16px;
}
.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 12px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.check-item.is-done span { text-decoration: line-through; opacity: 0.6; }
.check-item input { width: 18px; height: 18px; accent-color: var(--accent); }
.check-item span { flex: 1; }
.row-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.row-actions input { flex: 1; }

.att-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.att-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  min-height: 72px;
}
.att-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}
.att-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
}
.att-del {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--danger-dim) !important;
  color: var(--danger) !important;
}

/* Focus a11y */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.nav-btn:focus-visible {
  outline-offset: -2px;
}
button:focus:not(:focus-visible) { outline: none; }

.btn-danger-text {
  background: var(--danger-dim) !important;
  color: var(--danger) !important;
  border-color: transparent !important;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.lightbox img {
  max-width: 100%;
  max-height: 90dvh;
  border-radius: 12px;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.2);
}
.att-img-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}
.att-img-btn img { width: 100%; height: 100px; object-fit: cover; display: block; }
.proxy-health {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  line-height: 1.45;
  word-break: break-word;
}
.proxy-health .material-symbols-outlined { flex-shrink: 0; }
.proxy-health.ok {
  background: var(--success-dim);
  color: var(--success);
}
.proxy-health.bad {
  background: var(--danger-dim);
  color: var(--danger);
}
.onboard-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.onboard-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.onboard-step .material-symbols-outlined { color: var(--accent); margin-top: 2px; }

.chip.pin-chip { background: var(--warn-dim); color: var(--warn); }
.chip.tag-chip { border: none; color: #fff !important; font-weight: 700; }
.chip.tag-chip.tag-red { background: #e11d48 !important; }
.chip.tag-chip.tag-orange { background: #ea580c !important; }
.chip.tag-chip.tag-yellow { background: #ca8a04 !important; color: #111 !important; }
.chip.tag-chip.tag-green { background: #059669 !important; }
.chip.tag-chip.tag-blue { background: #2563eb !important; }
.chip.tag-chip.tag-purple { background: #7c3aed !important; }
.tag-pill.selected { border: none !important; color: #fff !important; }
.tag-pill.tag-red.selected { background: #e11d48 !important; }
.tag-pill.tag-orange.selected { background: #ea580c !important; }
.tag-pill.tag-yellow.selected { background: #ca8a04 !important; color: #111 !important; }
.tag-pill.tag-green.selected { background: #059669 !important; }
.tag-pill.tag-blue.selected { background: #2563eb !important; }
.tag-pill.tag-purple.selected { background: #7c3aed !important; }
.comment-rx { display: flex; gap: 8px; margin-top: 8px; }
.rx-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}
.rx-btn.on { background: var(--accent-dim); color: var(--accent); border-color: transparent; }
body.focus-mode .nav-btn:not([data-tab="home"]):not([data-tab="mytasks"]):not([data-tab="propose"]) {
  display: none !important;
}
body.focus-mode.is-admin .nav-btn[data-tab="propose"] { display: none !important; }
body.focus-mode.is-admin .nav-btn[data-tab="new"] { display: flex !important; }
#focus-toggle.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: transparent;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.hint-dim { font-size: 12px; color: var(--text-dim); }
