/* ===================================================================
   برنامه هفتگی — استایل اختصاصی صفحه (sc-*)
   هم‌راستا با توکن‌های app.css و الگوی lists.css؛ فقط این صفحه بار می‌شود.
   RTL-first؛ همهٔ فاصله‌ها منطقی (inline/block) هستند.
   =================================================================== */

.sc-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  --sc-radius: 18px;
  --sc-gap: 14px;
  --sc-cell-min: 90px;
  --sc-day-col: 88px;
  --sc-row-h: 62px;
}

/* هر چیزی که با hidden پنهان شده باید واقعاً پنهان بماند
   (display:flex/grid روی کلاس‌ها، ویژگی hidden را بی‌اثر می‌کند) */
.sc-page [hidden] { display: none !important; }

/* ------------------------------- هدر صفحه ------------------------------- */
.wk-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--sc-radius);
  padding: 18px 20px;
  color: #eafff8;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(245, 158, 11, .22), transparent 55%),
    linear-gradient(120deg, #0d3b34 0%, #116a5a 58%, #0d3b34 100%);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.wk-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: .35;
  pointer-events: none;
}
.wk-hero > * { position: relative; z-index: 1; }
.wk-hero-ic {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.wk-hero-txt { flex: 1; min-width: 220px; }
.wk-hero h2 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -.01em;
}
.wk-hero p {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
  color: rgba(234, 255, 248, .78);
  line-height: 1.7;
  max-width: 68ch;
}
.wk-hero-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.wk-kpi {
  min-width: 86px;
  padding: 7px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(4px);
}
.wk-kpi b {
  display: block;
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.wk-kpi span {
  display: block;
  font-size: var(--fs-3xs);
  color: rgba(234, 255, 248, .72);
  white-space: nowrap;
}
.wk-kpi.gold b { color: #ffd894; }
.wk-kpi.danger { background: rgba(220, 38, 38, .22); border-color: rgba(248, 113, 113, .5); }
.wk-kpi.danger b { color: #ffd0d0; }

/* ------------------------------- تب‌ها ------------------------------- */
.wk-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  width: fit-content;
  max-width: 100%;
}
.wk-tab {
  appearance: none;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.wk-tab:hover { color: var(--ink); }
.wk-tab .ic { flex: none; }
.wk-tab[aria-selected="true"] {
  background: var(--paper);
  color: var(--accent-2);
  box-shadow: var(--shadow-xs);
}

.wk-tab-panel { display: block; }

/* ------------------------------- چیدمان ------------------------------- */
.sc-layout {
  display: grid;
  grid-template-columns: 322px minmax(0, 1fr);
  gap: var(--sc-gap);
  align-items: stretch;
  min-height: 0;
}
.sc-side {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 26px);
  overflow: auto;
  padding-inline-end: 2px;
  scrollbar-width: thin;
}
.sc-side::-webkit-scrollbar { width: 6px; }
.sc-side::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 35%, transparent);
  border-radius: 99px;
}
.sc-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --------------------- پرکردن ارتفاع صفحه (دسکتاپ) --------------------- */
@media (min-width: 951px) {
  .sc-page {
    min-height: calc(100vh - 118px);
    --sc-row-h: 68px;
  }
  #wk-tab-grid:not([hidden]) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  #wk-tab-grid .sc-layout { flex: 1; min-height: 0; }
  #wk-tab-grid .sc-main { min-height: 0; }
  #wk-tab-grid .sc-gridwrap {
    flex: 1 1 auto;
    max-height: none;
    min-height: 320px;
  }
  #wk-tab-grid .wk-table { height: 100%; }
  #wk-tab-grid .sc-cell { height: auto; min-height: var(--sc-row-h); }
}

/* ------------------------------- پنل‌ها ------------------------------- */
.sc-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--sc-radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.sc-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), transparent);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink);
}
.sc-panel-head .ic { color: var(--accent-2); flex: none; }
.sc-panel-head .spacer { flex: 1; }
.sc-panel-head .hint {
  font-size: var(--fs-3xs);
  color: var(--muted);
  font-weight: 500;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-panel-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------- کنترل‌ها ------------------------------- */
.sc-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sc-field > label {
  font-size: var(--fs-3xs);
  font-weight: 600;
  color: var(--muted);
}
.sc-field input,
.sc-field select {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: var(--fs-xs);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.sc-field input:focus,
.sc-field select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--ring);
}
.sc-field input[dir="ltr"] { text-align: right; font-variant-numeric: tabular-nums; }

.sc-selectrow { display: flex; align-items: center; gap: 6px; }
.sc-selectrow select { flex: 1; }

