/* ==========================================================================
   ROUTY — personal productivity dashboard
   Pure CSS (no JavaScript).

   • Theme:    the sun / moon radios (#theme-light / #theme-dark) switch the
               colour scheme through :root:has(...). Colours use light-dark().
   • Language: the #lang <select> switches Persian (RTL) / English (LTR).
               Text exists twice (.t-fa / .t-en); one of them is hidden.
   • Size:     everything is in rem and the root font-size grows with the
               viewport, so the dashboard fills big monitors instead of
               floating as a small card.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Local fonts (Vazirmatn for Persian, Inter for English) — no CDN
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Language-dependent switches (overridden for English below) */
  --dir: rtl;
  --flip: 1;            /* mirrors the "view all" arrow */
  --m-align: right;     /* text alignment of the mobile plan card */
  direction: var(--dir);

  /* Typography */
  --font-sans: "Vazirmatn", "Segoe UI", Tahoma, "Geeza Pro", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-en: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-body: var(--font-sans);

  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 26px;

  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-heavy: 800;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;

  /* Radii */
  --r-panel: 28px;
  --r-card: 20px;
  --r-control: 12px;
  --r-pill: 999px;

  /* Layout */
  --sidebar-w: 132px;
  --app-max: 100%;

  /* Surfaces */
  --page-bg:     light-dark(#dfeadf, #080b0c);
  --page-glow:   light-dark(#f3f9f3, #12231b);
  --panel-bg:    light-dark(#fbfdfb, #121618);
  --sidebar-bg:  light-dark(#f1f5f1, #171c1e);
  --surface:     light-dark(#ffffff, #1a1f22);
  --surface-tint:light-dark(#e9f4ea, #1d2a24);
  --border:      light-dark(#e4ebe5, #262d31);
  --divider:     light-dark(#edf1ed, #252c30);
  --hover:       light-dark(rgba(20, 60, 35, .06), rgba(255, 255, 255, .06));

  /* Text */
  --text:        light-dark(#13201a, #f3f6f4);
  --text-muted:  light-dark(#66756c, #9aa5a0);
  --nav-ink:     light-dark(#34443b, #d5ddd8);

  /* Brand green */
  --primary:         light-dark(#1f9d4f, #2fb35c);
  --grad-a:          light-dark(#44d17c, #47d37e);
  --grad-b:          light-dark(#17893f, #1f9a4a);
  --primary-soft:    light-dark(#cdebcd, #24a04b);
  --on-primary-soft: light-dark(#1b5a31, #ffffff);
  --primary-tint:    light-dark(rgba(31, 157, 79, .13), rgba(47, 179, 92, .18));
  --link:            light-dark(#1f8a47, #3ecb70);

  /* Hero */
  --hero-a:     light-dark(#e9f6ea, #0f3a26);
  --hero-b:     light-dark(#d1ead3, #13221b);
  --hero-arc:   light-dark(rgba(80, 185, 100, .20), rgba(60, 200, 110, .13));
  --hero-ring:  light-dark(rgba(31, 157, 79, .12), rgba(80, 220, 130, .16));
  --hero-track: light-dark(rgba(255, 255, 255, .75), rgba(255, 255, 255, .12));
  --bar-hero:   light-dark(#27a959, #3bcc70);

  /* Progress + checkbox */
  --track:        light-dark(#e6ede7, rgba(255, 255, 255, .10));
  --check-border: light-dark(#cbd5ce, #3a4448);
  --bar-green:    light-dark(#2cb35e, #3ccb6f);
  --bar-blue:     light-dark(#3b86e6, #3f8cf0);
  --bar-amber:    light-dark(#f6bd2a, #f4b92e);

  /* Tags */
  --tag-en-bg: light-dark(#e3edfb, #1d4632);
  --tag-en-fg: light-dark(#3a6db5, #86dfa4);
  --tag-ru-bg: light-dark(#eee5fa, #2b2b55);
  --tag-ru-fg: light-dark(#7b43b8, #a8a6f2);
  --tag-yt-bg: light-dark(#fde5e7, #4a2024);
  --tag-yt-fg: light-dark(#d03a47, #ff6c75);

  /* Theme toggle */
  --toggle-track: light-dark(#e1ebe2, #20272a);
  --sun-bg:       light-dark(#ffe08a, #4a3f1c);
  --sun-fg:       light-dark(#e08a00, #f7b731);
  --moon-bg:      light-dark(#1b2024, #0c0f10);
  --moon-fg:      #ffffff;
  --sun-ring:     light-dark(rgba(224, 138, 0, .55), rgba(247, 183, 49, .6));
  --moon-ring:    light-dark(rgba(20, 40, 30, .4), rgba(255, 255, 255, .65));

  /* Shadows */
  --shadow-card:  0 1px 2px light-dark(rgba(20, 50, 30, .05), rgba(0, 0, 0, .4)),
                  0 10px 26px -14px light-dark(rgba(20, 60, 35, .18), rgba(0, 0, 0, .6));
  --shadow-panel: 0 30px 80px -30px light-dark(rgba(25, 70, 40, .35), rgba(0, 0, 0, .8));
  --shadow-nav:   0 -10px 30px -18px light-dark(rgba(20, 60, 35, .35), rgba(0, 0, 0, .8));
}

/* Theme + language state (driven by the radios / select) */
:root:has(#theme-dark:checked) { color-scheme: dark; }

:root:has(#lang option[value="en"]:checked) {
  --dir: ltr;
  --flip: -1;
  --m-align: left;
}

/* Fluid size: the whole UI scales with the screen (rem-based) */
html { font-size: clamp(15px, .78vw + 5.5px, 22px); }

/* Language visibility */
.t-en { display: none; }
:root:has(#lang option[value="en"]:checked) .t-fa { display: none; }
:root:has(#lang option[value="en"]:checked) .t-en { display: inline; }

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[lang="en"] { --font-body: var(--font-en); }

body {
  margin: 0;
  min-height: 100dvh;
  display: block;
  padding: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 12% 4%, var(--page-glow), transparent 70%),
    radial-gradient(800px 500px at 92% 96%, var(--page-glow), transparent 70%),
    var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

.t-en, [lang="en"] { font-family: var(--font-en); }

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
hr { margin: 0; border: 0; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--flip { transform: scaleX(var(--flip)); }

/* --------------------------------------------------------------------------
   3. App shell
   -------------------------------------------------------------------------- */
.app {
  width: min(100%, var(--app-max));
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   4. Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  padding: var(--sp-5) var(--sp-3);
  background: var(--sidebar-bg);
  border-inline-end: 1px solid var(--border);
}

.avatar {
  display: block;
  width: 44px;
  height: 44px;
  align-self: center;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border);
}

.nav { display: flex; flex-direction: column; gap: 6px; }

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-control);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--nav-ink);
  transition: background-color .15s ease, color .15s ease;
}

.nav__item:hover { background: var(--hover); }

.nav__item.is-active {
  background: var(--primary-soft);
  color: var(--on-primary-soft);
  font-weight: var(--fw-semibold);
}

.nav__item.is-active .icon--home { fill: currentColor; }

.nav__divider { height: 1px; margin: 10px 6px; background: var(--divider); }

/* --------------------------------------------------------------------------
   5. Main column + top bar
   The main column keeps the reference's physical layout (controls right,
   date left, tasks left, goals right) in both languages; the text inside each
   card follows the active language direction.
   -------------------------------------------------------------------------- */
.main {
  direction: rtl;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 36px;
}

.topbar__controls { direction: rtl; display: flex; align-items: center; gap: var(--sp-3); }

.topbar__date {
  direction: var(--dir);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.topbar__date .icon { width: 18px; height: 18px; color: var(--text-muted); }

/* Mobile-only header items */
.topbar .topbar__brand,
.topbar .topbar__bell,
.topbar .topbar__avatar { display: none; }

/* Language selector — native <select>, styled as a pill */
.lang {
  position: relative;
  direction: var(--dir);
  display: inline-flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.lang:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }

.lang__select {
  appearance: none;
  -webkit-appearance: none;
  height: 100%;
  padding-block: 0;
  padding-inline: 12px 30px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  outline: none;
}
.lang__select option { background: var(--surface); color: var(--text); }

.lang .icon {
  position: absolute;
  inset-inline-end: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Sun / moon toggle */
.theme-toggle {
  position: relative;
  direction: ltr;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--toggle-track);
  box-shadow: inset 0 0 0 1px var(--border);
}

.theme-toggle__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
}
.theme-toggle__btn .icon { width: 15px; height: 15px; }
.theme-toggle__btn::after { content: ""; position: absolute; inset: -4px; }

.theme-toggle__btn--sun  { background: var(--sun-bg);  color: var(--sun-fg); }
.theme-toggle__btn--moon { background: var(--moon-bg); color: var(--moon-fg); }

#theme-light:checked + .theme-toggle__btn--sun  { box-shadow: 0 0 0 2px var(--sun-ring); }
#theme-dark:checked  + .theme-toggle__btn--moon { box-shadow: 0 0 0 2px var(--moon-ring); }
.theme-toggle input:focus-visible + .theme-toggle__btn { outline: 2px solid var(--primary); outline-offset: 2px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* --------------------------------------------------------------------------
   6. Hero — greeting + today's plan
   -------------------------------------------------------------------------- */
.hero { display: grid; }
.hero > * { grid-area: 1 / 1; }

.plan {
  position: relative;
  isolation: isolate;
  direction: ltr;                 /* badge on the left, as in the reference */
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: 132px;
  padding: var(--sp-5) var(--sp-6);
  border-radius: var(--r-card);
  background: linear-gradient(100deg, var(--hero-a), var(--hero-b));
  box-shadow: inset 0 0 0 1px var(--hero-ring);
  overflow: hidden;
}

.plan::before, .plan::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: var(--hero-arc);
  pointer-events: none;
}
.plan::before { width: 340px; height: 340px; right: 6%;   top: -130px; }
.plan::after  { width: 250px; height: 250px; right: -50px; bottom: -150px; }

.plan__badge {
  display: grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, var(--grad-a), var(--grad-b));
  box-shadow: 0 8px 18px -8px rgba(23, 137, 63, .7), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.plan__badge .icon { width: 30px; height: 30px; stroke-width: 3; }

.plan__body {
  direction: var(--dir);
  text-align: left;
  flex: 1;
  min-width: 0;
  max-width: 640px;
  margin-right: clamp(220px, 30%, 340px);   /* keeps clear of the greeting */
}
.plan__title { font-size: var(--fs-lg); font-weight: var(--fw-bold); line-height: 1.4; }
.plan__sub   { font-size: var(--fs-base); font-weight: var(--fw-medium); }

.plan .progress {
  --bar: var(--bar-hero);
  height: 7px;
  margin-top: var(--sp-3);
  background: var(--hero-track);
}

.greeting {
  z-index: 1;
  direction: var(--dir);
  text-align: right;
  align-self: start;
  justify-self: start;
  padding: var(--sp-5) var(--sp-6) 0;
}
.greeting__title { font-size: var(--fs-xl); font-weight: var(--fw-heavy); line-height: 1.3; }
.greeting__sub   { margin-top: 2px; font-size: var(--fs-sm); color: var(--text-muted); }

.plan__percent {
  z-index: 1;
  direction: var(--dir);
  text-align: right;
  align-self: end;
  justify-self: start;
  padding: 0 var(--sp-6) var(--sp-5);
  font-size: var(--fs-lg);
  font-weight: var(--fw-heavy);
}

/* --------------------------------------------------------------------------
   7. Dashboard grid + cards
   -------------------------------------------------------------------------- */
.dash {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, .66fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "goals tasks"
    "note  week";
  gap: var(--sp-4);
}
.tasks { grid-area: tasks; }
.goals { grid-area: goals; }
.week  { grid-area: week; }
.note  { grid-area: note; }

.card {
  direction: var(--dir);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: var(--sp-5);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.card__title { font-size: var(--fs-md); font-weight: var(--fw-bold); }

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--link);
}
.link .icon { width: 14px; height: 14px; }
.link--mobile { display: none; }

/* --------------------------------------------------------------------------
   8. Progress bars
   -------------------------------------------------------------------------- */
.progress {
  --value: 50%;
  --bar: var(--bar-green);
  direction: ltr;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--track);
  overflow: hidden;
}
.progress > span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: var(--bar);
}

/* --------------------------------------------------------------------------
   9. Tasks
   -------------------------------------------------------------------------- */
.tasks { display: flex; flex-direction: column; }
.tasks__list { flex: 1; display: flex; flex-direction: column; }

.task {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px 0;
  border-top: 1px solid var(--divider);
}

.task__label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 1;
  min-width: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  cursor: pointer;
}

.check {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid var(--check-border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.check:checked { background: var(--primary); border-color: var(--primary); }
.check:checked::after {
  content: "";
  width: 12px;
  height: 12px;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.check:checked + .task__title { color: var(--text-muted); }

.tag {
  flex: none;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.6;
  white-space: nowrap;
}
.tag--english { background: var(--tag-en-bg); color: var(--tag-en-fg); }
.tag--russian { background: var(--tag-ru-bg); color: var(--tag-ru-fg); }
.tag--youtube { background: var(--tag-yt-bg); color: var(--tag-yt-fg); }

.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 40px;
  margin-top: var(--sp-3);
  border-radius: var(--r-control);
  background: var(--primary-soft);
  color: var(--on-primary-soft);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  transition: filter .15s ease;
}
.btn-add:hover { filter: brightness(.97); }
.btn-add .icon { width: 18px; height: 18px; }

/* --------------------------------------------------------------------------
   10. Goals
   -------------------------------------------------------------------------- */
.goals { display: flex; flex-direction: column; }
.goals__list {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.goal {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: var(--sp-3);
  row-gap: 4px;
  padding: var(--sp-2) 0;
}

.flag {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 28px;
  height: 22px;
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(0, 0, 0, .06);
}

.goal__date {
  grid-column: 2;
  grid-row: 1 / 3;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.goal__title {
  grid-column: 3 / 5;
  grid-row: 1;
  justify-self: end;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}

.goal__bar { grid-column: 3; grid-row: 2; }

.goal__pct {
  grid-column: 4;
  grid-row: 2;
  justify-self: end;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   11. Weekly overview
   -------------------------------------------------------------------------- */
.week {
  direction: rtl;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "days title";
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
}
.week__title { grid-area: title; font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.week__days  { grid-area: days; direction: var(--dir); display: grid; grid-template-columns: repeat(7, 1fr); }

.day { display: grid; justify-items: center; gap: 6px; }
.day__name { font-size: var(--fs-base); font-weight: var(--fw-bold); line-height: 1.3; }
.day__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--check-border);
}
.day.is-done .day__dot {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}

/* --------------------------------------------------------------------------
   12. Note
   -------------------------------------------------------------------------- */
.note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: linear-gradient(120deg, var(--surface-tint), var(--surface));
}
.note__title { font-size: var(--fs-md); font-weight: var(--fw-bold); }
.note__body {
  margin-top: 4px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-tint);
  color: var(--link);
}
.note__icon .icon { width: 17px; height: 17px; }

/* ==========================================================================
   13. Responsive
   ========================================================================== */

/* ---- Compact desktop / tablet landscape: icon-only sidebar ---- */
@media (max-width: 1100px) {
  :root { --sidebar-w: 76px; }

  .main { padding: var(--sp-5); }
  .dash { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); }

  .sidebar { padding-inline: var(--sp-2); }
  .avatar  { width: 40px; height: 40px; }

  .nav__item { justify-content: center; padding: 0; min-height: 44px; }
  .nav__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .plan__body { margin-right: clamp(200px, 34%, 300px); }
}

/* ---- Mobile / portrait tablet: single column + bottom navigation ---- */
@media (max-width: 860px) {
  html { font-size: 100%; }          /* no fluid scaling on phones */

  body { display: block; padding: 0; }

  .app {
    display: block;
    width: 100%;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  /* Sidebar becomes a fixed bottom tab bar */
  .sidebar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 20;
    flex-direction: row;
    gap: 0;
    padding: 6px var(--sp-2) calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
    border: 0;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-nav);
  }
  .sidebar .avatar,
  .nav__divider,
  .nav__item--settings { display: none; }

  .nav { flex: 1; flex-direction: row; gap: 0; }
  .nav__item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 56px;
    padding: 6px 4px;
    font-size: var(--fs-xs);
    background: none;
  }
  .nav__item:hover { background: none; }
  .nav__item.is-active { background: none; color: var(--link); }
  .nav__label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
  }

  .main {
    max-width: none;
    margin-inline: 0;
    gap: var(--sp-4);
    padding: env(safe-area-inset-top) var(--sp-4) calc(92px + env(safe-area-inset-bottom));
  }
  .content { flex: none; }

  /* Header: avatar, bell, controls ... brand */
  .topbar { justify-content: flex-start; gap: var(--sp-2); padding: var(--sp-3) 0 0; }
  .topbar__date { display: none; }
  .topbar .topbar__avatar { display: block; order: 1; width: 38px; height: 38px; box-shadow: none; }
  .topbar .topbar__bell   { display: grid; order: 2; }
  .topbar__controls { order: 3; gap: var(--sp-2); }
  .topbar .topbar__brand {
    display: block;
    order: 4;
    margin-inline-start: auto;
    font-size: var(--fs-lg);
    font-weight: var(--fw-heavy);
    letter-spacing: .2px;
  }
  .lang { height: 36px; }
  .theme-toggle { height: 36px; }
  .theme-toggle__btn { width: 30px; height: 30px; }

  /* Hero: greeting above, compact plan card below */
  .hero { display: block; }
  .greeting { text-align: start; padding: 0; margin-bottom: var(--sp-3); }
  .greeting__title { font-size: 22px; }

  .plan { min-height: 0; padding: var(--sp-4); gap: var(--sp-4); }
  .plan::before { width: 220px; height: 220px; right: 20%; top: -110px; }
  .plan::after  { width: 160px; height: 160px; right: -40px; bottom: -90px; }
  .plan__badge { width: 46px; height: 46px; }
  .plan__badge .icon { width: 24px; height: 24px; }
  .plan__body { max-width: none; margin-right: 0; text-align: var(--m-align); }
  .plan__title { font-size: var(--fs-md); }
  .plan__sub { font-size: var(--fs-sm); }
  .plan .progress { height: 6px; margin-top: 10px; }
  .plan__percent { display: none; }

  /* Single column of cards */
  .dash {
    flex: none;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "tasks" "goals" "week" "note";
    gap: var(--sp-3);
  }
  .card { padding: var(--sp-4); }
  .link--mobile { display: inline-flex; }

  /* Touch-friendly rows and buttons */
  .task { flex: none; min-height: 52px; padding: 10px 0; }
  .check { width: 22px; height: 22px; }
  .btn-add { min-height: 48px; }

  .goal { padding: 10px 0; }

  .week { direction: var(--dir); grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "days"; gap: var(--sp-3); }
  .week__title { justify-self: start; }
  .day__dot { width: 16px; height: 16px; }

  .note { padding: var(--sp-4); }
}

/* ---- Small phones ---- */
@media (max-width: 400px) {
  .main { padding-inline: var(--sp-3); }
  .card { padding: var(--sp-3) var(--sp-4); }
  .goal { column-gap: var(--sp-2); }
  .greeting__title { font-size: 20px; }
  .tag { padding-inline: 10px; }
  .lang__select { padding-inline: 10px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
/* appended app styles */
.view { display:flex; flex-direction:column; gap: var(--sp-4); }
.view__head { display:flex; align-items:center; justify-content:space-between; gap: var(--sp-3); flex-wrap:wrap; }
.view__title { font-size: var(--fs-xl); font-weight: var(--fw-heavy); }
.view__split { display:grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.toolbar { display:flex; gap: var(--sp-3); flex-wrap:wrap; align-items:center; }
.input { padding: 0.5rem 0.75rem; border:1px solid var(--border); border-radius: var(--r-control); background: var(--surface); color: var(--text); font:inherit; min-height:2.25rem; }
.input:focus { outline:0.125rem solid var(--primary); }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:0.375rem; padding:0.5rem 1rem; border-radius: var(--r-control); font-weight:var(--fw-semibold); font-size:var(--fs-sm); cursor:pointer; border:1px solid var(--border); background:var(--surface); color:var(--text); transition:filter .15s; }
.btn:hover { filter:brightness(.97); }
.btn--primary { background:var(--primary); color:#fff; border-color:var(--primary); }
.btn--ghost { background:transparent; }
.btn--danger { background:#d03a47; color:#fff; border-color:#d03a47; }
.btn--sm { padding:0.3rem 0.6rem; font-size:var(--fs-xs); }
.btn--block { width:100%; }
.row { display:flex; align-items:center; }
.gap { gap: var(--sp-3); }
.meta { font-size:var(--fs-sm); color:var(--text-muted); }
.badge { padding:0.15rem 0.6rem; border-radius:var(--r-pill); font-size:var(--fs-xs); font-weight:var(--fw-semibold); background:var(--surface-tint); color:var(--text); }
.badge--high { background:var(--tag-yt-bg); color:var(--tag-yt-fg); }
.badge--med { background:var(--tag-en-bg); color:var(--tag-en-fg); }
.badge--low { background:var(--tag-ru-bg); color:var(--tag-ru-fg); }
.badge--active { background:var(--primary-tint); color:var(--link); }
.badge--completed { background:var(--surface-tint); color:var(--text-muted); }
.badge--paused, .badge--cancelled { background:var(--tag-yt-bg); color:var(--tag-yt-fg); }
.empty-state { text-align:center; padding: var(--sp-6); color:var(--text-muted); display:flex; flex-direction:column; gap:var(--sp-3); align-items:center; }
.cards-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(16rem,1fr)); gap: var(--sp-4); }
.item-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); padding:var(--sp-4); box-shadow:var(--shadow-card); display:flex; flex-direction:column; gap:var(--sp-3); }
.item-card__head { display:flex; align-items:center; justify-content:space-between; gap:var(--sp-2); }
.item-card__head h3 { font-size:var(--fs-md); font-weight:var(--fw-bold); }
.item-card__desc { font-size:var(--fs-sm); color:var(--text-muted); }
.item-card__meta { display:flex; justify-content:space-between; font-size:var(--fs-xs); color:var(--text-muted); flex-wrap:wrap; gap:var(--sp-2); }
.item-card__actions { display:flex; gap:var(--sp-2); justify-content:flex-end; }
.list { display:flex; flex-direction:column; gap:var(--sp-2); }
.task-row { display:flex; align-items:center; gap:var(--sp-3); padding:var(--sp-3); border:1px solid var(--border); border-radius:var(--r-control); background:var(--surface); }
.task-row.is-done .task-row__title { color:var(--text-muted); text-decoration:line-through; }
.task-row.is-overdue { border-color:#d03a47; }
.task-row__body { flex:1; min-width:0; }
.task-row__title { font-weight:var(--fw-medium); }
.task-row__meta { display:flex; gap:var(--sp-2); flex-wrap:wrap; margin-top:0.25rem; align-items:center; }
.task-row__actions { display:flex; gap:var(--sp-1); }
.note-row { display:flex; gap:var(--sp-3); padding:var(--sp-3); border:1px solid var(--border); border-radius:var(--r-control); background:var(--surface); }
.note-row__body { flex:1; min-width:0; }
.note-row__body h3 { font-size:var(--fs-md); font-weight:var(--fw-bold); }
.note-row__body p { font-size:var(--fs-sm); color:var(--text-muted); margin-top:0.25rem; white-space:pre-wrap; }
.search-row { display:flex; align-items:center; gap:var(--sp-3); padding:var(--sp-3); border:1px solid var(--border); border-radius:var(--r-control); background:var(--surface); cursor:pointer; }
.search-row:hover { background:var(--hover); }
.planner-grid { display:grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap:var(--sp-2); }
.day-col { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-control); padding:var(--sp-2); min-height:8rem; display:flex; flex-direction:column; gap:var(--sp-2); }
.day-col__title { font-size:var(--fs-xs); font-weight:var(--fw-bold); text-align:center; }
.day-col__tasks { flex:1; display:flex; flex-direction:column; gap:var(--sp-1); min-height:2rem; }
.task-chip { display:flex; align-items:center; justify-content:space-between; gap:var(--sp-1); padding:0.25rem 0.4rem; background:var(--surface-tint); border-radius:0.375rem; font-size:var(--fs-xs); cursor:grab; }
.task-chip.is-done { opacity:0.5; text-decoration:line-through; }
.simple-list { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:var(--sp-1); }
.simple-item { display:flex; align-items:center; justify-content:space-between; padding:0.3rem 0.5rem; background:var(--surface-tint); border-radius:0.375rem; font-size:var(--fs-sm); }
.habit-week { display:flex; gap:0.3rem; margin: var(--sp-2) 0; }
.habit-dot { width:0.75rem; height:0.75rem; border-radius:50%; border:1.5px solid var(--check-border); }
.habit-dot.is-done { background:var(--primary); border-color:var(--primary); }
.stats-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(10rem,1fr)); gap:var(--sp-4); margin-bottom:var(--sp-4); }
.stat-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); padding:var(--sp-5); text-align:center; box-shadow:var(--shadow-card); }
.stat-value { font-size:var(--fs-xl); font-weight:var(--fw-heavy); color:var(--primary); }
.stat-label { font-size:var(--fs-sm); color:var(--text-muted); margin-top:0.25rem; }
.bar-chart { display:flex; align-items:flex-end; gap:0.5rem; height:10rem; padding:var(--sp-3) 0; }
.bar-col { flex:1; display:flex; flex-direction:column; align-items:center; gap:0.25rem; height:100%; justify-content:flex-end; }
.bar { width:100%; background:var(--primary); border-radius:0.25rem 0.25rem 0 0; min-height:2px; transition:height .3s; }
.bar-label { font-size:var(--fs-xs); color:var(--text-muted); }
.goal-row { display:flex; align-items:center; gap:var(--sp-3); padding:var(--sp-2) 0; }
.goal-row span:first-child { flex:1; }
.seg { display:flex; gap:var(--sp-2); }
.seg__btn { padding:0.5rem 1rem; border:1px solid var(--border); border-radius:var(--r-control); background:var(--surface); cursor:pointer; font:inherit; }
.seg__btn.is-active { background:var(--primary-soft); color:var(--on-primary-soft); }
.auth-wrap { min-height:100dvh; display:grid; place-items:center; padding:var(--sp-4); }
.auth-card { width:min(26rem,100%); background:var(--panel-bg); border:1px solid var(--border); border-radius:var(--r-panel); padding:var(--sp-6); box-shadow:var(--shadow-panel); display:flex; flex-direction:column; gap:var(--sp-4); }
.auth-title { font-size:var(--fs-xl); font-weight:var(--fw-heavy); text-align:center; }
.auth-sub { font-size:var(--fs-xs); color:var(--text-muted); text-align:center; }
.auth-tabs { display:flex; gap:var(--sp-2); }
.auth-tab { flex:1; padding:0.5rem; border:1px solid var(--border); border-radius:var(--r-control); background:var(--surface); cursor:pointer; }
.auth-tab.is-active { background:var(--primary); color:#fff; border-color:var(--primary); }
.auth-form { display:flex; flex-direction:column; gap:var(--sp-3); }
.field { display:flex; flex-direction:column; gap:0.25rem; }
.field label { font-size:var(--fs-sm); font-weight:var(--fw-medium); }
.field input, .field textarea, .field select { padding:0.5rem 0.75rem; border:1px solid var(--border); border-radius:var(--r-control); background:var(--surface); color:var(--text); font:inherit; }
.field textarea { resize:vertical; min-height:4rem; }
.pass-wrap { position:relative; }
.pass-wrap input { width:100%; padding-inline-end:4rem; }
.pass-toggle { position:absolute; inset-inline-end:0.5rem; top:50%; transform:translateY(-50%); font-size:var(--fs-xs); color:var(--link); }
.auth-row { display:flex; align-items:center; justify-content:space-between; font-size:var(--fs-sm); }
.check-row { display:flex; align-items:center; gap:0.375rem; }
.auth-error { color:#d03a47; font-size:var(--fs-sm); min-height:1rem; }
.auth-switch { text-align:center; font-size:var(--fs-sm); color:var(--text-muted); }
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.5); display:grid; place-items:center; z-index:50; padding:var(--sp-4); }
.modal { width:min(32rem,100%); max-height:90dvh; overflow:auto; background:var(--panel-bg); border:1px solid var(--border); border-radius:var(--r-panel); padding:var(--sp-5); box-shadow:var(--shadow-panel); display:flex; flex-direction:column; gap:var(--sp-3); }
.modal--sm { width:min(22rem,100%); }
.modal__title { font-size:var(--fs-lg); font-weight:var(--fw-bold); }
.modal__msg { font-size:var(--fs-md); }
.modal__actions { display:flex; gap:var(--sp-2); justify-content:flex-end; margin-top:var(--sp-2); }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:var(--sp-3); }
.toast-container { position:fixed; bottom:1rem; inset-inline:1rem; display:flex; flex-direction:column; gap:0.5rem; z-index:60; pointer-events:none; }
.toast { padding:0.75rem 1rem; border-radius:var(--r-control); background:var(--surface); border:1px solid var(--border); box-shadow:var(--shadow-card); font-size:var(--fs-sm); pointer-events:auto; }
.toast--success { border-color:var(--primary); }
.toast--error { border-color:#d03a47; }
.toast--out { opacity:0; transform:translateY(0.5rem); transition:opacity .3s, transform .3s; }
.empty { color:var(--text-muted); padding:var(--sp-4); text-align:center; }
@media (max-width: 860px){
  .view__split { grid-template-columns:1fr; }
  .form-grid { grid-template-columns:1fr; }
  .planner-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sidebar .nav { overflow-x:auto; }
}
@media (max-width: 400px){
  .planner-grid { grid-template-columns: 1fr; }
}
/* mobile nav: hide some items, show more */
.nav__item--mobile-hide { }
.nav__item--more { display: none; }
@media (max-width: 860px) {
  .nav__item--mobile-hide { display: none; }
  .nav__item--more { display: flex; }
  .sidebar .nav { gap: 0; }
  .nav__item { min-height: 3.75rem; }
}
.more-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.more-item { padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--r-control); background: var(--surface); text-align: start; font: inherit; cursor: pointer; }
.more-item:hover { background: var(--hover); }
/* spacing fixes */
.hero { margin-bottom: var(--sp-4); }
.dash { gap: var(--sp-4); }
.view { gap: var(--sp-5); }
.card { margin-bottom: 0; }
@media (max-width: 860px) {
  .main { padding-inline: var(--sp-4); }
  .hero { margin-bottom: var(--sp-3); }
}
/* Modal & form improvements */
.modal { padding: var(--sp-6); gap: var(--sp-4); border-radius: var(--r-panel); }
.modal__title { font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.field { gap: var(--sp-2); }
.field label { font-weight: var(--fw-semibold); color: var(--text); }
.field input, .field textarea, .field select {
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-control);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
  outline: none;
}
.modal__actions { gap: var(--sp-3); padding-top: var(--sp-2); border-top: 1px solid var(--border); }
.btn { min-height: 2.5rem; }
@media (max-width: 860px) {
  .modal { width: 100%; max-height: 92dvh; padding: var(--sp-4); }
  .form-grid { grid-template-columns: 1fr; }
}
.view__sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 0.125rem; }
.goals-summary { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.summary-chip { display: flex; flex-direction: column; align-items: center; padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-control); min-width: 5rem; }
.summary-chip__val { font-size: var(--fs-lg); font-weight: var(--fw-heavy); color: var(--primary); }
.summary-chip__lbl { font-size: var(--fs-xs); color: var(--text-muted); }
.summary-chip--progress .summary-chip__val { color: var(--bar-blue); }
.goals-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.goal-row-card { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); transition: box-shadow .15s, transform .15s; }
.goal-row-card:hover { box-shadow: var(--shadow-panel); transform: translateY(-1px); }
.goal-row-card__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.goal-row-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.goal-row-card__title { font-size: var(--fs-md); font-weight: var(--fw-bold); }
.goal-row-card__meta { display: flex; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-muted); }
.goal-row-card__bar { height: 0.375rem; }
.goal-row-card__side { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.goal-row-card__pct { font-size: var(--fs-lg); font-weight: var(--fw-heavy); color: var(--primary); }
.goal-row-card__actions { display: flex; gap: var(--sp-1); }
.empty-state--goals { padding: var(--sp-8, 2rem); }
.empty-state__icon { width: 4rem; height: 4rem; border-radius: 50%; background: var(--primary-tint); color: var(--primary); display: grid; place-items: center; }
.modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.field--full { grid-column: 1 / -1; }
@media (max-width: 860px) {
  .goal-row-card { flex-direction: column; align-items: stretch; }
  .goal-row-card__side { flex-direction: row; justify-content: space-between; }
  .goals-summary { gap: var(--sp-2); }
  .summary-chip { min-width: 4rem; padding: var(--sp-2) var(--sp-3); }
}
.badge--repeat { background: var(--tag-ru-bg); color: var(--tag-ru-fg); }

/* task editor / modal polish */
body.modal-open { overflow: hidden; }
.modal-overlay { animation: modalFade .16s ease-out; }
.modal { animation: modalRise .2s cubic-bezier(.2,.8,.2,1); }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalRise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal__header { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.modal__header .icon-btn { flex: none; }
.modal__title { margin: 0; }
@media (max-width: 860px) {
  .modal-overlay { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 94dvh; border-radius: var(--r-panel) var(--r-panel) 0 0; padding: var(--sp-4) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom)); animation: sheetUp .22s cubic-bezier(.2,.8,.2,1); }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
  .modal__actions .btn { flex: 1; }
}
