/* ─────────────────────────────────────────────────────────────
   بَرَكة — التصميم
   بنفسجي بَرَكة (غامق وفاتح) + Alexandria و IBM Plex Sans Arabic
   ───────────────────────────────────────────────────────────── */

:root {
  /* ── الوضع الغامق (الافتراضي) ── */
  color-scheme: dark;
  --bg: #0e1016;
  --deep: #12141b;
  --panel: #171a22;
  --raised: #20242e;
  --line: #2b303c;
  --ink: #eceef4;
  --ink-2: #c4c8d4;
  --muted: #8d93a4;

  /* خانات الكتابة */
  --field: #1c2029;
  --field-ink: #eceef4;
  --field-line: #343a48;
  --field-hover: #222733;
  --field-focus: #252a37;
  --field-ph: #727889;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23c4c8d4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  /* الباليتة: نيلي هادي + كهرماني للمكافآت */
  --accent: #6366f1;
  --accent-2: #8b93f8;
  --accent-soft: #262a4d;
  --accent-ink: #c7cdfe;
  --on-accent: #ffffff;
  --hl: #a5adfb;
  --hl-ink: #12141b;
  --hero: linear-gradient(135deg, #3f3a9e 0%, #2b2d6b 55%, #1b1d33 100%);
  --hero-ink: #ffffff;
  --gold: #f0b429;
  --blue: #4ea8de;
  --green: #4cc38a;
  --pink: #e879a6;
  --red: #ef5d6c;
  --amber: #f0a43c;
  --lime: #a3c94a;

  /* ألوان كلام فاتحة فوق الخلفية الغامقة */
  --t-red: #ffb1b9;
  --t-green: #8fe3b8;
  --t-amber: #ffd591;
  --t-blue: #a9d8f5;
  --t-gold: #f7d47c;

  --scrim: rgb(6 7 12 / 0.7);
  --shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.3);

  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;

  --font: 'Cairo', 'Segoe UI', Tahoma, 'Noto Sans Arabic', system-ui, sans-serif;
  --sidebar: 244px;
  --gutter: clamp(16px, 3vw, 32px);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-2);
}

/* ── الوضع الفاتح (بيمشي مع الجهاز، أو تختاره من الزرار) ── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --bg: #f5f6fa;
    --deep: #eceef5;
    --panel: #ffffff;
    --raised: #eef0f6;
    --line: #e0e3ec;
    --ink: #171a23;
    --ink-2: #3b4050;
    --muted: #686e80;
    --field: #f8f9fc;
    --field-ink: #171a23;
    --field-line: #d5d9e4;
    --field-hover: #f1f3f9;
    --field-focus: #ffffff;
    --field-ph: #9399aa;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%233b4050' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --accent: #4f46e5;
    --accent-2: #6366f1;
    --accent-soft: #eceefe;
    --accent-ink: #3730a3;
    --on-accent: #ffffff;
    --hl: #4f46e5;
    --hl-ink: #ffffff;
    --hero: linear-gradient(135deg, #eef0ff 0%, #e2e5ff 50%, #d3d7fd 100%);
    --hero-ink: #171a23;
    --gold: #b7791f;
    --blue: #1f7fb8;
    --green: #2f9e6b;
    --pink: #c4507e;
    --red: #d33a4a;
    --amber: #c27a12;
    --lime: #6f9a1c;
    --t-red: #b42332;
    --t-green: #1d7a50;
    --t-amber: #965a00;
    --t-blue: #155f8c;
    --t-gold: #8a5a10;
    --scrim: rgb(23 26 35 / 0.4);
    --shadow: 0 10px 30px rgb(30 35 60 / 0.1);
    --shadow-sm: 0 1px 3px rgb(30 35 60 / 0.08);
  }
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f5f6fa;
  --deep: #eceef5;
  --panel: #ffffff;
  --raised: #eef0f6;
  --line: #e0e3ec;
  --ink: #171a23;
  --ink-2: #3b4050;
  --muted: #686e80;
  --field: #f8f9fc;
  --field-ink: #171a23;
  --field-line: #d5d9e4;
  --field-hover: #f1f3f9;
  --field-focus: #ffffff;
  --field-ph: #9399aa;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%233b4050' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #eceefe;
  --accent-ink: #3730a3;
  --on-accent: #ffffff;
  --hl: #4f46e5;
  --hl-ink: #ffffff;
  --hero: linear-gradient(135deg, #eef0ff 0%, #e2e5ff 50%, #d3d7fd 100%);
  --hero-ink: #171a23;
  --gold: #b7791f;
  --blue: #1f7fb8;
  --green: #2f9e6b;
  --pink: #c4507e;
  --red: #d33a4a;
  --amber: #c27a12;
  --lime: #6f9a1c;
  --t-red: #b42332;
  --t-green: #1d7a50;
  --t-amber: #965a00;
  --t-blue: #155f8c;
  --t-gold: #8a5a10;
  --scrim: rgb(23 26 35 / 0.4);
  --shadow: 0 10px 30px rgb(30 35 60 / 0.1);
  --shadow-sm: 0 1px 3px rgb(30 35 60 / 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--raised) var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.35;
  font-weight: 800;
}
h1 {
  font-size: clamp(24px, 3.2vw, 32px);
}
h2 {
  font-size: 18px;
  font-weight: 700;
}
h3 {
  font-size: 15px;
  font-weight: 700;
}
p {
  margin: 0;
}
a {
  color: inherit;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.sr-only {
  position: absolute;
  top: 0;
  margin: -1px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13.5px;
}
.link {
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.link:hover {
  color: var(--ink);
}
.icon {
  flex: none;
  display: block;
}

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 100;
  background: var(--hl);
  color: var(--hl-ink);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-weight: 700;
}
.skip-link:focus {
  top: 12px;
}

/* ── الإطار العام ─────────────────────────────────────────── */
body[data-layout='app'] #app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 14px 16px;
  background: var(--deep);
  border-inline-end: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}
.brand-lg {
  font-size: 34px;
  gap: 14px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-2 {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 600;
}
.nav-link:hover {
  background: var(--panel);
  color: var(--ink);
}
.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: inset -3px 0 0 var(--accent-2);
}
.nav-link.is-active .icon {
  color: var(--accent-2);
}

.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
}
.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}
.who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.35;
}
.who b,
.who small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.who small {
  color: var(--muted);
  font-size: 12px;
  direction: ltr;
  text-align: end;
}

