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

:root {
  font-family: "IBM Plex Sans Arabic", Tahoma, sans-serif;
  color: #202b28;
  background: #f5f4ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #202b28;
  --muted: #7e8984;
  --line: #e7e7df;
  --paper: #fffefa;
  --green: #1f7562;
  --green-dark: #185c4d;
  --lime: #d9ed83;
  --orange: #f2a56f;
  --radius: 18px;
  --shadow: 0 16px 50px rgba(32, 43, 40, .045);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(ellipse at 74% 0%, rgba(219, 234, 197, .23), transparent 36%), #f5f4ef;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
.app-shell { max-width: 1440px; margin: auto; padding: 0 5.3% 28px; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(32, 43, 40, .09); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.5px; }
.brand-mark { width: 31px; height: 31px; border-radius: 10px; background: #1f7562; display: grid; grid-template-columns: repeat(2, 7px); grid-template-rows: repeat(2, 7px); justify-content: center; align-content: center; gap: 3px; transform: rotate(-4deg); }
.brand-mark span { background: #e6f1cd; border-radius: 2px; }
.brand-mark span:nth-child(2) { opacity: .72; }
.brand-mark span:nth-child(3) { opacity: .82; }
.brand-copy { display: flex; flex-direction: column; gap: 1px; }
.brand-school { color: #728078; font-size: 10px; font-weight: 500; }
.topbar-actions { display: flex; gap: 20px; align-items: center; }
.save-state { font-size: 12px; color: #6d7873; display: flex; align-items: center; gap: 7px; }
.save-state i { width: 6px; height: 6px; border-radius: 50%; background: #50a887; box-shadow: 0 0 0 3px #e0efe7; }
.save-state.saving i { background: #e6a252; }
.icon-button, .quiet-button, .text-button, .view-button, .footer button { border: 0; background: none; cursor: pointer; }
.icon-button { color: #69756f; border: 1px solid var(--line); padding: 8px 12px; border-radius: 9px; font-size: 12px; transition: .2s; }
.icon-button:hover, .quiet-button:hover { border-color: #aebcb3; color: var(--green); }
.button-label { margin-right: 7px; }
.intro { padding: 50px 0 45px; display: flex; align-items: center; justify-content: space-between; max-width: 980px; }
.eyebrow, .section-kicker { font-size: 11px; font-weight: 600; letter-spacing: .05em; color: var(--green); display: inline-flex; align-items: center; gap: 8px; }
.eyebrow { margin: 0 0 13px; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
h1, h2, p { margin-top: 0; }
.intro h1 { font-size: clamp(36px, 5vw, 61px); line-height: 1.26; letter-spacing: -2.3px; margin: 0; color: #25322e; font-weight: 600; }
.intro h1 em { color: var(--green); font-style: normal; }
.intro-text { color: #78837e; font-size: 14px; line-height: 1.9; max-width: 510px; margin: 13px 0 0; }
.week-stamp { margin-left: 7%; width: 116px; height: 116px; min-width: 116px; border: 1px solid #dce2d4; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; color: var(--green); background: rgba(255, 255, 255, .4); }
.stamp-number { font-size: 46px; font-weight: 600; line-height: 1; }
.stamp-label { font-size: 10px; line-height: 1.5; margin-right: 8px; }
.stamp-spark { position: absolute; left: 0; top: 2px; color: #db9870; font-size: 15px; }
.planner { background: var(--paper); border: 1px solid #eae9e1; border-radius: 20px; padding: 24px 24px 18px; box-shadow: var(--shadow); }
.section-heading, .subjects-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-kicker { font-size: 10px; color: #8b9690; margin-bottom: 6px; }
.section-heading h2, .subjects-heading h2, .dialog-topbar h2 { font-size: 21px; letter-spacing: -.6px; margin: 0; font-weight: 600; color: #293631; }
.heading-actions { display: flex; gap: 9px; align-items: center; }
.grade-picker { display: inline-flex; align-items: center; gap: 6px; color: #758078; font-size: 10px; white-space: nowrap; }
.grade-picker select { border: 1px solid #e3e6de; border-radius: 8px; background: #fffefa; color: var(--green); padding: 7px 9px; font: inherit; cursor: pointer; outline: none; }
.grade-picker select:focus { border-color: #87aa93; }
.standalone-link { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.view-switch { background: #f2f3ee; padding: 3px; border-radius: 9px; display: flex; }
.view-button { border: 0; background: transparent; color: #77817c; padding: 6px 11px; border-radius: 7px; font-size: 11px; cursor: pointer; }
.view-button[aria-pressed="true"] { background: #fffefa; color: var(--ink); box-shadow: 0 1px 4px rgba(30, 42, 36, .09); }
.quiet-button { height: 34px; border: 1px solid #e8e8e0; border-radius: 8px; padding: 0 11px; font-size: 11px; color: #727e77; transition: .2s; }
.quiet-button span { color: var(--green); margin-left: 5px; }
.schedule-frame { overflow: auto; scrollbar-color: #d8ddd4 transparent; scrollbar-width: thin; }
.schedule-grid { display: grid; grid-template-columns: 78px repeat(var(--day-count), minmax(135px, 1fr)); min-width: 870px; gap: 7px; direction: rtl; }
.schedule-grid.day-mode { grid-template-columns: 74px minmax(190px, 1fr); min-width: 0; max-width: 680px; margin: auto; }
.comparison-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 2px 3px 10px; color: #7d8881; font-size: 11px; }
.comparison-header strong { color: var(--green); font-size: 14px; font-weight: 600; }
.comparison-scroll { overflow-x: auto; scrollbar-color: #d8ddd4 transparent; scrollbar-width: thin; }
.comparison-table { width: 100%; min-width: 980px; table-layout: fixed; border-collapse: separate; border-spacing: 6px; direction: rtl; }
.comparison-table th { height: 42px; padding: 5px; border-radius: 9px; background: #f6f6f0; color: #68756d; font-size: 10px; font-weight: 600; text-align: center; }
.comparison-table th:first-child { width: 112px; }
.comparison-table tbody th { background: #f3f5ee; color: #64746a; }
.comparison-table tr.active-grade th { background: #e5f0df; color: var(--green); }
.comparison-table td { height: 65px; padding: 5px; border: 1px solid #eeeee7; border-radius: 10px; background: #fffefa; text-align: center; }
.comparison-subject { min-height: 45px; padding: 7px 8px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; color: var(--chip-ink); background: var(--chip-bg); font-size: 10px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.comparison-subject .color-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--chip-dot); flex: none; }
.comparison-empty { color: #b7beb8; font-size: 14px; }
.grid-head { height: 48px; background: #f6f6f0; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #6b7771; font-size: 11px; font-weight: 600; }
.grid-head.today { background: #eaf3e4; color: var(--green); }
.grid-head.corner { background: transparent; color: #9aa19b; font-size: 10px; }
.period-label { display: flex; align-items: center; justify-content: center; color: #77817b; font-family: "DM Mono", "IBM Plex Sans Arabic", sans-serif; font-size: 13px; min-height: 76px; border-left: 1px solid #ededE6; }
.schedule-cell { background: #fffefa; border: 1px solid #eeeee7; border-radius: 11px; min-height: 76px; padding: 7px; display: flex; align-items: stretch; position: relative; transition: background .16s, border-color .16s, transform .16s; }
.schedule-cell:hover { background: #fbfcf7; border-color: #dbe5d5; }
.schedule-cell.drop-target { background: #edf5dc; border: 1px dashed #71a087; transform: scale(.99); }
.schedule-cell.is-empty { justify-content: center; align-items: center; }
.empty-prompt { color: #b1b9b2; font-size: 10px; display: flex; align-items: center; gap: 5px; transition: .15s; }
.empty-prompt b { font-size: 17px; font-weight: 400; color: #a3b1a3; }
.schedule-cell.is-empty:hover .empty-prompt { color: var(--green); }
.subject-chip { --chip-bg: #f1eee5; --chip-ink: #706148; --chip-dot: #b29c6c; display: flex; align-items: center; gap: 8px; text-align: right; border: 0; border-radius: 8px; color: var(--chip-ink); background: var(--chip-bg); font-size: 11px; font-weight: 600; line-height: 1.55; position: relative; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.subject-chip:active { cursor: grabbing; }
.subject-chip .color-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--chip-dot); flex: none; }
.subject-chip.is-placed { width: 100%; justify-content: space-between; padding: 8px 9px; min-height: 50px; align-self: center; }
.subject-chip .chip-name { display: flex; align-items: center; gap: 7px; }
.subject-chip .remove-chip { background: transparent; border: 0; color: currentColor; opacity: .47; cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 3px; border-radius: 4px; }
.subject-chip .remove-chip:hover { opacity: 1; background: rgba(255, 255, 255, .56); }
.subject-bank { display: flex; flex-wrap: wrap; gap: 8px; padding: 15px; background: #f8f8f3; border: 1px dashed #e0e5dc; border-radius: 13px; min-height: 82px; transition: .2s; }
.subject-bank.drop-target { background: #edf5dc; border-color: #71a087; }
.bank-chip { padding: 8px 11px; transition: transform .16s, box-shadow .16s, outline .16s; }
.bank-chip:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(32, 43, 40, .08); }
.bank-chip.selected { outline: 2px solid var(--chip-dot); outline-offset: 2px; box-shadow: 0 3px 12px rgba(32, 43, 40, .09); }
.day-tabs { display: flex; overflow-x: auto; gap: 6px; padding: 0 0 14px; scrollbar-width: none; }
.day-tabs[hidden] { display: none; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab { flex: none; border: 1px solid #e9e9e2; border-radius: 9px; background: white; color: #748079; padding: 7px 12px; font-size: 11px; cursor: pointer; }
.day-tab.active { color: white; background: var(--green); border-color: var(--green); }
.schedule-footnote { display: flex; align-items: center; gap: 8px; color: #959f99; font-size: 10px; padding: 14px 2px 0; }
.footnote-mark { color: #9aac82; font-size: 16px; }
.subjects-section { padding: 36px 0 20px; }
.subjects-heading { margin-bottom: 13px; }
.subjects-heading h2 { font-size: 20px; }
.subject-count { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; width: 21px; height: 21px; background: #e8eee2; color: #678071; border-radius: 7px; font-size: 10px; font-weight: 500; margin-right: 5px; }
.text-button { color: var(--green); font-size: 12px; padding: 6px; }
.text-button span { font-size: 17px; vertical-align: -1px; }
.subjects-note { font-size: 10px; color: #939c96; margin: 12px 3px 0; }
.subjects-note span { color: #a3b68a; margin-left: 4px; }
.add-subject-form { display: flex; gap: 7px; margin-top: 10px; max-width: 430px; }
.add-subject-form input, .dialog-content textarea { border: 1px solid #e3e6dd; border-radius: 8px; background: white; color: var(--ink); padding: 9px 11px; outline: none; }
.add-subject-form input:focus, .dialog-content textarea:focus { border-color: #87aa93; }
.add-subject-form input { flex: 1; min-width: 0; font-size: 12px; }
.add-subject-form button { border: 0; border-radius: 8px; background: var(--green); color: white; padding: 0 14px; font-size: 11px; cursor: pointer; }
.add-subject-form .cancel-add { background: #f0f1ec; color: #66716b; }
.footer { display: flex; justify-content: space-between; align-items: center; padding: 17px 2px 0; color: #98a09a; font-size: 10px; border-top: 1px solid #e7e8e1; }
.footer span span { color: #d39873; }
.footer-credits { display: flex; flex-direction: column; align-items: center; gap: 3px; color: #78847d; line-height: 1.6; text-align: center; }
.footer button { color: #a0a7a0; font-size: 10px; padding: 5px; }
.footer button:hover { color: #ad5c49; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; background: #26352f; color: white; padding: 10px 15px; border-radius: 10px; font-size: 12px; box-shadow: 0 8px 30px #1d312a33; transition: .22s; z-index: 20; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.settings-dialog { width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 30px); padding: 23px; border: 1px solid #e6e8df; border-radius: 18px; background: #fffefa; color: var(--ink); box-shadow: 0 24px 90px #18251d33; }
.settings-dialog::backdrop { background: rgba(27, 39, 33, .36); backdrop-filter: blur(3px); }
.dialog-topbar { display: flex; justify-content: space-between; align-items: center; border: 0; padding: 0; margin-bottom: 19px; }
.dialog-topbar h2 { font-size: 20px; }
.close-dialog { width: 32px; height: 32px; border: 0; border-radius: 9px; background: #f2f3ee; font-size: 23px; cursor: pointer; color: #78837d; }
.dialog-content { display: grid; gap: 8px; }
.dialog-content label { font-size: 12px; font-weight: 600; margin-top: 8px; }
.dialog-content small { font-weight: 400; color: #929b95; margin-right: 8px; font-size: 10px; }
.dialog-content textarea { resize: vertical; font-size: 12px; line-height: 1.9; min-height: 78px; }
.backup-tools { margin-top: 17px; padding: 13px; border: 1px solid #e8ebe2; border-radius: 11px; background: #f8f8f3; }
.backup-tools strong { color: #53675a; font-size: 12px; }
.backup-tools p { margin: 5px 0 10px; color: #858f88; font-size: 10px; line-height: 1.7; }
.backup-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.backup-buttons button { border: 0; border-radius: 8px; padding: 9px 12px; font-size: 10px; cursor: pointer; }
.dialog-actions { display: flex; justify-content: space-between; gap: 9px; margin-top: 18px; }
.dialog-actions button { border: 0; border-radius: 8px; padding: 10px 14px; font-size: 11px; cursor: pointer; }
.secondary-button { background: #f1f2ed; color: #707b74; }
.primary-button { background: var(--green); color: white; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.drag-ghost { position: fixed; z-index: 30; pointer-events: none; opacity: .92; transform: translate(-50%, -50%) rotate(-2deg); box-shadow: 0 10px 28px rgba(27, 54, 42, .2); max-width: 180px; }
.dragging-source { opacity: .25 !important; }
.save-state.saving { color: #b47a3b; }

@media (max-width: 900px) {
  .app-shell { padding-right: 4%; padding-left: 4%; }
  .intro { padding-top: 39px; padding-bottom: 35px; }
  .planner { padding: 20px 17px 15px; }
  .schedule-grid { min-width: 800px; }
}
@media (max-width: 640px) {
  .app-shell { padding: 0 16px 20px; }
  .topbar { height: 66px; }
  .topbar-actions { gap: 11px; }
  .save-state { font-size: 10px; }
  .icon-button { padding: 7px 9px; }
  .standalone-link { font-size: 9px; }
  .button-label { font-size: 10px; }
  .intro { padding: 32px 0 28px; align-items: flex-start; }
  .intro h1 { font-size: 39px; letter-spacing: -1.5px; }
  .intro-text { font-size: 12px; max-width: 310px; line-height: 1.8; }
  .week-stamp { width: 73px; height: 73px; min-width: 73px; margin: 10px 0 0 2px; }
  .stamp-number { font-size: 31px; }
  .stamp-label { font-size: 8px; margin-right: 5px; }
  .stamp-spark { font-size: 11px; }
  .section-heading, .subjects-heading { align-items: flex-start; }
  .section-heading h2, .subjects-heading h2 { font-size: 18px; }
  .planner { padding: 17px 12px 13px; border-radius: 15px; }
  .heading-actions { gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
  .view-button { padding: 6px 9px; font-size: 10px; }
  .comparison-table { min-width: 900px; }
  .quiet-button { height: 31px; padding: 0 8px; font-size: 10px; }
  .print-button { display: none; }
  .day-tabs { display: flex; }
  .schedule-frame { overflow-x: auto; }
  .schedule-grid { grid-template-columns: 58px minmax(0, 1fr); min-width: 0; gap: 6px; }
  .schedule-grid.week-mode { min-width: 740px; }
  .schedule-grid.day-mode { grid-template-columns: 52px minmax(0, 1fr); }
  .grid-head { height: 41px; font-size: 10px; }
  .period-label { min-height: 69px; font-size: 12px; }
  .schedule-cell { min-height: 69px; padding: 6px; border-radius: 9px; }
  .subject-chip.is-placed { min-height: 46px; padding: 7px 8px; font-size: 11px; }
  .empty-prompt { font-size: 10px; }
  .schedule-footnote { font-size: 9px; padding-top: 11px; }
  .subjects-section { padding-top: 29px; }
  .subjects-heading { align-items: flex-end; }
  .subject-bank { padding: 11px; gap: 7px; }
  .bank-chip { font-size: 10px; padding: 7px 9px; }
  .footer { font-size: 9px; flex-wrap: wrap; gap: 8px; }
  .footer-credits { flex-basis: 100%; order: 3; align-items: flex-start; text-align: right; }
  .toast { font-size: 11px; max-width: calc(100vw - 26px); white-space: normal; text-align: center; width: max-content; }
  .dialog-actions button { font-size: 10px; padding: 10px; }
  .backup-buttons { flex-direction: column; }
  .backup-buttons button { width: 100%; }
}
@media print {
  body { background: white; }
  .app-shell { max-width: none; padding: 0; }
  .topbar { height: 50px; }
  .topbar-actions, .intro, .heading-actions, .day-tabs, .schedule-footnote, .subjects-section, .remove-chip { display: none !important; }
  .footer { display: flex !important; }
  .footer button { display: none !important; }
  .planner { border: 0; box-shadow: none; padding: 0; }
  .section-heading { margin-bottom: 12px; }
  .schedule-frame { overflow: visible; }
  .schedule-grid { min-width: 0; grid-template-columns: 60px repeat(var(--day-count), 1fr); gap: 4px; }
  .schedule-cell { min-height: 58px; border-color: #ddd; }
  .subject-chip.is-placed { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .grid-head { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Higher-contrast supporting text for easier reading. */
:root { --muted: #4d5a52; }
.brand-school, .save-state, .icon-button, .intro-text, .section-kicker, .grade-picker, .view-button, .quiet-button, .comparison-header, .comparison-table th, .grid-head, .period-label, .empty-prompt, .day-tab, .schedule-footnote, .subjects-note, .footer, .footer-credits, .dialog-content small, .backup-tools p, .secondary-button { color: #4d5a52; }
.brand-school, .save-state, .section-kicker, .grade-picker, .view-button, .quiet-button, .comparison-table th, .grid-head, .day-tab, .footer-credits, .dialog-content small, .backup-tools p, .secondary-button { font-weight: 600; }
.intro-text, .schedule-footnote, .subjects-note, .footer { font-weight: 500; }
.section-kicker { color: #496151; }
.comparison-empty, .grid-head.corner, .empty-prompt, .empty-prompt b { color: #626f66; }
.subject-chip, .comparison-subject { font-weight: 700; }
