:root {
  --navy: #0f2a4a;
  --navy2: #143a63;
  --blue: #1e5aa8;
  --teal: #0d9488;
  --teal2: #14b8a6;
  --cyan: #06b6d4;
  --ink: #0f1e33;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #eef4f9;
  --white: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(20,184,166,.14), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(30,90,168,.12), transparent 45%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.app-shell { max-width: 1080px; margin: 0 auto; padding: 0 14px 40px; }

/* Header */
.header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; margin: 14px 0 10px;
  background: linear-gradient(120deg, var(--navy), var(--blue));
  border-radius: 18px; color: #fff;
  box-shadow: 0 8px 24px rgba(15,42,74,.22);
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.berry { font-size: 22px; }
.header-title { font-weight: 800; font-size: 20px; letter-spacing: -.5px; }
.track-badge {
  background: rgba(255,255,255,.18); padding: 4px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; backdrop-filter: blur(4px);
}
.header-actions { display: flex; gap: 8px; }
.ghostbtn {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px; width: 38px; height: 38px; font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: .2s;
}
.ghostbtn:hover { background: rgba(255,255,255,.28); }
.ghostbtn.wide { width: auto; padding: 0 16px; }

/* Nav */
.topnav {
  display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap;
}
.navbtn {
  flex: 1; min-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 6px; border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 14px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600;
  transition: .2s;
}
.navbtn span:first-child { font-size: 18px; }
.navbtn:hover { border-color: var(--teal2); color: var(--teal); }
.navbtn-active {
  background: linear-gradient(120deg, var(--teal), var(--cyan)); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px rgba(13,148,136,.35);
}

/* Cards */
.card { border-radius: 18px; padding: 18px; margin-bottom: 16px; }
.white-card { background: var(--white); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(15,42,74,.06); }
.card-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 12px; font-size: 15px; }

