@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #0a0b0d;
  --bg-2: #0f1114;
  --panel: rgba(255,255,255,0.035);
  --panel-solid: #15171b;
  --panel-2: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text: #ede9e2;
  --text-dim: #8b8880;
  --text-faint: #5a584f;
  --accent: #d99a5b;
  --accent-bright: #f0b374;
  --accent-soft: rgba(217, 154, 91, 0.14);
  --ok: #5fb3a3;
  --ok-soft: rgba(95, 179, 163, 0.14);
  --danger: #c76b5f;
  --danger-soft: rgba(199, 107, 95, 0.14);
  --warn: #d9a441;
  --warn-soft: rgba(217, 164, 65, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --font-body: 'Vazirmatn', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% -10%, rgba(217,154,91,0.08), transparent),
    radial-gradient(ellipse 500px 400px at 100% 20%, rgba(95,179,163,0.05), transparent),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  direction: rtl;
  min-height: 100vh;
  padding-bottom: 92px;
  -webkit-tap-highlight-color: transparent;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 22px 16px 24px; }

header.top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px;
}
header.top .greet { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
header.top .date {
  font-size: 12px; color: var(--text-dim); font-family: var(--font-mono);
  margin-top: 3px;
}
.streak-chip {
  display: flex; align-items: center; gap: 4px;
  background: var(--accent-soft); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
  color: var(--accent-bright); font-family: var(--font-mono);
}

.card {
  background: var(--panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  animation: rise 0.35s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.card h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin: 0 0 14px; font-weight: 700;
}

.prk-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--warn-soft); border: 1px solid rgba(217,164,65,0.3);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px;
  font-size: 12.5px; line-height: 1.6;
}
.prk-banner .icon { font-size: 18px; flex-shrink: 0; }
.prk-banner b { color: var(--warn); }

.water-row { display: flex; align-items: center; gap: 16px; }
.water-ring {
  width: 72px; height: 72px; border-radius: 50%; position: relative;
  background: conic-gradient(var(--accent-bright) calc(var(--pct, 0) * 1%), var(--panel-2) 0);
  flex-shrink: 0; transition: background 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.water-ring::after {
  content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--panel-solid);
}
.water-ring .ring-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; font-family: var(--font-mono); color: var(--accent-bright); z-index: 1;
}
.water-info { flex: 1; }
.water-amount { font-size: 24px; font-weight: 800; font-family: var(--font-mono); }
.water-goal { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.water-btns { display: flex; gap: 8px; margin-top: 14px; }
.water-btns button {
  flex: 1; padding: 11px 0; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px; font-size: 13px; cursor: pointer;
  font-family: var(--font-mono); font-weight: 600; transition: all 0.15s ease;
}
.water-btns button:active { transform: scale(0.95); background: var(--accent-soft); border-color: var(--accent); }

.timeline { position: relative; }
.t-item {
  display: flex; gap: 12px; padding: 13px 0;
  border-bottom: 1px solid var(--border);
  animation: rise 0.3s backwards;
}
.t-item:last-child { border-bottom: none; }
.t-time {
  width: 46px; flex-shrink: 0; font-size: 13px; font-weight: 700;
  font-family: var(--font-mono); color: var(--accent-bright); padding-top: 2px;
}
.t-dot-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.t-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex-shrink: 0; transition: all 0.3s ease; }
.t-item.status-done .t-dot { background: var(--ok); box-shadow: 0 0 8px var(--ok-soft); }
.t-item.status-skipped .t-dot { background: var(--text-faint); }
.t-item.is-now .t-dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,154,91,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(217,154,91,0); }
}
.t-body { flex: 1; min-width: 0; }
.t-title { font-size: 14px; font-weight: 700; }
.t-desc { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.6; }
.t-warn { font-size: 11.5px; color: var(--warn); margin-top: 5px; background: var(--warn-soft); padding: 5px 9px; border-radius: 8px; display: inline-block; }
.t-actions { display: flex; gap: 6px; margin-top: 9px; }
.t-actions button {
  padding: 6px 12px; font-size: 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); cursor: pointer; transition: all 0.15s ease;
  font-family: var(--font-body); font-weight: 600;
}
.t-actions button:active { transform: scale(0.94); }
.t-item.status-done .t-actions .done-btn { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.t-item.status-skipped .t-actions .skip-btn { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.t-item.status-done, .t-item.status-skipped { opacity: 0.5; }

.skeleton { background: linear-gradient(90deg, var(--panel-2) 25%, rgba(255,255,255,0.1) 37%, var(--panel-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; height: 14px; margin: 8px 0; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 11px 12px; font-size: 13.5px;
  font-family: var(--font-body); transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 54px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.days-picker { display: flex; gap: 4px; }
.days-picker button {
  flex: 1; padding: 9px 0; font-size: 11px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text-dim); cursor: pointer; transition: all 0.15s ease;
  font-family: var(--font-mono); font-weight: 700;
}
.days-picker button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-bright); }
.check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--text-dim); }
.check-row input { width: 18px; height: 18px; }