.main:focus-visible,
.auth-main:focus-visible {
  box-shadow: none;
}
.main {
  padding: 30px var(--gutter) 60px;
  max-width: 1320px;
  width: 100%;
  outline: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar,
.bottom-nav,
.scrim,
.icon-btn.only-mobile {
  display: none;
}

/* ── رأس الصفحة ───────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
  padding-bottom: 4px;
}
.lede {
  color: var(--muted);
  margin-top: 4px;
  max-width: 62ch;
}
.lede a {
  color: var(--hl);
}
.page-head-aside {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── الكروت ───────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-head .muted {
  font-size: 13.5px;
}
.card > .muted + * {
  margin-top: 12px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

/* ── الأرقام (KPIs) ───────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.kpi {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  min-width: 0;
}
.kpi::before {
  content: '';
  position: absolute;
  inset-block: 14px;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--c);
}
.kpi-label {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.kpi-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.25;
}
.kpi-text {
  display: block;
  font-size: 17px;
  line-height: 1.5;
  padding-top: 6px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.kpi-sub {
  color: var(--muted);
  font-size: 13px;
}
.kpi .meter {
  margin-top: 8px;
}

/* ── الأزرار والخانات ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 18px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  filter: brightness(1.1);
}
.btn-ghost {
  background: var(--raised);
  color: var(--ink);
}
.btn-danger {
  background: var(--red);
}
.btn-lg {
  min-height: 52px;
  padding: 10px 22px;
  font-size: 16.5px;
}
.btn-block {
  width: 100%;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover:not(:disabled) {
  background: var(--raised);
  color: var(--ink);
}
.icon-btn-sm {
  width: 32px;
  height: 32px;
}
.icon-btn.danger:hover {
  color: var(--red);
}
.linklike {
  border: 0;
  background: none;
  padding: 0;
  color: var(--hl);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* خانات الكتابة */
.write {
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid var(--field-line);
  border-radius: var(--r-sm);
  background: var(--field);
  color: var(--field-ink);
  font-weight: 600;
  width: 100%;
  min-width: 0;
}
.write::placeholder {
  color: var(--field-ph);
  font-weight: 400;
}
.write:hover {
  background: var(--field-hover);
  border-color: color-mix(in oklab, var(--accent) 35%, var(--field-line));
}
.write:focus-visible,
.write:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
  background: var(--field-focus);
}
select.write {
  appearance: none;
  padding-inline-end: 34px;
  background-image: var(--select-arrow);
  background-position: left 12px center;
  background-size: 12px 8px;
  background-repeat: no-repeat;
  cursor: pointer;
}
input[type='date'].write {
  direction: ltr;
  text-align: right;
}
.w-num {
  width: 90px;
  text-align: center;
}
input[type='number'] {
  -moz-appearance: textfield;
}
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > span {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.field-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.hint {
  color: var(--muted);
  font-size: 12.5px;
}
.form-error {
  color: var(--t-red);
  font-weight: 600;
}
.picker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink-2);
}
.picker .write {
  width: auto;
  min-width: 140px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-soon {
  background: color-mix(in oklab, var(--amber) 22%, var(--raised));
  color: var(--t-amber);
}
.chip-late {
  background: color-mix(in oklab, var(--red) 25%, var(--raised));
  color: var(--t-red);
}
.chip-ok {
  background: color-mix(in oklab, var(--green) 25%, var(--raised));
  color: var(--t-green);
}

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: var(--r-md);
  background: var(--deep);
  border: 1px solid var(--line);
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 16px;
  border-radius: var(--r-sm);
  font-weight: 700;
  color: var(--muted);
}
.segmented button[aria-selected='true'] {
  background: var(--raised);
  color: var(--ink);
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.chip-btn {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 5px 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.chip-btn b {
  color: var(--muted);
  margin-inline-start: 4px;
}
.chip-btn[aria-pressed='true'] {
  background: var(--raised);
  border-color: var(--raised);
  color: var(--ink);
}

/* ── الشهور ───────────────────────────────────────────────── */
.month-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.month-tabs a {
  flex: none;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--line);
}
.month-tabs a:hover {
  background: var(--panel);
}
.month-tabs a.is-active {
  background: var(--hl);
  border-color: var(--hl);
  color: var(--hl-ink);
}

/* ── أشرطة التقدم والحلقات ────────────────────────────────── */
.meter {
  height: 8px;
  border-radius: 999px;
  background: var(--raised);
  overflow: hidden;
  min-width: 40px;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--c);
  transition: width 0.35s ease;
}
.ring {
  position: relative;
  width: var(--size);
  height: var(--size);
  flex: none;
}
.ring svg {
  display: block;
}
.ring svg circle {
  transition: stroke-dasharray 0.4s ease;
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  text-align: center;
}
.ring-label b {
  font-size: calc(var(--size) * 0.22);
  font-weight: 800;
}
.ring-label small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── الرسومات ─────────────────────────────────────────────── */
.chart-title {
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 600;
  margin: 6px 0 8px;
}
.chart-title + .chart {
  margin-bottom: 12px;
}
.chart {
  container-type: inline-size;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: var(--h) auto;
}
.chart-y {
  position: relative;
  font-size: 11.5px;
  color: var(--muted);
}
.chart-y span {
  position: absolute;
  inset-inline-start: 0;
  transform: translateY(50%);
  line-height: 1;
}
.chart-plot {
  position: relative;
  border-bottom: 1px solid var(--line);
}
.chart-grid i {
  position: absolute;
  inset-inline: 0;
  height: 1px;
  background: color-mix(in oklab, var(--line) 60%, transparent);
}
.chart-cols {
  position: absolute;
  inset: 0;
  display: flex;
}
.chart .col {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
}
.chart .col:hover {
  background: color-mix(in oklab, var(--ink) 5%, transparent);
}
.chart .bar {
  width: min(64%, 20px);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--c);
  transition: height 0.3s ease;
}
.chart .col.is-hl .bar {
  background: var(--hl);
}
.chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.chart-svg .line {
  fill: none;
  stroke: var(--c);
  stroke-width: 2px;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-svg .area {
  fill: color-mix(in oklab, var(--c) 18%, transparent);
  stroke: none;
}
.chart .dot {
  position: absolute;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: 0 0 -4px -4px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 2px var(--panel);
}
.chart .col.is-hl .dot {
  background: var(--hl);
}
.chart.is-line .col:hover::before {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 50%;
  width: 1px;
  background: var(--muted);
  opacity: 0.5;
}
.chart .col:hover .dot {
  width: 12px;
  height: 12px;
  margin: 0 0 -6px -6px;
}
.chart-x {
  grid-column: 2;
  display: flex;
  font-size: 11.5px;
  color: var(--muted);
  padding-top: 6px;
}
.chart-x span {
  flex: 1 1 0;
  text-align: center;
  min-width: 0;
  white-space: nowrap;
}
.chart-x span.is-hl {
  color: var(--hl);
  font-weight: 700;
}
/* الرسومات الضيقة: نخفي نص رقم ونسيب رقم عشان الأرقام متدخلش في بعض */
@container (max-width: 640px) {
  .chart-x span:nth-child(even):not(.is-hl),
  .chart-x span:has(+ .is-hl),
  .chart-x span.is-hl + span {
    visibility: hidden;
  }
}

/* ── صفحة «اليوم» ─────────────────────────────────────────── */
.today-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: center;
}
.today-score {
  display: flex;
  align-items: center;
  gap: 24px;
}
.today-score h2 {
  font-size: 20px;
  line-height: 1.5;
}
.facts {
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
}
.facts div {
  display: flex;
  gap: 8px;
  font-size: 14.5px;
}
.facts dt {
  color: var(--muted);
  min-width: 88px;
}
.facts dd {
  margin: 0;
  font-weight: 700;
}
.mosaic-block h3 {
  color: var(--ink-2);
  margin-bottom: 10px;
}
.mosaic {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 380px;
}
.tile {
  aspect-ratio: 1;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  color: color-mix(in oklab, var(--ink) 75%, transparent);
  background: var(--raised);
}
.lv0 {
  background: var(--raised);
}
.lv1 {
  background: color-mix(in oklab, var(--accent) 35%, var(--raised));
}
.lv2 {
  background: color-mix(in oklab, var(--accent) 60%, var(--raised));
}
.lv3 {
  background: color-mix(in oklab, var(--accent) 82%, var(--raised));
}
.lv4 {
  background: var(--accent);
  color: #fff;
}
.lvx {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
}
.tile.is-today {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--hl);
}
.mosaic-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.mosaic-legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.habit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.habit-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--deep);
  text-align: start;
}
.habit-toggle:hover {
  border-color: color-mix(in oklab, var(--c) 55%, transparent);
}
.habit-toggle .box {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--raised);
  color: transparent;
  transition: background 0.15s ease;
}
.habit-toggle.is-on .box {
  background: var(--c);
  color: #fff;
}
.habit-toggle.is-on {
  background: color-mix(in oklab, var(--c) 14%, var(--deep));
}
.habit-name {
  flex: 1;
  font-weight: 600;
  min-width: 0;
}
.habit-toggle.is-on .habit-name {
  color: var(--ink);
}
.habit-count {
  font-size: 13px;
  color: var(--muted);
  direction: ltr;
}

.scale {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}
.scale button {
  min-height: 38px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--raised);
  font-weight: 700;
  color: var(--ink-2);
}
.scale button:hover {
  background: color-mix(in oklab, var(--hl) 25%, var(--raised));
}
.scale button.is-on {
  background: var(--hl);
  color: var(--hl-ink);
}

/* ── المهام ───────────────────────────────────────────────── */
.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.task {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 2px 4px;
  border-radius: var(--r-sm);
}
.task:hover {
  background: color-mix(in oklab, var(--raised) 55%, transparent);
}
.task .icon-btn {
  opacity: 0;
}
.task:hover .icon-btn,
.task .icon-btn:focus-visible {
  opacity: 1;
}
@media (hover: none) {
  .task .icon-btn {
    opacity: 0.7;
  }
}
.task-check {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 6px;
  border: 2px solid var(--muted);
  background: transparent;
  display: grid;
  place-items: center;
  padding: 0;
  color: transparent;
}
.task-check:hover {
  border-color: var(--green);
}
.task.is-done .task-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.task-title,
.task-edit {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.task-edit {
  border: 2px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 3px 6px;
  font-weight: 600;
  text-overflow: ellipsis;
}
.task-edit:hover {
  border-color: var(--field-line);
}
.task-edit:focus {
  outline: none;
  background: var(--field-focus);
  color: var(--field-ink);
  border-color: var(--accent);
  box-shadow: none;
}
.task.is-done .task-title,
.task.is-done .task-edit:not(:focus) {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in oklab, var(--muted) 70%, transparent);
}
.task-date {
  border: 0;
  background: var(--raised);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 13px;
  color: var(--ink-2);
  direction: ltr;
}