.wk-seg {
  display: flex;
  padding: 3px;
  gap: 3px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.wk-seg button {
  appearance: none;
  font: inherit;
  cursor: pointer;
  flex: 1;
  border: 0;
  white-space: nowrap;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: var(--fs-3xs);
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all var(--dur-fast);
}
.wk-seg button .ic { flex: none; }
.wk-seg button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--accent-2);
  box-shadow: var(--shadow-xs);
}
.wk-seg-3 button { padding: 6px 6px; }

.sc-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  font-size: var(--fs-xs);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.sc-check input { width: 15px; height: 15px; accent-color: var(--accent-2); flex: none; }
.sc-check:hover { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line)); }
.sc-check:has(input:checked) {
  border-style: solid;
  border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line));
  background: color-mix(in srgb, var(--accent-2) 8%, var(--paper));
}

.wk-mini,
.sc-iconbtn {
  appearance: none;
  font: inherit;
  cursor: pointer;
  flex: none;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: all var(--dur-fast);
}
.wk-mini { width: 26px; height: 26px; }
.sc-iconbtn { width: 34px; height: 34px; }
.wk-mini:hover,
.sc-iconbtn:hover {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line));
  background: color-mix(in srgb, var(--accent-2) 7%, var(--paper));
  transform: translateY(-1px);
}
.wk-mini:active,
.sc-iconbtn:active { transform: translateY(0); }
.sc-iconbtn:focus-visible,
.wk-mini:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* --------------------------- کپی سریع/تراکم --------------------------- */
.sc-density-note {
  font-size: var(--fs-3xs);
  color: var(--muted);
  margin: -2px 0 0;
}

/* ------------------------------- خلاصه ------------------------------- */
.wk-mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.wk-mini-stats > div {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.wk-mini-stats b {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.25;
}
.wk-mini-stats span { font-size: var(--fs-3xs); color: var(--muted); }
.wk-mini-stats > div.warn { background: color-mix(in srgb, var(--warn) 9%, var(--paper)); border-color: color-mix(in srgb, var(--warn) 32%, var(--line)); }
.wk-mini-stats > div.warn b { color: var(--warn); }

.sc-sum-block { display: flex; flex-direction: column; gap: 7px; }
.sc-sum-title {
  font-size: var(--fs-3xs);
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.sc-sum-title small { font-weight: 500; font-size: var(--fs-3xs); color: var(--muted); opacity: .8; }

.sc-chiplist { display: flex; flex-wrap: wrap; gap: 5px; }
.sc-tag {
  font-size: var(--fs-3xs);
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

/* نمودار میله‌ای توزیع درس‌ها */
.sc-bars { display: flex; flex-direction: column; gap: 6px; }
.sc-bar-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-3xs);
}
.sc-bar-name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-bar {
  height: 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--line) 65%, transparent);
  overflow: hidden;
}
.sc-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--tone-c, var(--accent-2));
  transition: width var(--dur-slow) var(--ease-out);
}
.sc-bar-row b {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  text-align: end;
  font-weight: 700;
}

/* ------------------------------- تداخل‌ها ------------------------------- */
.sc-okbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: var(--fs-xs);
  line-height: 1.65;
  color: var(--good);
  background: color-mix(in srgb, var(--good) 8%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--good) 28%, var(--line));
}
.sc-okbox .ic { flex: none; }
.sc-badge-danger {
  font-size: var(--fs-3xs);
  font-weight: 800;
  color: #fff;
  background: var(--bad);
  border-radius: 999px;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}
.sc-conflict {
  appearance: none;
  font: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: start;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--bad) 24%, var(--line));
  background: color-mix(in srgb, var(--bad) 5%, var(--paper));
  transition: all var(--dur-fast);
}
.sc-conflict:hover {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, var(--paper));
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}
.sc-cf-ic {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 12%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--bad) 26%, var(--line));
}
.sc-cf-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sc-cf-txt b {
  font-size: var(--fs-2xs);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-cf-txt small {
  font-size: var(--fs-3xs);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-cf-classes { color: var(--bad); opacity: .85; }
.sc-cf-go { color: var(--muted); display: grid; place-items: center; }

/* ------------------------------- نوار ابزار ------------------------------- */
.sc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--sc-radius);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.sc-toolbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sc-tt-ic {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 10%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--accent-2) 24%, var(--line));
}
.sc-toolbar-title > div { min-width: 0; display: flex; flex-direction: column; }
.sc-toolbar-title b {
  font-size: var(--fs-md);
  font-weight: 800;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-toolbar-title small {
  font-size: var(--fs-3xs);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.sc-toolbar-actions .btn { display: inline-flex; align-items: center; gap: 5px; }
.sc-toolbar-actions .btn .ic { flex: none; }
.sc-toolbar-actions .btn.good {
  background: linear-gradient(135deg, #03855b, #047857);
  color: #fff;
  border-color: #047857;
}
.sc-tool-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 2px;
}

/* ------------------------------- قلم سریع ------------------------------- */
.sc-quickbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 9%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: var(--shadow-xs);
}
.sc-qb-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--accent);
}
.sc-quickbar select,
.sc-quickbar input {
  font: inherit;
  font-size: var(--fs-xs);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 9px;
  min-width: 130px;
  outline: none;
}
.sc-quickbar select:focus,
.sc-quickbar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}
.sc-quickbar .wk-seg { background: var(--paper); }
.sc-qb-hint { font-size: var(--fs-3xs); color: var(--muted); flex: 1; min-width: 120px; }