/* Dashboard hero */
.dash-hero {
  background: linear-gradient(130deg, var(--teal) 0%, var(--cyan) 55%, #22d3ee 100%);
  border-radius: 20px; padding: 24px; color: #fff; margin-bottom: 16px;
  box-shadow: 0 12px 30px rgba(13,148,136,.30);
  position: relative; overflow: hidden;
}
.dash-hero::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 12px, transparent 12px 24px);
  pointer-events: none;
}
.hero-quote { font-size: 15px; font-weight: 600; opacity: .95; margin-bottom: 14px; }
.countdown { display: flex; align-items: baseline; gap: 10px; }
.cd-num { font-size: 56px; font-weight: 900; line-height: 1; text-shadow: 0 3px 10px rgba(0,0,0,.2); }
.cd-label { font-size: 15px; font-weight: 600; }
.cd-empty { font-size: 15px; font-weight: 600; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: 0 4px 14px rgba(15,42,74,.06); text-align: center;
}
.stat-icon { font-size: 26px; }
.stat-value { font-size: 22px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.ring-card { justify-content: center; }

/* Subject progress rows */
.subj-progress { display: flex; flex-direction: column; gap: 12px; }
.sp-row { display: grid; grid-template-columns: 1fr 100px 42px; align-items: center; gap: 10px; }
.sp-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.sp-cd { font-size: 11px; color: var(--muted); background: #f1f5f9; padding: 1px 8px; border-radius: 999px; }
.sp-bar { height: 9px; background: #edf2f7; border-radius: 999px; overflow: hidden; }
.sp-fill { height: 100%; border-radius: 999px; transition: width .5s ease; }
.sp-pct { font-size: 12px; font-weight: 700; color: var(--muted); }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Mini list */
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mini-item { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px 10px; background: #f8fafc; border-radius: 10px; }
.mini-tag { margin-inline-start: auto; font-size: 11px; color: var(--muted); background: #eef2f7; padding: 1px 8px; border-radius: 999px; }
.done { text-decoration: line-through; opacity: .5; }
.empty-hint { color: var(--muted); font-size: 13px; padding: 8px 4px; }

/* Section */
.section-title { font-size: 20px; font-weight: 800; margin: 6px 4px 14px; }
.section { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Inputs */
.txt {
  font-family: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  font-size: 14px; width: 100%; background: #fff; color: var(--ink); outline: none;
}
.txt:focus { border-color: var(--teal2); box-shadow: 0 0 0 3px rgba(20,184,166,.15); }
.txt.small { padding: 7px 8px; font-size: 13px; }
.primarybtn {
  background: linear-gradient(120deg, var(--blue), var(--navy)); color: #fff; border: none;
  border-radius: 10px; padding: 10px 20px; font-family: inherit; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: .2s; white-space: nowrap;
}
.primarybtn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(30,90,168,.35); }
.linkbtn { background: none; border: none; color: var(--teal); font-family: inherit; font-weight: 700; cursor: pointer; font-size: 13px; }
.linkbtn.small { font-size: 12px; }

.add-row { display: flex; gap: 10px; align-items: center; }
.add-row .txt { flex: 1; }

/* Subject cards */
.subj-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.subj-card { border-top: 4px solid var(--teal); }
.subj-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.subj-name-wrap { display: flex; align-items: center; gap: 8px; flex: 1; }
.subj-name-input { font-family: inherit; font-weight: 700; font-size: 15px; border: none; background: transparent; width: 100%; outline: none; color: var(--ink); }
.subj-name-input:focus { border-bottom: 2px solid var(--teal2); }
.del { background: #fef2f2; color: #ef4444; border: none; border-radius: 8px; width: 28px; height: 28px; font-size: 18px; cursor: pointer; line-height: 1; }
.subj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.subj-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.subj-foot .sp-bar { flex: 1; }
.cd-pill { font-size: 11px; font-weight: 700; background: #ecfeff; color: var(--teal); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.cd-pill.soon { background: #fff7ed; color: #ea580c; }
.cd-pill.past { background: #f1f5f9; color: var(--muted); }

/* Jalali date input */
.jdate { display: flex; gap: 5px; align-items: center; }
.jdate .txt { flex: 1; }
.clearx { background: #f1f5f9; border: none; border-radius: 8px; width: 30px; height: 34px; cursor: pointer; color: var(--muted); font-size: 16px; }

/* Planner */
.planner-ctl .muted { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.gen-msg { margin-top: 12px; background: #ecfdf5; color: #047857; padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.day-block { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.day-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--navy); }
.day-off { font-size: 11px; color: var(--muted); font-weight: 600; }
.task-row { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 5px 0; cursor: pointer; }
.task-row input { accent-color: var(--teal); width: 16px; height: 16px; }

/* Calendar */
.cal-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.cal-month { font-weight: 800; font-size: 17px; color: var(--navy); }
.navarrow { background: #f1f5f9; border: none; border-radius: 10px; width: 36px; height: 36px; font-size: 20px; cursor: pointer; color: var(--navy); }
.navarrow:hover { background: var(--teal2); color: #fff; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-weekdays { margin-bottom: 6px; }
.wd { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 5px 2px; cursor: pointer; font-family: inherit; position: relative; transition: .15s;
}
.cal-cell:hover { border-color: var(--teal2); }
.cal-cell.empty { border: none; background: transparent; cursor: default; }
.cal-cell .cn { font-size: 14px; font-weight: 700; }
.cal-cell.today { background: #ecfeff; border-color: var(--teal2); }
.cal-cell.sel { background: linear-gradient(120deg, var(--teal), var(--cyan)); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(13,148,136,.35); }
.cal-cell.exam { border-color: #f43f5e; }
.cal-marks { display: flex; gap: 2px; margin-top: auto; align-items: center; flex-wrap: wrap; justify-content: center; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; }
.exam-flag { color: #f43f5e; font-size: 11px; }
.cal-cell.sel .exam-flag { color: #fff; }
.cal-side { position: sticky; top: 14px; }
.exam-note { background: #fff1f2; color: #e11d48; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }

/* Track picker */
.picker-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(20,184,166,.25), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(30,90,168,.25), transparent 45%),
    linear-gradient(160deg, #0f2a4a, #143a63);
}
.picker-inner { text-align: center; max-width: 720px; width: 100%; }
.brandmark { font-size: 40px; font-weight: 900; color: #fff; display: flex; align-items: center; justify-content: center; gap: 12px; }
.brandmark .berry { font-size: 44px; }
.picker-sub { color: #cbd5e1; font-size: 16px; margin: 10px 0 30px; }
.track-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.track-card {
  background: #fff; border: none; border-radius: 20px; padding: 28px 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-family: inherit;
  transition: .25s; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.track-card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(13,148,136,.4); }
.track-icon { font-size: 44px; }
.track-label { font-size: 20px; font-weight: 800; color: var(--navy); }
.track-desc { font-size: 13px; color: var(--muted); }
.picker-inner .linkbtn { color: #cbd5e1; margin-top: 22px; }

/* Footer */
.footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 6px 0; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); margin-top: 10px;
}
.footer a { color: var(--teal); font-weight: 700; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 720px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .subj-cards { grid-template-columns: 1fr; }
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; }
  .cd-num { font-size: 44px; }
  .navbtn { min-width: 0; }
  .navbtn span:last-child { font-size: 11px; }
  .track-grid { grid-template-columns: 1fr; }
}