.add-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.add-mini {
  margin-top: 8px;
}
.add-mini .write {
  min-height: 36px;
  font-size: 14px;
}
.add-full {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.add-full .grow {
  flex: 1 1 240px;
}
.add-full .field:not(.grow) .write {
  width: auto;
}
.card .add-full {
  margin-top: 4px;
}
.habits-table + .add-full,
.table-scroll + .add-full {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.week-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
  flex-wrap: wrap;
  padding: 14px 20px;
}
.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.week-range {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 150px;
  line-height: 1.4;
}
.week-range b {
  font-size: 18px;
}
.week-range small {
  color: var(--muted);
}
.week-sum {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--ink-2);
}
.week-sum .meter {
  width: 140px;
}
.dot-g,
.dot-o {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-inline-end: 6px;
  background: var(--green);
}
.dot-o {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--muted);
}
.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.day-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 190px;
}
.day-card.is-today {
  border-color: var(--hl);
}
.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.day-head div {
  display: flex;
  flex-direction: column;
  line-height: 1.4;
}
.day-head small {
  color: var(--muted);
}
.day-card.is-today .day-head small {
  color: var(--hl);
}
.day-head .ring-label b {
  font-size: 11px;
}
.day-empty {
  color: var(--muted);
  font-size: 13.5px;
  padding: 6px 4px;
}
.day-card .add-mini {
  margin-top: auto;
  padding-top: 8px;
}
.task-group + .task-group {
  margin-top: 16px;
}
.task-group h3 {
  font-size: 14px;
  color: var(--muted);
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.task-group h3.is-today {
  color: var(--hl);
}

/* ── جدول الشهر ───────────────────────────────────────────── */
.tracker-card {
  padding-inline: 0;
  padding-bottom: 8px;
}
.tracker-card > .card-head,
.tracker-card > .empty {
  padding-inline: 20px;
}
.tracker-scroll {
  position: relative;
  overflow-x: auto;
  scrollbar-width: thin;
  outline: none;
}
.tracker-scroll:focus-visible {
  box-shadow: inset 0 0 0 2px var(--hl);
}
.tracker {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 100%;
}
.tracker th,
.tracker td {
  padding: 3px 2px;
  text-align: center;
  white-space: nowrap;
}
.tracker thead th {
  color: var(--muted);
  font-weight: 700;
}
.tracker .week-h {
  color: var(--ink-2);
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  border-inline-start: 1px solid var(--line);
  padding-bottom: 5px;
}
.tracker .day-h {
  min-width: 30px;
  font-size: 12px;
}
.tracker .row-nums .day-h {
  color: var(--ink-2);
  padding-bottom: 8px;
}
.tracker .day-h.is-today {
  color: var(--hl-ink);
  background: var(--hl);
}
.tracker .row-letters .day-h.is-today {
  border-radius: 8px 8px 0 0;
}
.tracker td.is-today {
  background: color-mix(in oklab, var(--hl) 9%, transparent);
}
.tracker .wk-end:not(:last-child) {
  border-inline-end: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
}
.tracker .name-col {
  position: sticky;
  inset-inline-start: 0;
  z-index: 2;
  background: var(--panel);
  text-align: start;
  padding-inline: 20px 12px;
  min-width: 200px;
  max-width: 240px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: -1px 0 0 var(--line);
}
.tracker thead .name-col {
  color: var(--muted);
  vertical-align: bottom;
  padding-bottom: 8px;
}
.tracker .name-col .nm {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.row-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
  margin-inline-end: 8px;
  vertical-align: middle;
}
.tracker .target-col {
  color: var(--muted);
  padding-inline: 8px;
  min-width: 44px;
}
.tracker .stat-col {
  padding-inline: 10px;
  min-width: 56px;
  color: var(--ink-2);
}
.tracker .bar-col {
  padding-inline: 10px 20px;
  min-width: 110px;
}
.tracker tbody tr:hover .name-col,
.tracker tbody tr:hover td {
  background-color: color-mix(in oklab, var(--raised) 45%, var(--panel));
}
.cell {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: var(--raised);
  display: grid;
  place-items: center;
  color: #fff;
  margin: auto;
  transition: background 0.12s ease, transform 0.12s ease;
}
.cell:hover {
  box-shadow: inset 0 0 0 2px var(--c);
}
.cell.is-on {
  background: var(--c);
}
.cell:active {
  transform: scale(0.9);
}
.t-summary th,
.t-summary td {
  color: var(--ink-2);
  font-size: 12.5px;
}
.t-summary tr:first-child > * {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.t-summary .pct-cell {
  font-size: 10.5px;
  color: var(--muted);
}
.t-sleep .section-row > * {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}
.t-sleep .section-row .name-col {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cell-input {
  width: 28px;
  min-height: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  border-width: 1px;
}
.cell-input:focus {
  width: 40px;
  position: relative;
  z-index: 3;
}

.rank {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rank li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1.3fr) minmax(0, 1fr) 46px;
  align-items: center;
  gap: 10px;
}
.rank-n {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--raised);
  font-size: 13px;
  font-weight: 800;
}
.rank li:first-child .rank-n {
  background: var(--hl);
  color: var(--hl-ink);
}
.rank-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-v,
.hb-v {
  text-align: end;
  font-weight: 700;
  font-size: 14px;
}

/* ── لوحة التحكم ──────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.span-2 {
  grid-column: span 2;
}
.versus {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding-top: 8px;
}
.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--c);
}
.legend span {
  flex: 1;
  color: var(--ink-2);
}
.habit-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 28px;
}
.habit-bars li {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.hb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── الأهداف ──────────────────────────────────────────────── */
.goal-total {
  display: flex;
  align-items: center;
  gap: 12px;
}
.goal-total span {
  display: flex;
  flex-direction: column;
  line-height: 1.4;
}
.goal-total small {
  color: var(--muted);
}
.goal-total .ring-label b {
  font-size: 13px;
}
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  align-items: start;
}
.goal {
  border-top: 4px solid var(--c);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.goal-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.goal-n {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--c);
  color: #fff;
  font-weight: 800;
}
.goal-title {
  font-size: 16px;
  font-weight: 700;
}
.goal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.deadline {
  display: flex;
  align-items: center;
  gap: 6px;
}
.deadline .write {
  width: auto;
  min-height: 36px;
  font-size: 14px;
}
.goal-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--deep);
}
.goal-progress div {
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}
.goal-progress b {
  font-size: 18px;
}
.goal-progress small {
  color: var(--muted);
}
.goal-progress .ring-label b {
  font-size: 13px;
}
.steps-h {
  color: var(--muted);
  font-size: 13.5px;
}
.goal-new {
  border-style: dashed;
  background: transparent;
}
.goal-new h2 {
  margin-bottom: 14px;
}

/* ── الجداول ──────────────────────────────────────────────── */
.table-scroll {
  position: relative;
  overflow-x: auto;
  scrollbar-width: thin;
}
.data-table,
.habits-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: start;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table thead th {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
}
.data-table tbody th a {
  text-decoration: none;
  font-weight: 700;
}
.data-table tbody th a:hover {
  color: var(--hl);
}
.data-table .num {
  font-weight: 600;
}
.data-table .w-bar {
  min-width: 140px;
  width: 22%;
}
.data-table .best {
  color: var(--ink-2);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table tr.is-now th a {
  color: var(--hl);
}
.data-table tr.is-now > * {
  background: color-mix(in oklab, var(--hl) 6%, transparent);
}
.data-table tfoot > tr > * {
  border-bottom: 0;
  border-top: 2px solid var(--raised);
  font-weight: 800;
}

.habits-table th,
.habits-table td {
  padding: 6px 6px;
  text-align: start;
}
.habits-table thead th {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
}
.habits-table .n {
  width: 48px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.habits-table {
  max-width: 820px;
}
.habits-table td:nth-child(2) {
  min-width: 220px;
  width: 100%;
}
.row-actions {
  white-space: nowrap;
  width: 1%;
}
.settings-basic {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/* ── ابدأ من هنا ──────────────────────────────────────────── */
.start-hero {
  padding: 18px 0 8px;
}
.start-hero h1 {
  font-size: clamp(30px, 4.5vw, 44px);
}
.start-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  counter-reset: none;
}
.steps li {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--deep);
}
.steps a {
  text-decoration: none;
}
.steps a:hover b {
  color: var(--hl);
}
.steps p {
  color: var(--ink-2);
  font-size: 14px;
  margin-top: 4px;
}
.step-n {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--hl);
  color: var(--hl-ink);
  font-weight: 800;
  font-size: 17px;
}
.card > h2 {
  margin-bottom: 14px;
}
.rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rules li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.rules p {
  color: var(--ink-2);
}
.swatch-write,
.swatch-check,
.swatch-phone {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--hl);
}
.swatch-check {
  background: var(--green);
  color: #fff;
}
.swatch-phone {
  background: var(--raised);
  color: var(--ink-2);
}
.all-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.all-links a {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.all-links a:hover {
  background: var(--raised);
}
.all-links a.is-now {
  background: var(--hl);
  color: var(--hl-ink);
  border-color: var(--hl);
}

/* ── تسجيل الدخول ─────────────────────────────────────────── */
.auth-main {
  outline: none;
}
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}
.auth-brand {
  background: var(--hero);
  color: var(--hero-ink);
  padding: clamp(32px, 6vw, 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
}
.auth-brand::after {
  content: '';
  position: absolute;
  inset-inline-end: -120px;
  bottom: -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  border: 46px solid rgb(255 255 255 / 0.07);
  pointer-events: none;
}
.auth-brand .brand {
  font-size: 30px;
}
.auth-tag {
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 800;
  max-width: 22ch;
  line-height: 1.6;
}
.auth-perks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 420px;
}
.auth-perks li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: rgb(255 255 255 / 0.1);
  backdrop-filter: blur(4px);
  font-weight: 600;
}
.auth-perks span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.16);
}
.auth-mosaic {
  display: grid;
  grid-template-columns: repeat(7, 30px);
  gap: 6px;
  opacity: 0.9;
}
.auth-mosaic i {
  aspect-ratio: 1;
  border-radius: 7px;
}
.auth-more {
  color: inherit;
  font-weight: 600;
  opacity: 0.9;
  text-underline-offset: 4px;
}
.auth-more:hover {
  opacity: 1;
}
.auth-note {
  color: var(--muted);
}
.auth-card {
  padding: clamp(28px, 6vw, 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  max-width: 500px;
  width: 100%;
  margin-inline: auto;
}
.auth-tabs {
  align-self: stretch;
  margin-bottom: 18px;
}
.auth-tabs button {
  flex: 1;
}
.auth-card .form {
  margin-top: 18px;
}
.auth-card .btn {
  margin-top: 6px;
}
/* ── حاجات عامة ───────────────────────────────────────────── */
.empty {
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  color: var(--ink-2);
}
.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  padding: 40px 0;
}
.loading-grid {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  gap: 3px;
}
.loading-grid i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--raised);
  animation: pulse 1s infinite ease-in-out;
}
.loading-grid i:nth-child(2) {
  animation-delay: 0.15s;
}
.loading-grid i:nth-child(3) {
  animation-delay: 0.45s;
}
.loading-grid i:nth-child(4) {
  animation-delay: 0.3s;
}
@keyframes pulse {
  50% {
    background: var(--accent);
  }
}