/* ------------------------------- جدول ------------------------------- */
.sc-gridwrap {
  overflow: auto;
  max-height: min(74vh, 760px);
  border: 1px solid var(--line);
  border-radius: var(--sc-radius);
  background: var(--paper);
  box-shadow: var(--shadow-xs);
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.sc-gridwrap::-webkit-scrollbar { width: 9px; height: 9px; }
.sc-gridwrap::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 32%, transparent);
  border-radius: 99px;
}

.wk-table {
  width: 100%;
  min-width: calc(var(--sc-day-col) + var(--sc-cols, 7) * var(--sc-cell-min));
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-xs);
  color: var(--ink);
  table-layout: fixed;
}
.wk-table th,
.wk-table td {
  border-bottom: 1px solid var(--line);
  border-inline-start: 1px solid var(--line);
  padding: 0;
  vertical-align: top;
}
/* اولویت بالاتر از padding صفرِ خانه‌های جدول */
.wk-table td.sc-cell { padding: 6px; }
.wk-table tr > *:first-child { border-inline-start: 0; }
.wk-table tbody tr:last-child > * { border-bottom: 0; }

/* سرستون زنگ‌ها — چسبان و افقی */
.wk-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, #14584c, #0d3b34);
  color: #eafff8;
  font-weight: 700;
  text-align: center;
  padding: 9px 6px;
  height: 48px;
}
.wk-table thead th.sc-today {
  background: linear-gradient(180deg, #c2740a, #9a5a05);
  color: #fff8e7;
}
.sc-phead {
  min-width: var(--sc-cell-min);
  width: var(--sc-cell-min);
  padding: 7px 5px !important;
}
.sc-phead b {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 800;
  line-height: 1.35;
}
.sc-phead small {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-2xs);
  font-weight: 500;
  opacity: .82;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

/* ستون روزها — عمودی، چسبان در سمت راست (RTL: inline-start) */
.wk-table .sc-dayrow {
  position: sticky;
  inset-inline-start: 0;
  z-index: 2;
  width: var(--sc-day-col);
  min-width: var(--sc-day-col);
  background: var(--surface-2);
  text-align: center;
  vertical-align: middle;
  padding: 8px 6px;
  border-inline-start: 0;
}
.sc-dayrow .sc-day-ic { display: block; font-size: 16px; line-height: 1; margin-bottom: 3px; opacity: .9; }
.sc-dayrow .sc-day-name {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--ink);
}
.sc-dayrow small {
  display: inline-block;
  margin-top: 3px;
  font-size: 8px;
  font-weight: 700;
  background: var(--accent);
  color: #fff8e7;
  border-radius: 999px;
  padding: 0 7px;
}
.wk-table .sc-dayrow.sc-today {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
}
.sc-daysrow:hover .sc-dayrow { background: color-mix(in srgb, var(--accent-2) 8%, var(--surface-2)); }

/* گوشهٔ چسبان (ستون روز + سرستون زنگ‌ها) */
.sc-corner {
  position: sticky;
  inset-inline-start: 0;
  z-index: 6;
  min-width: var(--sc-day-col);
  width: var(--sc-day-col);
  font-size: var(--fs-2xs);
  font-weight: 700;
}
.wk-table thead th.sc-corner {
  background: linear-gradient(180deg, #0d3b34, #08251f);
  color: #d8efe7;
}

/* خانه‌ها */
.sc-cell {
  position: relative;
  height: var(--sc-row-h);
  padding: 6px;
  cursor: pointer;
  background-color: var(--paper);
  transition: background-color var(--dur-fast), box-shadow var(--dur-fast);
  outline: none;
}
.sc-cell:hover { background-color: color-mix(in srgb, var(--accent-2) 6%, var(--paper)); }
.sc-cell:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-2);
  z-index: 1;
}
.sc-cell.sc-today {
  background-image: linear-gradient(rgba(217, 119, 6, .055), rgba(217, 119, 6, .055));
}
.sc-cell.sc-now {
  box-shadow: inset 0 0 0 2px var(--info);
  animation: scNowPulse 2.4s var(--ease) infinite;
}
.sc-cell.sc-has-conflict { box-shadow: inset 0 0 0 2px var(--bad); }
.sc-cell.sc-pulse { animation: scPulse 1.8s var(--ease-out); }