.btn-primary {
  width: 100%; padding: 13px 0; background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: #1a1208; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 800;
  cursor: pointer; margin-top: 4px; transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 16px rgba(217,154,91,0.2);
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  width: 100%; padding: 11px 0; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; cursor: pointer;
}

.sched-list { display: flex; flex-direction: column; gap: 8px; }
.sched-row {
  display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--panel-2);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.sched-row .sr-time { font-family: var(--font-mono); font-weight: 700; color: var(--accent-bright); width: 44px; font-size: 13px; }
.sched-row .sr-info { flex: 1; min-width: 0; }
.sched-row .sr-title { font-size: 13px; font-weight: 700; }
.sched-row .sr-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.sched-row .sr-actions { display: flex; gap: 4px; }
.sched-row .sr-actions button { background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 15px; padding: 4px; }
.sched-row.inactive { opacity: 0.4; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around; padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  background: rgba(10,11,13,0.85); backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  font-size: 10.5px; font-family: var(--font-body); font-weight: 700; padding: 4px 10px;
  transition: color 0.2s ease;
}
.nav-btn .nav-icon { font-size: 19px; transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1); }
.nav-btn.active { color: var(--accent-bright); }
.nav-btn.active .nav-icon { transform: translateY(-2px) scale(1.1); }

.fab {
  position: fixed; bottom: 84px; left: 18px; z-index: 40;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  border: none; color: #1a1208; font-size: 22px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(217,154,91,0.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.fab:active { transform: scale(0.9); }

.view { display: none; animation: fadeSlide 0.28s cubic-bezier(0.16,1,0.3,1); }
.view.active { display: block; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.empty { text-align: center; color: var(--text-dim); font-size: 13px; padding: 30px 0; }

.toast-wrap { position: fixed; bottom: 100px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast {
  background: var(--panel-solid); border: 1px solid var(--border-strong); color: var(--text);
  padding: 11px 18px; border-radius: 30px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }

.chat-wrap { display: flex; flex-direction: column; gap: 10px; min-height: 300px; }
.msg { max-width: 85%; padding: 11px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.7; animation: rise 0.25s backwards; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid rgba(217,154,91,0.25); border-bottom-left-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-right-radius: 4px; }
.msg.ai::before { content: '🤖 '; }
.typing-dots { display: flex; gap: 4px; padding: 6px 0; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); animation: bounce 1.2s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat-input-row { display: flex; gap: 8px; position: sticky; bottom: 0; padding-top: 10px; }
.chat-input-row input {
  flex: 1; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 24px; padding: 12px 16px; font-size: 13.5px; font-family: var(--font-body);
}
.chat-input-row input:focus { outline: none; border-color: var(--accent); }
.chat-send {
  width: 44px; height: 44px; border-radius: 50%; border: none; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #1a1208;
  font-size: 17px; cursor: pointer;
}
.chat-suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chat-suggestions button {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-dim);
  padding: 7px 12px; border-radius: 20px; font-size: 11.5px; cursor: pointer; font-family: var(--font-body);
}

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.stat-box .stat-val { font-size: 22px; font-weight: 800; font-family: var(--font-mono); color: var(--accent-bright); }
.stat-box .stat-label { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
canvas { max-width: 100%; }

.site-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.site-btn {
  padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font-size: 12.5px; cursor: pointer; text-align: center; font-weight: 600;
  transition: all 0.15s ease;
}
.site-btn.suggested { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-bright); }
.site-btn.suggested::after { content: ' ★'; }

.pw-gate {
  position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center;
  justify-content: center; z-index: 200; padding: 20px;
}
.pw-gate .card { width: 100%; max-width: 320px; }

.install-hint {
  font-size: 11.5px; color: var(--text-dim); line-height: 1.7; margin-top: 8px;
}