#tooltip {
  position: fixed;
  z-index: 60;
  max-width: 260px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  pointer-events: none;
}
#toasts {
  position: fixed;
  z-index: 70;
  bottom: 24px;
  inset-inline-start: 50%;
  transform: translateX(50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  animation: toast-in 0.2s ease;
}
.toast-error {
  background: var(--red);
  color: #fff;
}
.toast.is-leaving {
  opacity: 0;
  transition: opacity 0.35s ease;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.dialog {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  color: var(--ink);
  padding: 24px;
  max-width: min(420px, calc(100vw - 32px));
}
.dialog::backdrop {
  background: var(--scrim);
}
.dialog p {
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.7;
}
.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ── الشاشات المتوسطة ─────────────────────────────────────── */
@media (max-width: 1180px) {
  .dash-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .today-hero {
    grid-template-columns: 1fr;
  }
}

/* ── الموبايل والتابلت ─────────────────────────────────────── */
@media (max-width: 900px) {
  body[data-layout='app'] #app {
    display: block;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: color-mix(in oklab, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand {
    font-size: 19px;
  }
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 50;
    width: min(290px, 84vw);
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }
  body.nav-open .sidebar {
    transform: none;
  }
  .scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    display: block;
  }
  body.nav-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .icon-btn.only-mobile {
    display: inline-grid;
  }
  .main {
    padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
    gap: 16px;
  }
  .bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px max(6px, env(safe-area-inset-bottom));
    background: var(--deep);
    border-top: 1px solid var(--line);
  }
  .bottom-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: var(--r-sm);
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
  }
  .bottom-link.is-active {
    color: var(--ink);
  }
  .bottom-link.is-active .icon {
    color: var(--hl);
  }
  #toasts {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .grid-2,
  .today-grid,
  .dash-grid,
  .settings-basic {
    grid-template-columns: minmax(0, 1fr);
  }
  .span-2 {
    grid-column: auto;
  }
  .habit-bars {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
    padding-block: 28px;
    gap: 14px;
  }
  .auth-mosaic,
  .auth-note {
    display: none;
  }
  .brand-lg {
    font-size: 28px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }
  .card {
    padding: 16px;
    border-radius: 16px;
  }
  .tracker-card {
    padding-inline: 0;
  }
  .tracker-card > .card-head {
    padding-inline: 16px;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .kpi-value {
    font-size: 25px;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
  .steps li {
    flex-direction: row;
    align-items: flex-start;
  }
  .today-score {
    gap: 16px;
  }
  .today-score .ring {
    --size: 104px !important;
  }
  .today-score .ring svg {
    width: 104px;
    height: 104px;
  }
  .today-score h2 {
    font-size: 17px;
  }
  .facts dt {
    min-width: 76px;
  }
  .mosaic {
    max-width: none;
  }
  .tracker .name-col {
    min-width: 132px;
    max-width: 150px;
    padding-inline: 14px 8px;
  }
  .tracker .name-col .nm {
    max-width: 112px;
  }
  .week-bar {
    padding: 12px 14px;
  }
  .week-nav {
    width: 100%;
    justify-content: space-between;
  }
  .week-sum {
    width: 100%;
    gap: 12px;
  }
  .week-sum .meter {
    flex: 1;
    width: auto;
  }
  .rank li {
    grid-template-columns: 26px minmax(0, 1fr) 60px 42px;
  }
  .add-full .field:not(.grow),
  .add-full .field:not(.grow) .write,
  .add-full .btn {
    width: 100%;
  }
  .page-head-aside {
    width: 100%;
  }
  .goal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .day-card {
    min-height: 0;
  }
  /* جدول العادات يتقفل على عرض الموبايل من غير سحب */
  .habits-table {
    table-layout: fixed;
  }
  .habits-table th,
  .habits-table td {
    padding: 4px 2px;
  }
  .habits-table thead th:nth-child(1) {
    width: 30px;
  }
  .habits-table thead th:nth-child(3) {
    width: 60px;
  }
  .habits-table thead th:nth-child(4) {
    width: 88px;
  }
  .habits-table td:nth-child(2) {
    min-width: 0;
  }
  .habits-table .w-num {
    width: 100%;
    padding-inline: 4px;
  }
  .habits-table .icon-btn-sm {
    width: 28px;
  }
}


/* ═════════════════════════════════════════════════════════════
   الأقسام الجديدة
   ═════════════════════════════════════════════════════════════ */

/* ── الإطار: مجموعات القايمة + شارة المؤقت ────────────────── */
.nav-group {
  margin: 14px 12px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.sidebar .nav .nav-link {
  padding-block: 7px;
}
.timer-slot:empty {
  display: none;
}
.timer-slot.side {
  display: block;
  margin: 2px 0 6px;
}
.timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 30%, var(--raised));
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  direction: ltr;
}
.timer-slot.side .timer-badge {
  width: 100%;
  justify-content: center;
}
.timer-badge.is-break {
  background: color-mix(in oklab, var(--green) 30%, var(--raised));
}
.timer-badge.is-paused {
  opacity: 0.65;
}
.logo-mark {
  flex: none;
}

/* ── أدوات عامة ───────────────────────────────────────────── */
.btn-sm {
  min-height: 34px;
  padding: 4px 12px;
  font-size: 14px;
  gap: 6px;
}
.is-good {
  color: var(--t-green);
}
.is-bad {
  color: var(--t-red);
}
.chip-btn.is-alert {
  border-color: color-mix(in oklab, var(--red) 55%, transparent);
  color: var(--t-red);
}
.segmented button[aria-checked='true'] {
  background: var(--raised);
  color: var(--ink);
}
.kpis-col {
  grid-template-columns: 1fr;
  align-content: start;
}
.kpis-6 {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.small-h {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  margin: 14px 0 6px;
}
.tall {
  min-height: 120px;
  resize: vertical;
  line-height: 1.8;
}
textarea.write {
  width: 100%;
  font: inherit;
}
.add-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.add-grid .grow,
.inline-fields .grow {
  flex: 1 1 200px;
}
.inline-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  font-weight: 600;
  color: var(--ink-2);
}
.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.w-qty {
  width: 90px;
}
.is-off {
  opacity: 0.55;
}

/* سويتش شغال/متوقف */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex: none;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--line);
  transition: background 0.15s;
}
.switch span::after {
  content: '';
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: inset-inline-start 0.15s, background 0.15s;
}
.switch input:checked + span {
  background: var(--green);
  border-color: var(--green);
}
.switch input:checked + span::after {
  inset-inline-start: 20px;
  background: #fff;
}
.switch input:focus-visible + span {
  box-shadow: var(--focus);
}

/* اختيار أيام الأسبوع */
.wd-pick {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}
.wd-pick button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 0;
}
.wd-pick button.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.wd-pick.small button {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

/* نجوم التقييم */
.stars {
  display: inline-flex;
  direction: ltr;
}
.stars button {
  border: 0;
  background: none;
  padding: 0 1px;
  font-size: 18px;
  line-height: 1;
  color: var(--raised);
}
.stars button svg {
  fill: currentColor;
  display: block;
}
.stars button.is-on {
  color: var(--amber);
}
.stars button:hover {
  color: color-mix(in oklab, var(--amber) 70%, var(--ink));
}

/* صفوف عامة (اشتراكات، دراسة، فلوس، تذكيرات…) */
.row-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.row:last-child {
  border-bottom: 0;
}
.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.row-main .write {
  min-height: 36px;
}
.row-title {
  font-weight: 700;
}
.row.is-done .row-title,
.row.is-done .row-main b {
  color: var(--muted);
  text-decoration: line-through;
}
.row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.row-side {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.row > .write {
  min-height: 36px;
}

/* شارات الأنواع */
.pill {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--raised);
  color: var(--ink-2);
  white-space: nowrap;
}
.pill-exam,
.pill-series {
  background: color-mix(in oklab, var(--red) 25%, var(--raised));
  color: var(--t-red);
}
.pill-hw,
.pill-book,
.pill-movie {
  background: color-mix(in oklab, var(--blue) 25%, var(--raised));
  color: var(--t-blue);
}
.pill-project,
.pill-course {
  background: color-mix(in oklab, var(--accent) 30%, var(--raised));
  color: var(--t-gold);
}
.pill-study,
.pill-podcast,
.pill-doc {
  background: color-mix(in oklab, var(--green) 25%, var(--raised));
  color: var(--t-green);
}

/* ── الأولويات ────────────────────────────────────────────── */
.prio,
.prio-select {
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 10px;
  white-space: nowrap;
}
.prio-select {
  border: 1px solid transparent;
  background: var(--raised);
  color: var(--ink-2);
  padding: 3px 8px;
  max-width: 120px;
}
select.prio-select {
  appearance: auto;
}
.prio-none {
  background: var(--raised);
  color: var(--muted);
}
.prio-imp {
  background: color-mix(in oklab, var(--accent) 32%, var(--raised));
  color: var(--t-gold);
}
.prio-urg {
  background: color-mix(in oklab, var(--amber) 28%, var(--raised));
  color: var(--t-amber);
}
.prio-both {
  background: color-mix(in oklab, var(--red) 35%, var(--raised));
  color: var(--t-red);
}
.task .prio-select.prio-none {
  opacity: 0;
}
.task:hover .prio-select.prio-none,
.task .prio-select:focus-visible {
  opacity: 1;
}
@media (hover: none) {
  .task .prio-select.prio-none {
    opacity: 0.6;
  }
}
.task-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.task-project {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink-2);
  text-decoration: none;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-late {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--t-red);
  white-space: nowrap;
}
.task.is-overdue .task-edit,
.task.is-overdue .task-title {
  color: var(--t-red);
}
.task.is-overdue .task-check {
  border-color: var(--red);
}
.task-date.is-late {
  background: color-mix(in oklab, var(--red) 30%, var(--raised));
  color: var(--t-red);
}
.overdue-card {
  border-color: color-mix(in oklab, var(--red) 50%, var(--line));
  background: color-mix(in oklab, var(--red) 8%, var(--panel));
}
.overdue-card h2 {
  color: var(--t-red);
}
.task-group h3.is-past {
  color: var(--t-red);
}

/* ── صفحة الأقسام ─────────────────────────────────────────── */
.hub-group + .hub-group {
  margin-top: 26px;
}
.hub-group > h2,
.hub-h {
  margin-bottom: 12px;
  color: var(--ink-2);
}
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.hub-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, transform 0.15s;
}
.hub-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.hub-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--raised);
  color: var(--hl);
}
.hub-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.hub-text small {
  font-size: 13px;
  line-height: 1.6;
}
.hub-text .is-alert {
  color: var(--t-red);
  font-weight: 700;
}