/* خانهٔ خالی */
.sc-cell.wk-empty {
  text-align: center;
  color: var(--muted);
  background-image: repeating-linear-gradient(
    45deg, transparent 0 7px,
    color-mix(in srgb, var(--line) 32%, transparent) 7px 8px);
}
.sc-cell.wk-empty:hover { background-image: none; color: var(--accent-2); }
.wk-empty-in {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 100%;
  opacity: .6;
  transition: opacity var(--dur-fast), transform var(--dur-fast);
}
.sc-cell.wk-empty:hover .wk-empty-in { opacity: 1; transform: scale(1.04); }
.sc-plus {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  border: 1px dashed currentColor;
}
.wk-empty-t { font-size: var(--fs-2xs); font-weight: 600; }

/* درس‌ها — متن‌ها وسط‌چین برای خوانایی بهتر */
.sc-cell { text-align: center; }
.sc-cell.sc-filled {
  background-color: var(--tone-bg, var(--paper));
  border-inline-start-width: 1px;
}
.sc-cell.sc-filled::before {
  content: "";
  position: absolute;
  inset-block: 6px;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--tone-c, var(--accent-2));
  opacity: .9;
}
.sc-lesson {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding-inline-start: 0;
  text-align: center;
  min-height: 100%;
}
.sc-subj {
  font-size: var(--fs-md);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-wrap: balance;
}
.sc-t {
  font-size: var(--fs-xs);
  color: color-mix(in srgb, var(--ink) 62%, var(--muted));
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-t.sc-t-none { color: #a4550b; opacity: 1; }
.sc-week-chip {
  display: inline-block;
  margin-top: 1px;
  font-size: 10px;
  font-weight: 800;
  color: var(--tone-c, var(--accent-2));
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone-c, var(--accent-2)) 32%, transparent);
  border-radius: 999px;
  padding: 0 6px;
  line-height: 1.6;
}

/* درس‌های یک‌هفته‌درمیان — خانه با یک قطر به دو مثلث تقسیم می‌شود:
   هفتهٔ ۱ در مثلث بالا-راست، هفتهٔ ۲ در مثلث پایین-چپ */
.sc-cell.sc-altcell {
  padding: 0;
  background-color: var(--paper);
}
.sc-cell.sc-altcell::before { display: none; }
.sc-altcell > .sc-lesson { padding: 6px; }

.sc-diag {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
/* رنگ هر مثلث از ::before می‌آید تا متن‌ها با قطر بریده نشوند */
.sc-diag-half { position: static; }
.sc-diag-half::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tone-bg, var(--paper));
}
.sc-diag-a::before { clip-path: polygon(0 0, 100% 0, 100% 100%); }
.sc-diag-b::before { clip-path: polygon(0 0, 0 100%, 100% 100%); }

/* خط قطر: از گوشهٔ بالا-چپ تا گوشهٔ پایین-راست */
.sc-diag::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to top right,
    transparent calc(50% - .8px),
    color-mix(in srgb, var(--ink) 26%, transparent) calc(50% - .8px),
    color-mix(in srgb, var(--ink) 26%, transparent) calc(50% + .8px),
    transparent calc(50% + .8px));
}

.sc-diag-in {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  max-width: 82%;
  padding: 3px 5px;
  line-height: 1.35;
}
.sc-diag-a .sc-diag-in { top: 1px; right: 2px; align-items: flex-end; text-align: right; }
.sc-diag-b .sc-diag-in { bottom: 1px; left: 2px; align-items: flex-start; text-align: left; }

.sc-diag-line {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
}
.sc-diag-wk {
  flex: none;
  font-style: normal;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.5;
  padding: 0 3px;
  border-radius: 4px;
  color: var(--tone-c, var(--accent-2));
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone-c, var(--accent-2)) 30%, transparent);
  font-variant-numeric: tabular-nums;
}
.sc-diag-subj {
  font-size: clamp(10.5px, 1.05vw, 13px);
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sc-diag-t {
  font-size: var(--fs-2xs);
  color: color-mix(in srgb, var(--ink) 60%, var(--muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sc-wk {
  flex: none;
  font-size: 9px;
  font-weight: 800;
  color: var(--tone-c, var(--accent-2));
  background: color-mix(in srgb, var(--paper) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone-c, var(--accent-2)) 28%, transparent);
  border-radius: 5px;
  padding: 0 4px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* نشان تداخل */
.sc-cf-badge {
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  color: #fff;
  background: var(--bad);
  box-shadow: 0 0 0 2px var(--paper);
  z-index: 1;
}

/* --- نمای معلم --- */
.sc-teacher-cell { cursor: pointer; }
.sc-teacher-free { color: var(--muted); }
.sc-teacher-free .wk-empty-t { font-size: var(--fs-2xs); opacity: .7; }
.sc-teacher-free:hover .wk-empty-t { opacity: 1; }
.sc-tcards { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-inline-start: 0; }
.sc-tcard {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  text-align: center;
  gap: 2px 6px;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--tone-bg, var(--surface-2));
  border-inline-start: 3px solid var(--tone-c, var(--accent-2));
}
.sc-tcard-cls { font-size: var(--fs-xs); font-weight: 800; color: var(--ink); }
.sc-tcard-sub { font-size: var(--fs-2xs); color: color-mix(in srgb, var(--ink) 62%, var(--muted)); }
.sc-tcard .sc-wk { margin-inline-start: 0; }

/* حالت فشرده */
.sc-compact .sc-cell { height: 42px; padding: 4px; }
.sc-compact .sc-subj { font-size: var(--fs-3xs); -webkit-line-clamp: 1; }
.sc-compact .sc-t { display: none; }
.sc-compact .sc-diag-in { padding: 1px 3px; }
.sc-compact .sc-diag-t { display: none; }
.sc-compact .sc-diag-subj { font-size: var(--fs-3xs); }
.sc-compact .wk-empty-t { display: none; }
.sc-compact .sc-tcard { padding: 2px 5px; }
.sc-compact .sc-tcard-sub { display: none; }

/* حالت قلم سریع */
.sc-quick-on .sc-cell { cursor: crosshair; }
.sc-quick-on .sc-cell.wk-empty { background-image: none; color: var(--accent); }
.sc-quick-on .sc-cell.wk-empty:hover {
  background-color: color-mix(in srgb, var(--accent) 12%, var(--paper));
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* درگ‌وانداپ */
.sc-cell.sc-dragging { opacity: .45; }
.sc-cell.sc-drop {
  outline: 2px dashed var(--accent-2);
  outline-offset: -3px;
  background-color: color-mix(in srgb, var(--accent-2) 12%, var(--paper));
}

/* پیام خالی/اطلاع */
.sc-stale {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--sc-radius);
  font-size: var(--fs-xs);
  line-height: 1.7;
  color: var(--info);
  background: color-mix(in srgb, var(--info) 7%, var(--paper));
  border: 1px dashed color-mix(in srgb, var(--info) 32%, var(--line));
}

/* ------------------------------- راهنما ------------------------------- */
.wk-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 9px 12px;
  border-radius: 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: var(--fs-3xs);
  color: var(--muted);
}
.sc-lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sc-lg i {
  display: inline-grid;
  place-items: center;
  width: 11px;
  height: 11px;
  border-radius: 4px;
  font-style: normal;
  font-size: 8px;
  font-weight: 800;
}
.sc-lg i.sc-lg-wk {
  width: auto;
  height: auto;
  border-radius: 4px;
  padding: 0 4px;
  color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, var(--line));
  background: color-mix(in srgb, var(--accent-2) 8%, var(--paper));
}
.sc-lg i.sc-lg-cf {
  width: auto;
  height: auto;
  border-radius: 4px;
  padding: 0 5px;
  color: #fff;
  background: var(--bad);
}
.sc-lg-hint { color: var(--muted); opacity: .82; }
.sc-lg-hint .ic { flex: none; }

/* --------------------------- پالت رنگ درس‌ها --------------------------- */
/* پالت رنگ درس‌ها — متن روی زمینهٔ بسیار روشن می‌نشیند تا خوانایی بالا بماند */
.sc-tone-0 { --tone-c: #0f766e; --tone-bg: #f0fbf8; }
.sc-tone-1 { --tone-c: #1d4ed8; --tone-bg: #f2f6ff; }
.sc-tone-2 { --tone-c: #a16207; --tone-bg: #fffaef; }
.sc-tone-3 { --tone-c: #be185d; --tone-bg: #fff4f9; }
.sc-tone-4 { --tone-c: #6d28d9; --tone-bg: #f7f3ff; }
.sc-tone-5 { --tone-c: #0e7490; --tone-bg: #f0fbfd; }
.sc-tone-6 { --tone-c: #c2410c; --tone-bg: #fff5ee; }

.sc-lg i.sc-tone-0, .sc-lg i.sc-tone-1, .sc-lg i.sc-tone-2,
.sc-lg i.sc-tone-3, .sc-lg i.sc-tone-4, .sc-lg i.sc-tone-5,
.sc-lg i.sc-tone-6 { background: var(--tone-c); }
.sc-bar i[class*="sc-tone-"],
.sc-bud-dot { background: var(--tone-c, var(--muted)); }
.sc-bud-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

/* --------------------------- ویرایشگر خانه --------------------------- */
.sc-modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 6px 0 12px;
  padding: 8px 11px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-3xs);
  color: var(--muted);
}
.sc-modal-meta span { display: inline-flex; align-items: center; gap: 5px; }
.sc-modal-meta b { color: var(--ink); font-variant-numeric: tabular-nums; }

.sc-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  align-items: end;
}
.sc-editor-grid > .sc-parts,
.sc-editor-grid > .row { grid-column: 1 / -1; }

.sc-parts { flex-wrap: wrap; gap: 6px !important; }
.sc-parts .btn { font-weight: 600; }

.sc-editor-hint {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  font-size: var(--fs-3xs);
  line-height: 1.7;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 9%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--warn) 32%, var(--line));
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wk-alt-check { margin-top: 10px; }
.wk-alt-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-top: 9px;
  padding: 11px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent-2) 5%, var(--paper));
  border: 1px dashed color-mix(in srgb, var(--accent-2) 34%, var(--line));
}
.wk-alt-box > .sc-parts,
.wk-alt-box > .row { grid-column: 1 / -1; }

.sc-editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* --------------------------- جزئیات معلم --------------------------- */
.sc-td-list { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.sc-td-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.sc-td-week {
  font-size: var(--fs-3xs);
  font-weight: 800;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 10%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--accent-2) 28%, var(--line));
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.sc-td-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sc-td-main b { font-size: var(--fs-xs); color: var(--ink); }
.sc-td-main small { font-size: var(--fs-3xs); color: var(--muted); }
.sc-td-time {
  font-size: var(--fs-3xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------- جعبهٔ خطر --------------------------- */
.sc-danger-box {
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--bad) 26%, var(--line));
  background: color-mix(in srgb, var(--bad) 5%, var(--paper));
  margin-bottom: 10px;
}
.sc-danger-box .field > label { color: var(--bad); }
.sc-danger-box b {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--bad);
}
.sc-danger-all { margin-bottom: 0; }