/* ── التقويم ──────────────────────────────────────────────── */
.cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.cal-nav h2 {
  flex: 1;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.cal-wd {
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 4px;
}
.cal-day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-height: 92px;
  padding: 4px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--deep);
  color: var(--ink);
  text-align: start;
  min-width: 0;
  overflow: hidden;
}
.cal-day:hover {
  border-color: var(--muted);
}
.cal-day.is-out {
  opacity: 0.4;
}
.cal-day.is-today .cal-n {
  background: var(--hl);
  color: var(--hl-ink);
}
.cal-day.is-sel {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.cal-n {
  align-self: flex-start;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.cal-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cal-item {
  font-size: 11.5px;
  line-height: 1.5;
  padding: 0 5px;
  border-radius: 4px;
  border-inline-start: 3px solid var(--c);
  background: color-mix(in oklab, var(--c) 18%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-item svg.icon {
  vertical-align: -2px;
  margin-inline-end: 3px;
}
.cal-item.is-done {
  opacity: 0.55;
  text-decoration: line-through;
}
.cal-more {
  font-size: 11px;
  color: var(--muted);
  padding-inline-start: 4px;
}
.cal-dots {
  display: none;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}
.cal-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c);
}
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}
.cal-legend span,
.cal-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cal-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c);
}
.agenda {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agenda-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: color-mix(in oklab, var(--c) 10%, transparent);
  border-inline-start: 3px solid var(--c);
}
.agenda-item.is-done .agenda-text b {
  color: var(--muted);
  text-decoration: line-through;
}
.agenda-item.is-done .task-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.agenda-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--c);
}
.agenda-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.agenda-text small {
  color: var(--muted);
  font-size: 12.5px;
}

/* ── المشاريع ─────────────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}
.project {
  border-top: 3px solid var(--c);
}
.project.is-open {
  grid-column: 1 / -1;
}
.project-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.project-title {
  flex: 1;
  min-width: 0;
}
.project-title .write {
  width: 100%;
  font-weight: 800;
}
.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.project-meta a.chip {
  text-decoration: none;
}
.project-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ── الملاحظات ────────────────────────────────────────────── */
.notes-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.notes-bar .chips {
  margin: 0;
  flex: 1;
}
.search {
  min-width: 220px;
}
.notes-grid {
  columns: 3 280px;
  column-gap: 16px;
}
.note {
  break-inside: avoid;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note.is-pinned {
  border-color: color-mix(in oklab, var(--hl) 50%, var(--line));
}
.note-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.note-title {
  flex: 1;
  font-weight: 800;
}
.note-head .icon-btn.is-on {
  color: var(--hl);
}
.note-body {
  min-height: 90px;
}
.note-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
}
.note-project {
  max-width: 180px;
}

/* ── القراءة والأفلام ─────────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.media {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.media.is-done {
  border-color: color-mix(in oklab, var(--green) 45%, var(--line));
}
.media-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.media-title {
  flex: 1;
  min-width: 0;
  font-weight: 800;
}
.media-sub {
  color: var(--muted);
  font-size: 13px;
}
.media-progress {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.mini-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.mini-field .write {
  min-height: 34px;
  width: 76px;
  padding-inline: 8px;
}
.mini-field.wide {
  flex: 1 1 100%;
}
.mini-field.wide .write {
  width: 100%;
}
.media-pct {
  flex: 1 1 100%;
}
.media-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── الفلوس والاشتراكات ───────────────────────────────────── */
.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.month-nav h2 {
  min-width: 0;
  text-align: center;
  flex: 0 1 auto;
}
.budget-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.budget-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.budget-nums {
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.budget-pct {
  font-weight: 800;
  color: var(--ink);
}
.budget.is-over .budget-pct,
.budget.is-over .budget-top b {
  color: var(--t-red);
}
.budget.is-over .meter > span {
  background: var(--red) !important;
}
.over-note {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--t-red);
}
.w-money {
  width: 120px;
}
.money-amt {
  flex: none;
  min-width: 96px;
  font-weight: 800;
  direction: ltr;
  text-align: end;
}
.money-row.is-in .money-amt {
  color: var(--t-green);
}
.money-row.is-out .money-amt {
  color: var(--t-red);
}
.sub-row .row-main .write {
  max-width: 280px;
}

/* ── المشتريات ────────────────────────────────────────────── */
.shop-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
.shop-progress .meter {
  flex: 1;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
  align-items: start;
}
.shop-grid .task .write {
  min-height: 32px;
}

/* ── الوصفات ──────────────────────────────────────────────── */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.recipe-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: start;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.recipe-card:hover {
  border-color: var(--muted);
}
.recipe-card.is-open {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.recipe-cat {
  font-size: 12px;
  font-weight: 700;
  color: var(--hl);
}
.recipe-detail {
  margin-top: 20px;
}
.recipe-detail .icon-btn.is-on {
  color: var(--amber);
}
.ing-list,
.recipe-detail .steps-list {
  margin: 0;
  padding-inline-start: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ing-list li::marker {
  color: var(--hl);
}
.recipe-detail .steps-list li::marker {
  color: var(--accent);
  font-weight: 800;
}

/* ── التمارين ─────────────────────────────────────────────── */
.workout-today {
  display: flex;
  align-items: center;
  gap: 18px;
}
.workout-today .grow {
  flex: 1;
  min-width: 0;
}
.week-plan {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}
.plan-day {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-day.is-today {
  border-color: var(--hl);
}
.plan-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}
.plan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.plan-item:last-child {
  border-bottom: 0;
}
.plan-item.is-done .task-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.plan-item.is-done .plan-name {
  color: var(--muted);
  text-decoration: line-through;
}
.plan-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.plan-row .write {
  min-height: 30px;
  padding: 2px 6px;
}
.plan-row .w-num {
  width: 52px;
}
.plan-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}
.plan-name.write {
  font-size: 13.5px;
}

/* ── الأداء والقياسات ─────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.metric {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.metric-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.metric-name {
  flex: 1;
  font-weight: 800;
}
.metric-now {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.metric-value {
  font-size: 30px;
  font-weight: 800;
}
.metric-diff {
  font-weight: 700;
  font-size: 13.5px;
}
.metric-log {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.metric-log .w-num {
  width: 100px;
}
.metric-more summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.metric-more[open] summary {
  margin-bottom: 10px;
}
.log-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  font-size: 13.5px;
}
.log-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid var(--line);
}

/* ── اليوميات والمود ──────────────────────────────────────── */
.moods {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mood {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 58px;
  padding: 8px 6px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--deep);
  color: var(--muted);
  line-height: 1.2;
}
.mood.is-on svg {
  color: var(--t-amber, var(--amber));
}
.mood:hover {
  border-color: var(--muted);
}
.mood.is-on {
  border-color: var(--hl);
  background: var(--raised);
  color: var(--ink);
}
.journal-write .moods {
  margin-bottom: 14px;
}
.journal-form,
.journal-mini {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.journal-mini {
  margin-top: 12px;
}
.journal-mini .btn {
  align-self: flex-end;
}
.journal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.journal-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  text-align: start;
  font: inherit;
}
.journal-entry:hover {
  background: var(--raised);
}
.journal-entry.is-sel {
  border-color: var(--accent);
}
.journal-mood {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--raised);
  color: var(--ink-2);
  flex: none;
}
.journal-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.journal-text small,
.journal-text span {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── المراجعة الأسبوعية ───────────────────────────────────── */
.review-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}
.review-q {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

/* ── مؤقت التركيز ─────────────────────────────────────────── */
.timer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.timer-custom {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.timer-face {
  --p: 0;
  --tc: var(--accent);
  position: relative;
  width: min(240px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--tc) calc(var(--p) * 1turn), var(--raised) 0);
}
.timer-face::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--panel);
}
.timer-face > * {
  position: relative;
}
.timer-card.is-break .timer-face {
  --tc: var(--green);
}
.timer-phase {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--ink-2);
}
.timer-clock {
  font-size: clamp(44px, 9vw, 58px);
  font-weight: 800;
  line-height: 1.1;
  direction: ltr;
  letter-spacing: 0.02em;
}
.timer-label {
  width: min(380px, 100%);
  text-align: center;
}
.timer-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── اليوم: سلاسل وروابط سريعة ────────────────────────────── */
.streak {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 800;
  color: var(--t-amber);
}
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.quick {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink-2);
  font-size: 13px;
}
.quick .icon {
  color: var(--hl);
}
.quick b {
  font-size: 20px;
  color: var(--ink);
}
.quick:hover {
  border-color: var(--accent);
}
.quick.is-alert {
  border-color: color-mix(in oklab, var(--red) 55%, var(--line));
}
.quick.is-alert b,
.quick.is-alert .icon {
  color: var(--t-red);
}

/* ── الأهداف ──────────────────────────────────────────────── */
.goal-kind {
  max-width: 160px;
}
.goal-add {
  margin-top: 10px;
}
.add-step {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.add-step .write:first-child {
  flex: 1;
  min-width: 0;
}
.notify-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--deep);
}