/* --------------------------- گزینه‌های چاپ --------------------------- */
.sc-print-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.sc-print-card {
  appearance: none;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: start;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--paper);
  transition: all var(--dur-fast);
}
.sc-print-card:hover {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 6%, var(--paper));
  transform: translateY(-2px);
  box-shadow: var(--shadow-xs);
}
.sc-print-ic { font-size: 18px; line-height: 1; margin-bottom: 3px; }
.sc-print-card b { font-size: var(--fs-xs); color: var(--ink); }
.sc-print-card small { font-size: var(--fs-3xs); color: var(--muted); }

/* --------------------------- بودجه‌بندی --------------------------- */
.sc-budget-card { padding: 16px 18px; }
.sc-budget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.sc-budget-head h3 {
  margin: 0;
  font-size: var(--fs-md);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.sc-budget-head h3 .ic { color: var(--accent-2); }
.sc-budget-head p { margin: 5px 0 0; font-size: var(--fs-xs); line-height: 1.7; max-width: 70ch; }
.sc-budget-class {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.sc-budget-class label { font-size: var(--fs-3xs); color: var(--muted); font-weight: 600; white-space: nowrap; }
.sc-budget-class select {
  font: inherit;
  font-size: var(--fs-xs);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  min-width: 160px;
  outline: none;
}
.sc-budget-class select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--ring); }

.sc-budget-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sc-bud-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  max-height: 72vh;
}
/* همهٔ ماه‌ها در عرض صفحه جا می‌شوند؛ در تبلت/موبایل اسکرول افقی می‌ماند */
.sc-bud-table {
  width: 100%;
  min-width: 940px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}
.sc-bud-table th,
.sc-bud-table td { border: 1px solid var(--line); text-align: center; padding: 4px 3px; }
/* همهٔ ردیف‌ها یک ارتفاع ثابت دارند تا جدول یکدست و منظم دیده شود،
   حتی اگر محتوای خانه‌ها (ورودی صفحه، انتخاب درس یا خط تیره) متفاوت باشد */