/* ── الشاشات الصغيرة ──────────────────────────────────────── */
@media (max-width: 1180px) {
  .cal-layout {
    grid-template-columns: 1fr;
  }
  .week-plan {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .week-plan {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .timer-slot.side {
    display: none;
  }
  .metric-grid,
  .project-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .cal-day {
    min-height: 52px;
    align-items: center;
  }
  .cal-items {
    display: none;
  }
  .cal-dots {
    display: flex;
  }
  .cal-n {
    align-self: center;
  }
  .week-plan {
    grid-template-columns: 1fr;
  }
  .row {
    flex-wrap: wrap;
  }
  .row-main {
    flex-basis: 60%;
  }
  .sub-row .row-main .write {
    max-width: none;
  }
  .search {
    min-width: 0;
    width: 100%;
  }
  .workout-today {
    flex-direction: column;
    align-items: stretch;
  }
  .mood {
    min-width: 0;
    flex: 1;
  }
  .money-amt {
    min-width: 0;
  }
  .hub-grid {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .cell.is-on,
  .habit-toggle.is-on .box,
  .task.is-done .task-check {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ── بَرَكة: الثيم، النقط، الترتيب، المكافآت ──────────────── */
.btn {
  transition: filter 0.15s, transform 0.1s;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn-gold {
  background: var(--gold);
  color: #1b1405;
}
.icon-btn-xs {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}
.icon-btn[aria-pressed='true'],
.icon-btn.is-on {
  color: var(--accent-2);
}
.grow {
  flex: 1;
  min-width: 0;
}
.sub-h {
  font-size: 13.5px;
  color: var(--muted);
  margin: 16px 0 8px;
}

/* القايمة: المتثبت + المستخدم */
.nav-pinned {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}
.sidebar-user .icon-btn {
  width: 34px;
  height: 34px;
}
.theme-btn:hover {
  color: var(--gold) !important;
}
.topbar .brand {
  margin-inline-end: auto;
}
.topbar {
  gap: 6px;
}

/* شارة النقط */
.points-slot:empty {
  display: none;
}
.points-slot.side {
  display: block;
  padding: 0 4px 10px;
}
.points-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--hero);
  color: var(--hero-ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.points-chip:hover {
  filter: brightness(1.08);
}
.points-lv {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #1b1405;
  font-weight: 800;
  font-size: 14px;
}
.points-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.2;
}
.points-meta b {
  font-size: 13.5px;
}
.points-bar {
  display: block;
  height: 5px;
  border-radius: 99px;
  background: rgb(255 255 255 / 0.22);
  overflow: hidden;
}
.points-bar i {
  display: block;
  height: 100%;
  background: var(--gold);
  border-radius: inherit;
}
.points-num {
  font-weight: 800;
  white-space: nowrap;
}
.points-num small {
  font-weight: 600;
  opacity: 0.8;
}
.points-chip.is-compact {
  padding: 4px 10px 4px 4px;
  gap: 6px;
  border-radius: 99px;
}
.points-chip.is-compact .points-lv {
  width: 26px;
  height: 26px;
  font-size: 13px;
}

/* ترتيب المهام يدوي */
.task-order {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
}
.sort-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.sort-pick select {
  min-height: 38px;
}

/* صفحة اليوم: كروت بتترتب */
.today-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  align-items: start;
}
.tcard {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tcard.is-wide {
  grid-column: 1 / -1;
}
.tcard > .card {
  height: 100%;
}
.today-hero {
  background: var(--hero);
  border: 0;
  color: var(--hero-ink);
}
.today-hero .facts dt,
.today-hero h3,
.today-hero .mosaic-legend {
  color: inherit;
  opacity: 0.85;
}
.arrange-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}
.arrange-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 6px 6px;
  border-radius: var(--r-md);
  background: var(--raised);
  border: 1px dashed var(--accent-2);
}
.arrange-bar b {
  flex: 1;
  font-size: 14px;
}
.is-arranging .tcard > :not(.arrange-bar) {
  pointer-events: none;
  max-height: 220px;
  overflow: hidden;
  mask-image: linear-gradient(#000 60%, transparent);
}
.tcard.is-off > :not(.arrange-bar) {
  opacity: 0.35;
  filter: grayscale(1);
}

/* كارت النقط في اليوم */
.rewards-mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.big-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--accent-2);
}
.lv-pill {
  padding: 3px 10px;
  border-radius: 99px;
  background: color-mix(in oklab, var(--gold) 20%, transparent);
  color: var(--t-gold);
  font-weight: 700;
  font-size: 13px;
}
.rewards-mini p {
  margin-top: 8px;
}
.challenge-mini {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.challenge-mini li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--deep);
}
.challenge-mini li > span:first-child {
  display: grid;
  color: var(--t-gold, var(--gold));
}
.challenge-mini li > span:nth-child(2) {
  flex: 1;
}

/* صفحة المكافآت */
.rewards-hero {
  background: var(--hero);
  border: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  color: var(--hero-ink);
}
.rewards-hero .muted {
  color: inherit;
  opacity: 0.85;
}
.rewards-level {
  display: flex;
  align-items: center;
  gap: 22px;
}
.rewards-level > div:last-child {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rewards-level h2 {
  font-size: 24px;
}
.rewards-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.rewards-stats div {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgb(255 255 255 / 0.12);
}
.rewards-stats dt {
  font-size: 13px;
  opacity: 0.85;
}
.rewards-stats dd {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}
.rewards-stats .is-main dd {
  color: var(--gold);
}
.rewards-stats dd small {
  font-size: 13px;
  font-weight: 600;
}
.challenge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.challenge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--deep);
  border: 1px solid var(--line);
}
.challenge.is-done:not(.is-claimed) {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--gold) 20%, transparent);
}
.challenge.is-claimed {
  opacity: 0.65;
}
.challenge-emoji,
.reward-emoji {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 14px;
  background: color-mix(in oklab, var(--gold) 16%, var(--raised));
  color: var(--t-gold, var(--gold));
}
.challenge-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.challenge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-2);
  font-weight: 700;
  font-size: 13px;
}
.rewards-tabs {
  align-self: flex-start;
}
.rewards-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.reward-list,
.redeem-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.reward {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(80px, 140px) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--deep);
  border: 1px solid var(--line);
}
.reward.is-ready {
  border-color: color-mix(in oklab, var(--gold) 60%, var(--line));
}
.reward-title {
  font-weight: 700;
}
.reward-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}
.reward-cost .w-num {
  width: 90px;
}
.icon-pick {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
}
.icon-pick label {
  cursor: pointer;
}
.icon-pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.icon-pick span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--deep);
  color: var(--muted);
}
.icon-pick label:hover span {
  border-color: var(--muted);
}
.icon-pick input:checked + span {
  border-color: var(--gold);
  background: color-mix(in oklab, var(--gold) 18%, var(--raised));
  color: var(--ink);
}
.icon-pick input:focus-visible + span {
  outline: 2px solid var(--hl);
  outline-offset: 2px;
}
.idea-row .chip svg {
  vertical-align: -3px;
}
.idea-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}
.idea-row .chip {
  cursor: pointer;
  border: 1px solid var(--line);
}
.idea-row .chip:hover {
  border-color: var(--accent-2);
}
.redeem-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}
.redeem-list li > span {
  flex: 1;
}
.redeem-list b {
  color: var(--t-red);
}
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 18px 12px;
  border-radius: var(--r-md);
  background: var(--deep);
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge small {
  font-size: 12.5px;
  line-height: 1.5;
}
.badge-emoji {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-inline: auto;
  border-radius: 50%;
  background: var(--raised);
  color: var(--muted);
  opacity: 0.6;
}
.badge.is-earned {
  color: var(--ink);
  border-color: color-mix(in oklab, var(--gold) 55%, var(--line));
  background: linear-gradient(180deg, color-mix(in oklab, var(--gold) 12%, var(--deep)), var(--deep));
}
.badge.is-earned .badge-emoji {
  opacity: 1;
  color: var(--t-gold, var(--gold));
  background: color-mix(in oklab, var(--gold) 20%, var(--raised));
}
.badge-date {
  color: var(--t-gold);
  font-weight: 700;
}
.points-table {
  width: 100%;
  border-collapse: collapse;
}
.points-table th,
.points-table td {
  padding: 9px 10px;
  text-align: start;
  border-bottom: 1px solid var(--line);
}
.points-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.points-table + p {
  margin-top: 12px;
}