.sc-bud-table tbody td {
  height: 80px;
  vertical-align: middle;
}
.sc-bud-table thead th { position: sticky; top: 0; z-index: 2; }
.sc-bud-table thead tr:nth-child(2) th { top: 30px; }
.sc-bud-table .sc-bud-now {
  background: linear-gradient(180deg, #f59e0b, #d97706) !important;
  color: #fff !important;
  border-color: #d97706 !important;
}
.sc-bud-table .sc-bud-now small { display: block; font-size: var(--fs-3xs); font-weight: 500; opacity: .9; }
.sc-bud-table .sc-bud-half {
  font-size: var(--fs-3xs);
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 1px;
}
.sc-bud-subjhead {
  vertical-align: middle !important;
  font-weight: 800;
  width: 136px;
  min-width: 136px;
}
.sc-bud-subj {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  width: 136px;
  min-width: 136px;
  text-align: start !important;
  vertical-align: middle;
  background: var(--surface-2);
  padding: 4px 6px !important;
}
.sc-bud-name {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
}
.sc-bud-name strong {
  font-size: var(--fs-xs);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-bud-cell { background: var(--paper); padding: 2px !important; }
.sc-bud-cell .sc-bud-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-inline-end: 4px;
  vertical-align: middle;
}
/* برچسب شیوهٔ بودجه‌بندی — از خود کتاب می‌آید و قابل تغییر نیست */
.sc-bud-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.6;
  color: color-mix(in srgb, var(--accent-2) 75%, var(--ink));
  background: color-mix(in srgb, var(--accent-2) 9%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--accent-2) 24%, var(--line));
  border-radius: 999px;
  padding: 0 8px;
  white-space: nowrap;
}
/* جفت «از/تا»: روی هم می‌نشیند تا عددها بزرگ و خوانا بمانند */
.bud-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
}
.bud-sep { font-size: var(--fs-3xs); line-height: 1; color: var(--muted); opacity: .75; }
/* کتابی که بودجه‌بندی نمی‌خواهد (هنر) — فقط خط تیره، بدون ورودی */
.bud-none {
  display: block;
  text-align: center;
  color: var(--muted);
  opacity: .55;
  font-size: var(--fs-md);
  line-height: 1;
  cursor: help;
}
.bud-in {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 1px 2px;
  height: 24px;
  width: 100%;
  min-width: 0;
  text-align: center;
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur-fast);
}
.bud-in::placeholder { font-size: var(--fs-3xs); font-weight: 500; color: var(--muted); opacity: .75; }
.bud-in:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px var(--ring);
  background: var(--paper);
}
/* انتخاب واحد از کاتالوگ کتاب (حالت «درس» و «کلی») */
.bud-sel {
  font: inherit;
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 1px;
  height: 24px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-align: center;
  text-overflow: ellipsis;
  cursor: pointer;
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur-fast);
}
.bud-sel:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px var(--ring);
  background: var(--paper);
}
.sc-bud-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.sc-bud-foot .btn { display: inline-flex; align-items: center; gap: 6px; }
.sc-bud-foot .muted { font-size: var(--fs-3xs); }

/* --------------------------- انیمیشن‌ها --------------------------- */
@keyframes scNowPulse {
  0%, 100% { box-shadow: inset 0 0 0 2px var(--info); }
  50% { box-shadow: inset 0 0 0 2px var(--info), inset 0 0 0 5px color-mix(in srgb, var(--info) 22%, transparent); }
}
@keyframes scPulse {
  0% { box-shadow: inset 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  35% { box-shadow: inset 0 0 0 3px var(--accent); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
@keyframes scSpin { to { transform: rotate(360deg); } }
.spinning .ic { animation: scSpin .9s linear infinite; transform-origin: center; }

/* --------------------------- حالت شب --------------------------- */
[data-theme="dark"] .sc-tone-0 { --tone-c: #5eead4; --tone-bg: #0f2e2a; }
[data-theme="dark"] .sc-tone-1 { --tone-c: #93b4ff; --tone-bg: #14213f; }
[data-theme="dark"] .sc-tone-2 { --tone-c: #fbbf24; --tone-bg: #33260f; }
[data-theme="dark"] .sc-tone-3 { --tone-c: #f9a8d4; --tone-bg: #351328; }
[data-theme="dark"] .sc-tone-4 { --tone-c: #c4b5fd; --tone-bg: #241a3d; }
[data-theme="dark"] .sc-tone-5 { --tone-c: #67e8f9; --tone-bg: #0d2b33; }
[data-theme="dark"] .sc-tone-6 { --tone-c: #fdba74; --tone-bg: #331a0f; }

[data-theme="dark"] .sc-cell.wk-empty {
  background-image: repeating-linear-gradient(
    45deg, transparent 0 7px,
    rgba(255, 255, 255, .04) 7px 8px);
}
[data-theme="dark"] .wk-table thead th {
  background: linear-gradient(180deg, #0f3f38, #08251f);
}
[data-theme="dark"] .wk-table thead th.sc-corner {
  background: linear-gradient(180deg, #08251f, #051713);
}
[data-theme="dark"] .sc-dayrow { background: #14231d; }
[data-theme="dark"] .sc-cell { background-color: var(--paper); }
[data-theme="dark"] .sc-cell:hover { background-color: #182d25; }
[data-theme="dark"] .sc-cell.sc-today {
  background-image: linear-gradient(rgba(245, 158, 11, .07), rgba(245, 158, 11, .07));
}
[data-theme="dark"] .sc-lg i.sc-lg-wk,
[data-theme="dark"] .sc-wk {
  background: rgba(255, 255, 255, .06);
}
[data-theme="dark"] .sc-week-chip { background: rgba(0, 0, 0, .35); }
[data-theme="dark"] .sc-cf-badge { box-shadow: 0 0 0 2px var(--paper); }
[data-theme="dark"] .sc-bud-cell { background: var(--paper); }
[data-theme="dark"] .bud-in { background: #14231d; }
[data-theme="dark"] .bud-sel { background: #14231d; }
[data-theme="dark"] .sc-print-card:hover { background: #182d25; }

/* --------------------------- واکنش‌گرا --------------------------- */
@media (max-width: 1180px) {
  .sc-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .sc-gridwrap { max-height: 68vh; }
}
@media (max-width: 950px) {
  .sc-layout { grid-template-columns: 1fr; }
  .sc-side {
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .sc-side > .sc-panel:first-child { grid-column: 1 / -1; }
  .sc-gridwrap { max-height: none; }
  .sc-toolbar-actions { width: 100%; }
  .wk-hero { padding: 16px; }
}
@media (max-width: 720px) {
  .wk-hero-stats { width: 100%; }
  .wk-kpi { flex: 1; min-width: 72px; }
  .sc-side { grid-template-columns: 1fr; }
  .sc-side > .sc-panel:first-child { grid-column: auto; }
  .sc-editor-grid,
  .wk-alt-box,
  .sc-print-grid { grid-template-columns: 1fr; }
  .sc-toolbar-actions .btn.sm span { display: none; }
  .sc-tool-sep { display: none; }
  .wk-table { font-size: var(--fs-3xs); }
  .sc-corner { width: 72px; min-width: 72px; }
  .sc-cell { min-width: 88px; }
  .wk-table .sc-dayrow { width: 72px; min-width: 72px; }
  .sc-budget-card { padding: 12px; }
}
@media (max-width: 560px) {
  .wk-tabs { width: 100%; }
  .wk-tab { flex: 1; justify-content: center; }
  .wk-hero { flex-direction: column; align-items: flex-start; }
  .wk-hero-ic { width: 44px; height: 44px; }
  .sc-budget-class { width: 100%; }
  .sc-budget-class select { flex: 1; min-width: 0; }
}

/* --------------------------- کاهش حرکت --------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sc-cell.sc-now,
  .sc-cell.sc-pulse,
  .spinning .ic { animation: none !important; }
  .sc-bar i { transition: none; }
  .sc-iconbtn:hover,
  .wk-mini:hover,
  .sc-conflict:hover,
  .sc-print-card:hover { transform: none; }
}
/* شمارهٔ بخشِ صفحه — کتاب‌هایی که بخش‌بندی دارند (ریاضی اول: ۲۵ بخش) */
.bud-sec {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: color-mix(in srgb, var(--accent-2) 80%, var(--ink));
  white-space: nowrap;
  min-height: 12px;
}

/* ===================================================================
   شایستگی‌های عمومی — پایان بخش بودجه‌بندی، زیر جدول
   =================================================================== */
.sc-gencomp {
  margin-top: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--sc-radius);
  background: var(--paper);
  box-shadow: var(--shadow-xs);
}
.sc-gencomp-head { margin-bottom: 12px; }
.sc-gencomp-head h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 4px;
  font-size: var(--fs-md);
  color: var(--ink);
}
.sc-gencomp-head h4 .ic { color: var(--accent-2); }
.sc-gencomp-head p { margin: 0; font-size: var(--fs-xs); }
.sc-gencomp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.sc-gc-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 12px 13px;
}
.sc-gc-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.sc-gc-no {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-2) 16%, transparent);
  color: var(--accent-2);
  font-size: var(--fs-2xs);
  font-weight: 800;
}
.sc-gc-head h5 {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-line;
}
.sc-gc-block { margin-top: 8px; }
.sc-gc-block > b {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-2xs);
  color: var(--muted);
  margin-bottom: 4px;
}
.sc-gc-block > b .ic { color: var(--accent-2); }
.sc-gc-list {
  margin: 0;
  padding-inline-start: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sc-gc-list li {
  font-size: var(--fs-xs);
  line-height: 1.65;
  color: var(--ink);
}
.sc-gc-empty { margin: 0; font-size: var(--fs-2xs); }
[data-theme="dark"] .sc-gc-card { background: #14231d; }
@media (max-width: 560px) {
  .sc-gencomp { padding: 12px; }
  .sc-gencomp-grid { grid-template-columns: 1fr; }
}