/* الإعدادات: الحساب، الشكل، القايمة */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.account-grid .form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.account-grid .field {
  align-self: stretch;
}
.theme-pick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.theme-opt {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: var(--r-md);
  border: 2px solid var(--line);
  background: var(--deep);
  font-weight: 700;
}
.theme-opt > span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.theme-opt.is-on {
  border-color: var(--accent-2);
}
.theme-swatch {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  height: 56px;
  padding: 6px;
  border-radius: var(--r-sm);
}
.theme-swatch i {
  border-radius: 4px;
}
.theme-swatch i:first-child {
  grid-row: 1 / -1;
}
.theme-opt-dark .theme-swatch {
  background: #0e1016;
}
.theme-opt-dark .theme-swatch i {
  background: #20242e;
}
.theme-opt-dark .theme-swatch i:last-child {
  background: #8b93f8;
}
.theme-opt-light .theme-swatch {
  background: #f5f6fa;
}
.theme-opt-light .theme-swatch i {
  background: #e0e3ec;
}
.theme-opt-light .theme-swatch i:last-child {
  background: #4f46e5;
}
.theme-opt-system .theme-swatch {
  background: linear-gradient(135deg, #f5f6fa 50%, #0e1016 50%);
}
.theme-opt-system .theme-swatch i {
  background: #a5adfb;
}
.theme-opt-system .theme-swatch i:last-child {
  background: #6366f1;
}
.nav-edit {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.nav-edit li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 4px;
  border-radius: var(--r-sm);
}
.nav-edit li:hover {
  background: var(--deep);
}
.nav-edit li.is-pinned {
  background: var(--accent-soft);
}
.nav-edit li.is-off {
  opacity: 0.5;
}
.nav-edit-icon {
  width: 30px;
  display: grid;
  place-items: center;
  color: var(--accent-2);
}

@media (max-width: 900px) {
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    padding: 28px 20px;
    gap: 16px;
  }
  .auth-mosaic {
    display: none;
  }
  .rewards-hero {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .today-cards {
    grid-template-columns: minmax(0, 1fr);
  }
  .reward {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .reward .meter {
    grid-column: 1 / -1;
  }
  .rewards-level {
    flex-direction: column;
    text-align: center;
  }
  .theme-pick {
    grid-template-columns: 1fr;
  }
  .theme-swatch {
    height: 36px;
  }
}


/* ── زرار العين في خانة كلمة السر ── */
.pw-field { position: relative; display: block; }
.pw-field > input { width: 100%; padding-inline-end: 44px; }
.pw-field > input[dir='ltr'] { padding-right: 44px; padding-left: 12px; }
.pw-eye {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.pw-eye:hover { background: var(--accent-soft); color: var(--accent-ink); }
.pw-eye:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }

/* ── ضبط التنسيق: منع التداخل والخروج برة الكروت ── */
.card,
.day-card,
.tcard,
.hub-card,
.stat,
.grid > *,
.cols > * {
  min-width: 0;
}
h1,
h2,
h3,
.card-head h2 {
  overflow-wrap: anywhere;
}
.task {
  flex-wrap: wrap;
  row-gap: 2px;
  align-items: center;
}
.task-title,
.task-edit {
  flex: 1 1 140px;
}
.task-tag,
.task-project,
.prio-select,
.prio,
.task-late {
  flex: none;
}
.task-project {
  max-width: 100%;
}

/* ── تنضيف المقاسات الصغيرة ── */
.cal-wd .wd-short { display: none; }
@media (max-width: 560px) {
  .cal-wd .wd-long { display: none; }
  .cal-wd .wd-short { display: inline; }
}
.chart-x span:first-child { text-align: start; }
.chart-x span:last-child { text-align: end; }
.chart { max-width: 100%; }
.grid-2 > * { min-width: 0; }
.auth-card { position: relative; }
.auth-theme { position: fixed; top: 14px; inset-inline-end: 14px; z-index: 5; background: var(--panel); border: 1px solid var(--line); }
.swatch-write { background: var(--field); border: 1px solid var(--field-line); box-shadow: inset 0 -2px 0 var(--accent); }

.nowrap {
  white-space: nowrap;
}
.nowrap .icon {
  vertical-align: -2px;
}

/* أيقونات جوه سطر نص */
.nowrap .icon,
.cal-item .icon,
.agenda-text .icon,
.recipe-cat .icon,
.chip-btn .icon,
.field > span .icon,
.idea-row .chip .icon,
p.small .icon,
.chart-y .icon {
  display: inline-block;
  vertical-align: -0.18em;
}
.chip-btn .icon,
.field > span .icon,
p.small .icon {
  margin-inline-end: 4px;
}

/* ═════════════════════════════════════════════════════════════
   هوية بَرَكة v2 — نفس روح صفحة الهبوط
   خط Alexandria للعناوين + IBM Plex Sans Arabic للنص،
   بنفسجي #5c4ade + نعناعي + شمسي، أزرار كبسولة وحواف أنعم
   ═════════════════════════════════════════════════════════════ */
:root {
  --bg: #0d0d10;
  --deep: #111116;
  --panel: #16161c;
  --raised: #202028;
  --line: #2a2a33;
  --ink: #f1f0f7;
  --ink-2: #c9c7d6;
  --muted: #8f8da0;
  --field: #1b1b22;
  --field-line: #31313c;
  --field-hover: #212129;
  --field-focus: #24242d;
  --accent: #7c6cf0;
  --accent-2: #9d90ff;
  --accent-soft: #24203f;
  --accent-ink: #d5ccff;
  --hl: #b3a8ff;
  --hl-ink: #0d0d10;
  --hero: radial-gradient(120% 140% at 100% 0%, #5c4ade 0%, #3b2f9a 42%, #1c1838 100%);
  --hero-ink: #ffffff;
  --gold: #ffd731;
  --blue: #4da2ff;
  --green: #55db9c;
  --red: #ff6a3d;
  --amber: #ffa53d;
  --pink: #f08bc4;
  --t-gold: #ffe37a;
  --t-green: #8eecc0;
  --t-red: #ffb39b;
  --t-amber: #ffcf8f;
  --t-blue: #a8d0ff;
  --mint: #55db9c;
  --sun: #ffd731;
  --lav: #e9ccff;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --pill: 999px;

  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, 'Noto Sans Arabic', system-ui, sans-serif;
  --display: 'Alexandria', 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, sans-serif;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-2);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --bg: #f4f5f9;
    --deep: #eceef4;
    --panel: #ffffff;
    --raised: #eef0f5;
    --line: #e3e5ed;
    --ink: #15151c;
    --ink-2: #3a3a48;
    --muted: #6a6b7c;
    --field: #f7f8fb;
    --field-line: #dcdfe8;
    --field-hover: #f1f2f7;
    --accent: #5c4ade;
    --accent-2: #6f5ff0;
    --accent-soft: #efecff;
    --accent-ink: #3d2fb0;
    --hl: #5c4ade;
    --hl-ink: #ffffff;
    --hero: linear-gradient(135deg, #efe4ff 0%, #e6e3ff 45%, #dceeff 100%);
    --hero-ink: #15151c;
    --gold: #c08a00;
    --blue: #2a7fe0;
    --green: #1f9d63;
    --red: #e0400a;
    --amber: #d07a00;
    --pink: #c94f8f;
    --t-gold: #845c00;
    --t-green: #136b43;
    --t-red: #b3330a;
    --t-amber: #8e5200;
    --t-blue: #1a5fae;
    --shadow: 0 12px 32px rgb(40 30 110 / 0.09);
    --shadow-sm: 0 1px 2px rgb(40 30 110 / 0.06);
  }
}
:root[data-theme='light'] {
    color-scheme: light;
    --bg: #f4f5f9;
    --deep: #eceef4;
    --panel: #ffffff;
    --raised: #eef0f5;
    --line: #e3e5ed;
    --ink: #15151c;
    --ink-2: #3a3a48;
    --muted: #6a6b7c;
    --field: #f7f8fb;
    --field-line: #dcdfe8;
    --field-hover: #f1f2f7;
    --accent: #5c4ade;
    --accent-2: #6f5ff0;
    --accent-soft: #efecff;
    --accent-ink: #3d2fb0;
    --hl: #5c4ade;
    --hl-ink: #ffffff;
    --hero: linear-gradient(135deg, #efe4ff 0%, #e6e3ff 45%, #dceeff 100%);
    --hero-ink: #15151c;
    --gold: #c08a00;
    --blue: #2a7fe0;
    --green: #1f9d63;
    --red: #e0400a;
    --amber: #d07a00;
    --pink: #c94f8f;
    --t-gold: #845c00;
    --t-green: #136b43;
    --t-red: #b3330a;
    --t-amber: #8e5200;
    --t-blue: #1a5fae;
    --shadow: 0 12px 32px rgb(40 30 110 / 0.09);
    --shadow-sm: 0 1px 2px rgb(40 30 110 / 0.06);
}

body {
  font-size: 15.5px;
  line-height: 1.75;
  letter-spacing: 0;
}

/* العناوين والأرقام الكبيرة */
h1,
h2,
.brand,
.ring-label b,
.quick b,
.points-chip b,
.stat b,
.big-num {
  font-family: var(--display);
  letter-spacing: 0;
}
h1 {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  line-height: 1.4;
}
h2 {
  font-size: 17px;
  font-weight: 600;
}
h3 {
  font-weight: 600;
}
.brand {
  font-weight: 700;
  font-size: 21px;
}
.brand .logo-mark,
.logo-mark {
  flex: none;
  display: block;
}

/* الكروت */
.card {
  border-color: var(--line);
  border-radius: var(--r-lg);
}
.card-head {
  margin-bottom: 16px;
}
.card-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* الأزرار: كبسولة */
.btn {
  border-radius: var(--pill);
  padding-inline: 20px;
  font-weight: 600;
  background: var(--accent);
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:hover {
  filter: brightness(1.08);
}
.btn-ghost {
  background: var(--raised);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn-ghost:hover {
  filter: none;
  background: var(--field-hover);
}
.btn-sm {
  border-radius: var(--pill);
}
.icon-btn {
  border-radius: var(--pill);
}
.chip,
.chip-btn {
  border-radius: var(--pill);
}

/* القائمة الجانبية: العنصر النشط كبسولة */
.nav {
  gap: 3px;
}
.nav-link {
  border-radius: var(--pill);
  padding: 9px 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: none;
  font-weight: 600;
}
.nav-link.is-active .icon {
  color: var(--hl);
}

/* الخانات */
input:not([type='checkbox']):not([type='radio']):not([type='range']),
select,
textarea {
  border-radius: var(--r-sm);
}

/* العادات: هادية، اللون في المربع بس */
.habit-toggle {
  background: transparent;
  border: 1px solid var(--line);
  padding: 10px 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.habit-toggle:hover {
  background: var(--field-hover);
  border-color: color-mix(in oklab, var(--c) 45%, var(--line));
}
.habit-toggle .box {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: transparent;
  box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--c) 60%, var(--line));
}
.habit-toggle.is-on {
  background: color-mix(in oklab, var(--c) 7%, transparent);
  border-color: color-mix(in oklab, var(--c) 30%, var(--line));
}
.habit-toggle.is-on .box {
  box-shadow: none;
}
.habit-toggle.is-on .habit-name {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in oklab, var(--c) 60%, transparent);
}

/* الأولوية: قائمة صغيرة بسهم مرسوم بدل سهم المتصفح */
select.prio-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 0;
  height: 26px;
  line-height: 1;
  padding: 0 10px 0 24px;
  border: 0;
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 600;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: left 9px center;
  background-size: 9px 6px;
  cursor: pointer;
}
select.prio-select.prio-none {
  background-color: var(--raised);
}
select.prio-select.prio-imp {
  background-color: color-mix(in oklab, var(--gold) 20%, var(--raised));
}
select.prio-select.prio-urg {
  background-color: color-mix(in oklab, var(--amber) 22%, var(--raised));
}
select.prio-select.prio-both {
  background-color: color-mix(in oklab, var(--red) 24%, var(--raised));
}
.prio-imp {
  background: color-mix(in oklab, var(--gold) 20%, var(--raised));
}
.task:hover .prio-select.prio-none,
.task:focus-within .prio-select.prio-none {
  opacity: 1;
}

/* البلاطات السريعة: صف متساوي من غير فراغات */
.quick-links {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.quick {
  border-radius: var(--r-md);
  padding: 14px 16px;
  gap: 4px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.quick .icon {
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--hl);
  margin-bottom: 4px;
}
.quick b {
  font-size: 19px;
  font-weight: 700;
}
.quick:hover {
  border-color: var(--accent-2);
  transform: translateY(-2px);
}

/* بطاقة اليوم */
.today-hero {
  border-radius: var(--r-lg);
}
.today-hero h2 {
  font-size: 21px;
  font-weight: 700;
}

/* الموبايل */
@media (max-width: 900px) {
  .topbar {
    background: color-mix(in oklab, var(--bg) 86%, transparent);
    backdrop-filter: blur(14px) saturate(1.4);
  }
  .bottom-nav {
    background: color-mix(in oklab, var(--panel) 92%, transparent);
    backdrop-filter: blur(14px) saturate(1.4);
  }
  .bottom-link {
    font-weight: 600;
    border-radius: var(--pill);
  }
  .bottom-link.is-active .icon {
    background: var(--accent-soft);
    border-radius: var(--pill);
    padding: 3px 14px;
    margin-block: -3px;
    box-sizing: content-box;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quick:hover {
    transform: none;
  }
}

/* v2: العادة المنجزة هادية من غير ألوان خلفية */
.habit-toggle.is-on {
  background: transparent;
  border-color: var(--line);
}
.quick-links {
  display: flex;
  flex-wrap: wrap;
}
.quick {
  flex: 1 1 130px;
}

/* v2: «بدون أولوية» زرار دائري صغير بالسهم بس، عشان ما ياخدش سطر لوحده في الأعمدة الضيقة */
select.prio-select.prio-none {
  width: 26px;
  padding: 0;
  color: transparent;
  background-position: center;
  opacity: 0.55;
}
select.prio-select.prio-none:hover,
select.prio-select.prio-none:focus-visible {
  opacity: 1;
}
select.prio-select option {
  color: var(--field-ink);
  background: var(--field);
}
.task-title,
.task-edit {
  flex: 1 1 90px;
}

/* ═══ v7: البداية، طقوس اليوم، رمضان، الملاحظات، البرامج، الأصدقاء، الإشعارات ═══ */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--hl);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.link-btn:hover {
  color: var(--ink);
  text-decoration: underline;
}
.link-btn.danger {
  color: var(--t-red);
}
.grow {
  flex: 1;
  min-width: 0;
}
.grow > small,
.grow > b {
  display: block;
}
.grow .meter {
  margin-top: 6px;
}
.task-time {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.habit-anchor {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 14.5px;
  cursor: pointer;
}
.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: none;
}
.sub-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 16px;
}

/* ── خطة اليوم ومراجعة المساء ── */
.ritual-card {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 12%, var(--panel)), var(--panel) 60%);
}
.ritual-card.is-evening {
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
  background: linear-gradient(160deg, color-mix(in srgb, var(--blue) 12%, var(--panel)), var(--panel) 60%);
}
.ritual-card > p.muted {
  margin: 0 0 12px;
}
.pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--deep);
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.pick:hover {
  border-color: var(--muted);
}
.pick.is-on {
  border-color: var(--accent-2);
  background: var(--accent-soft);
}
.pick-n {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}
.pick.is-on .pick-n {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.ritual-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.ritual-links {
  display: inline-flex;
  gap: 6px;
}
.ritual-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.ritual-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  border-radius: var(--r-md);
  background: var(--deep);
}
.ritual-stats b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.ritual-stats span {
  font-size: 12.5px;
  color: var(--muted);
}
.ritual-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ritual-form .btn {
  align-self: flex-start;
}
.mood-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mood-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 58px;
  padding: 8px 6px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--deep);
  color: var(--muted);
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
}
.mood-pick:hover {
  border-color: var(--muted);
}
.mood-pick.is-on {
  border-color: var(--hl);
  background: var(--raised);
  color: var(--ink);
}
.mood-pick.is-on svg {
  color: var(--t-amber);
}
.ritual-done {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0 0;
  color: var(--t-green);
  font-size: 14px;
}

/* ── رمضان ومواقيت الصلاة ── */
.ramadan-card {
  background: linear-gradient(150deg, color-mix(in srgb, var(--gold) 14%, var(--panel)), var(--panel) 65%);
  border-color: color-mix(in srgb, var(--gold) 35%, var(--line));
}
.ramadan-card h2 svg {
  color: var(--t-gold);
}
.ramadan-times,
.prayer-times {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.prayer-times {
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  margin: 4px 0 14px;
}
.ramadan-times > div,
.prayer-times > li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  border-radius: var(--r-md);
  background: var(--deep);
  text-align: center;
}
.ramadan-times span,
.prayer-times span {
  font-size: 12.5px;
  color: var(--muted);
}
.ramadan-times b,
.prayer-times b {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.w-anchor {
  min-width: 92px;
}

/* ── ملاحظات عنك ── */
.insights {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.insight {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--deep);
}
.insight b {
  font-size: 14.5px;
}
.insight p {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--ink-2);
}
.insight-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--t-blue);
}
.insight.tone-good .insight-icon {
  color: var(--t-green);
}
.insight.tone-warn .insight-icon {
  color: var(--t-amber);
}

/* ── المكافآت: تجميد السلسلة ── */
.freeze-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.freeze-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--blue) 18%, var(--raised));
  color: var(--t-blue);
}
.freeze-text {
  flex: 1 1 220px;
  min-width: 0;
}
.freeze-text p {
  margin: 2px 0 0;
}
.freeze-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── معالج البداية ── */
body[data-layout='auth'] .setup {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 48px) 16px 40px;
}
.setup-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 22px;
  font-weight: 800;
}
.setup-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.setup-steps li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.setup-steps li > span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--deep);
  font-size: 12px;
}
.setup-steps li.is-now {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.setup-steps li.is-now > span {
  background: var(--accent);
  color: var(--on-accent);
}
.setup-steps li.is-done {
  color: var(--t-green);
}
.setup-card {
  padding: clamp(18px, 4vw, 30px);
}
.setup-card h1 {
  margin: 0 0 6px;
  font-size: clamp(21px, 4vw, 26px);
  line-height: 1.4;
}
.setup-card > p {
  margin: 0 0 18px;
}
.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.focus-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 2px solid var(--line);
  background: var(--deep);
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.focus-opt:hover {
  border-color: var(--muted);
}
.focus-opt small {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.focus-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  border-radius: var(--r-md);
  background: var(--raised);
  color: var(--hl);
}
.focus-check {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  color: transparent;
}
.focus-opt.is-on {
  border-color: var(--accent-2);
  background: var(--accent-soft);
}
.focus-opt.is-on .focus-check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.setup-wake {
  margin-bottom: 6px;
}
.setup-wake > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.minutes-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.minutes-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: var(--r-md);
  border: 2px solid var(--line);
  background: var(--deep);
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.minutes-opt small {
  color: var(--muted);
  font-size: 12.5px;
}
.minutes-opt.is-on {
  border-color: var(--accent-2);
  background: var(--accent-soft);
}
.setup-geo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--deep);
}
.setup-geo > div {
  flex: 1 1 260px;
}
.setup-geo b {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.setup-geo p {
  margin: 4px 0 0;
}
.pill-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--t-green);
  font-weight: 700;
  font-size: 14px;
}
.setup-habits,
.setup-perks,
.program-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.setup-habits li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--deep);
  font-weight: 600;
}
.setup-habits svg {
  color: var(--t-green);
}
.setup-perks li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14.5px;
  color: var(--ink-2);
}
.setup-perks svg {
  flex: none;
  margin-top: 3px;
  color: var(--hl);
}
.setup-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.setup-nav .btn-lg:only-child {
  margin-inline-start: auto;
}
.setup-skip {
  display: flex;
  margin: 16px auto 0;
  color: var(--muted);
}

/* ── البرامج ── */
.program-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.program-progress li {
  display: flex;
  align-items: center;
  gap: 12px;
}
.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.program-card {
  display: flex;
  flex-direction: column;
  margin: 0;
}
.program-card.is-active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.program-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.program-card > p {
  margin: 0 0 12px;
  color: var(--ink-2);
}
.program-items li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
}
.program-items svg {
  flex: none;
  margin-top: 4px;
  color: var(--muted);
}
.program-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
}
.program-actions > span {
  margin-inline-end: auto;
}

/* ── الأصدقاء والدوائر ── */
.circle-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.circle-form {
  margin: 0;
}
.circle-form h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.circle-form .field-row {
  display: flex;
  gap: 8px;
}
.circle-form .write {
  flex: 1;
  min-width: 0;
}
.code-input {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
}
.circle-code {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.circle-code code,
.tg-code {
  padding: 3px 10px;
  border-radius: var(--r-sm);
  background: var(--deep);
  border: 1px dashed var(--line);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.circle-challenge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--deep);
}
.circle-challenge.is-done {
  background: color-mix(in srgb, var(--green) 12%, var(--deep));
}
.member-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.member-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
}
.member-list li.is-me {
  background: var(--accent-soft);
}
.member-rank {
  width: 18px;
  flex: none;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.avatar.sm {
  width: 30px;
  height: 30px;
  font-size: 14px;
}
.member-name small {
  font-size: 12px;
}
.member-stats {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.member-stats > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.member-today {
  color: var(--t-green);
}
.circle-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.privacy-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.privacy-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.privacy-card p {
  margin: 4px 0 0;
}

/* ── الإعدادات: مواعيد الإشعارات ── */
.notify-times {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}
.notify-times .check-row {
  grid-column: 1 / -1;
  margin-top: 0;
}
.notify-times .field > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 560px) {
  .minutes-row {
    grid-template-columns: 1fr;
  }
  .member-stats {
    gap: 8px;
  }
  .member-list li {
    flex-wrap: wrap;
  }
  .member-stats {
    width: 100%;
    padding-inline-start: 58px;
  }
}

/* ── إعلان الإدارة + القسم المقفول ─────────────────────────── */
.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.announce-slot:empty {
  display: none;
}
.announce {
  --tone: var(--accent);
  margin: 16px var(--gutter) 0;
  max-width: calc(1320px - 2 * var(--gutter));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--line));
  background: color-mix(in srgb, var(--tone) 12%, var(--panel));
  color: var(--ink);
}
.announce.is-success {
  --tone: var(--green);
}
.announce.is-warning {
  --tone: var(--amber);
}
.announce-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 18%, transparent);
}
.announce p {
  flex: 1;
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.6;
}
.announce a {
  color: var(--tone);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.locked {
  margin: 8vh auto 0;
  max-width: 460px;
}
.locked h1 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--ink);
}
.locked p {
  margin: 0;
  line-height: 1.8;
}
.locked-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  color: var(--accent-ink);
  background: var(--accent-soft);
}
@media (max-width: 900px) {
  .announce {
    margin: 12px 16px 0;
  }
}
