:root {
  --bg: #f3f6f8;
  --bg-accent: #e7eef2;
  --surface: #ffffff;
  --ink: #15202b;
  --muted: #5b6b78;
  --line: #d5dee5;
  --brand: #0b4f6c;
  --brand-2: #147a8f;
  --brand-soft: #d9eef2;
  --accent: #c45c26;
  --ok: #1f7a4c;
  --warn: #a15c00;
  --danger: #a12828;
  --shadow: 0 10px 30px rgba(15, 40, 60, 0.08);
  --radius: 16px;
  --font: "Vazirmatn", "Tahoma", sans-serif;
}

* { box-sizing: border-box; }
html { direction: rtl; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, #d7ebf0 0%, transparent 42%),
    radial-gradient(circle at 100% 0%, #f7e8dc 0%, transparent 35%),
    linear-gradient(180deg, #f7fafb 0%, var(--bg) 40%, #eef3f6 100%);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }

.shell { max-width: 1120px; margin: 0 auto; padding: 1.25rem; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 1.1rem; margin-bottom: 1.25rem;
  background: rgba(255,255,255,0.86); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; color: var(--brand); }
.brand-mark {
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white; display: grid; place-items: center; font-size: 0.85rem;
}
.nav-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.7rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-size: 0.85rem;
}
.btn, button.btn, input[type=submit].btn {
  appearance: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.65rem 1.1rem; border-radius: 12px; font-family: inherit; font-weight: 600;
  background: var(--brand); color: #fff; transition: transform .15s ease, background .15s ease;
}
.btn:hover { background: var(--brand-2); transform: translateY(-1px); }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid transparent; }
.btn.small { padding: 0.4rem 0.75rem; font-size: 0.85rem; border-radius: 10px; }

.hero {
  position: relative; overflow: hidden;
  border-radius: 28px; min-height: 72vh;
  display: grid; align-items: end;
  background:
    linear-gradient(180deg, rgba(11,79,108,0.15), rgba(11,79,108,0.82)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cpath fill='%23ffffff11' d='M0 80h160v2H0zM80 0v160h2V0z'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #0b4f6c, #1a7f8f 55%, #c45c26);
  color: #fff; padding: 2.5rem;
  box-shadow: var(--shadow);
  animation: rise 0.7s ease both;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem); margin: 0 0 0.6rem; line-height: 1.25;
  letter-spacing: -0.02em; max-width: 14ch;
}
.hero p { margin: 0 0 1.4rem; max-width: 36rem; opacity: 0.92; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero .btn { background: #fff; color: var(--brand); }
.hero .btn.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,0.45); }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem; margin-bottom: 1rem;
  animation: rise 0.55s ease both;
}
.panel h2, .panel h3 { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 800px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .topbar { border-radius: 18px; flex-direction: column; align-items: stretch; }
}

label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.35rem; }
/* Radios and checkboxes are excluded from the global input styling
   (width:100%, padding, border). Without this exclusion they stretch
   to full width and the circle/box is drawn away from its label.
   Their layout is defined in theme.css (.radio-row, .check-row). */
input:not([type=radio]):not([type=checkbox]), select, textarea {
  width: 100%; padding: 0.7rem 0.8rem; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-family: inherit; font-size: 1rem;
}
input:focus, select:focus, textarea:focus,
a:focus-visible, button:focus-visible, .btn:focus-visible, .chip:focus-visible, .tab:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 55%, white);
  outline-offset: 2px;
  border-color: var(--brand);
}

@media print {
  .topbar, .footer-note, .nav-actions, .btn, form { display: none !important; }
  .shell { max-width: none; padding: 0; }
  .panel, .page { box-shadow: none; border: none; }
}
.form-row { margin-bottom: 0.9rem; }
.muted { color: var(--muted); }
.error {
  background: #fdecec; color: var(--danger); border: 1px solid #f3c1c1;
  padding: 0.75rem 1rem; border-radius: 12px; margin-bottom: 1rem;
}
.ok {
  background: #e8f7ef; color: var(--ok); border: 1px solid #bfe6cf;
  padding: 0.75rem 1rem; border-radius: 12px; margin-bottom: 1rem;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.badge {
  display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px;
  background: var(--bg-accent); color: var(--ink); font-size: 0.8rem;
}
.badge.ok { background: #e8f7ef; color: var(--ok); }
.badge.warn { background: #fff4e5; color: var(--warn); }
.badge.danger { background: #fdecec; color: var(--danger); }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tab {
  flex: 1; text-align: center; padding: 0.8rem; border-radius: 12px;
  background: var(--bg-accent); color: var(--muted); font-weight: 600;
}
.tab.active { background: var(--brand); color: #fff; }

.picker {
  position: relative;
}
.picker-results {
  position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 20;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 260px; overflow: auto;
}
.picker-results button {
  width: 100%; text-align: right; border: none; background: transparent;
  padding: 0.7rem 0.85rem; font-family: inherit; cursor: pointer; border-bottom: 1px solid var(--line);
}
.picker-results button:hover { background: var(--brand-soft); }

.steps { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.steps a {
  padding: 0.4rem 0.7rem; border-radius: 999px; background: var(--bg-accent); color: var(--muted); font-size: 0.85rem;
}
.steps a.active { background: var(--brand); color: #fff; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.footer-note { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 2rem 0 1rem; }
mark { background: #ffe8a3; padding: 0 0.1rem; }

/* aliases used by role-specific templates */
.page { margin-bottom: 1rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-header h1 { margin: 0; font-size: 1.45rem; color: var(--brand); }
.btn.primary { background: var(--brand); color: #fff; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.stack { display: grid; gap: 0.75rem; }
.field { margin-bottom: 0.85rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.status-pill { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; background: var(--bg-accent); font-size: 0.8rem; }
.alert { padding: 0.75rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.alert-error { background: #fdecec; color: var(--danger); }
.alert-success { background: #e8f7ef; color: var(--ok); }
.alert-warning { background: #fff4e5; color: var(--warn); border: 1px solid #f0d2a0; }
.alert.notice-spam {
  font-size: 1.05rem; font-weight: 600; line-height: 1.9;
  border-inline-start: 4px solid var(--warn);
  margin: 1rem 0;
  text-wrap: balance;
}

.confirm-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: none; align-items: center; justify-content: center;
  padding: 1rem;
  background: rgba(21, 32, 43, 0.45);
}
.confirm-overlay.is-open { display: flex; }
.confirm-dialog {
  width: min(28rem, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
}
.confirm-dialog__banner {
  padding: 0.85rem 1.1rem;
  background: #fff4e5;
  color: var(--warn);
  border-bottom: 1px solid #f0d2a0;
  font-weight: 700;
}
.confirm-dialog__body { padding: 1.1rem; color: var(--ink); line-height: 1.7; }
.confirm-dialog__body .course-name { font-weight: 700; color: var(--brand); }
.confirm-dialog__actions {
  display: flex; gap: 0.5rem; justify-content: flex-start; flex-wrap: wrap;
  padding: 0 1.1rem 1.1rem;
}

/* Jalali datepicker */
.jdp-container, .jdp-overlay, [class*="jdp"] {
  font-family: var(--font) !important;
}
input[data-jdp] {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230b4f6c' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  padding-left: 2.2rem;
}

.card-lite {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.85rem;
}
.card-lite h3 { margin: 0; font-size: 1rem; color: var(--brand); }
.grid-2 {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem;
}
.grid-2 > label { display: grid; gap: 0.3rem; font-size: 0.92rem; color: var(--muted); }
.grid-2 > label.span-2 { grid-column: 1 / -1; }
.grid-2 input:not([type=radio]):not([type=checkbox]), .grid-2 select, .grid-2 textarea,
fieldset input:not([type=radio]):not([type=checkbox]), fieldset select, fieldset textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 0.55rem 0.7rem; font-family: inherit; background: #fff; color: var(--ink);
}
.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.75rem; }
.wizard-nav-links { margin-bottom: 1rem; color: var(--muted); }
.badge.req { background: #e8f7ef; color: var(--ok); }
.badge.opt { background: var(--bg-accent); color: var(--muted); }

/* Education level panels + switches */
.edu-stack, .ref-stack, .record-board { display: grid; gap: 0.85rem; }
.edu-level, .ref-card, .composer, .record-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.edu-level { overflow: hidden; transition: border-color .2s ease, box-shadow .2s ease; }
.edu-level.is-on { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.edu-level-head, .ref-card-head, .composer-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.95rem 1.1rem; background: linear-gradient(180deg, #f8fbfc, #fff);
  border-bottom: 1px solid transparent;
}
.edu-level.is-on .edu-level-head { border-bottom-color: var(--line); }
.edu-level-title, .ref-card-head { display: flex; align-items: center; gap: 0.75rem; }
.edu-level-title h3, .ref-card-head h3, .composer-title, .record-card h3 {
  margin: 0; font-size: 1.02rem; color: var(--brand);
}
.edu-index {
  width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 0.9rem;
}
.edu-level-body, .ref-card .grid-2, .composer .grid-2 { padding: 0 1.1rem 1.1rem; }
.edu-level:not(.is-on) .edu-level-body {
  display: none;
}

.switch {
  display: inline-flex; align-items: center; gap: 0.55rem;
  cursor: pointer; user-select: none; margin: 0; color: var(--ink); font-size: 0.9rem;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 2.7rem; height: 1.55rem; border-radius: 999px;
  background: #c9d4dc; position: relative; transition: background .2s ease;
  flex: 0 0 auto;
}
.switch-thumb {
  position: absolute; top: 0.18rem; inset-inline-start: 0.18rem;
  width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: inset-inline-start .2s ease, transform .2s ease;
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track .switch-thumb { inset-inline-start: 1.3rem; }
.switch.is-locked { cursor: default; opacity: 0.92; }
.switch-text { color: var(--muted); white-space: nowrap; }
.switch-row {
  display: flex !important; flex-direction: row !important; align-items: center;
  justify-content: space-between; gap: 1rem; color: var(--ink) !important;
  padding: 0.75rem 0.9rem; border: 1px dashed var(--line); border-radius: 12px; background: #f8fbfc;
}

/* Record list + composer */
.record-list { display: grid; gap: 0.75rem; }
.record-card {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  padding: 1rem 1.1rem; animation: rise .25s ease both;
}
.record-card.is-editing { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.record-card-main { display: flex; gap: 0.85rem; min-width: 0; flex: 1; }
.record-card-index {
  width: 2rem; height: 2rem; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700;
}
.record-card-body { min-width: 0; }
.record-card-body p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.record-card-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.empty-state {
  padding: 1.25rem; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 14px; background: rgba(255,255,255,.55);
}
.composer { padding-bottom: 0.35rem; }
.composer-head { border-bottom: 1px solid var(--line); }
.composer-meta { color: var(--muted); font-size: 0.85rem; }
.composer-actions {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0 1.1rem 1.1rem;
}
.composer.is-disabled { opacity: 0.72; }
.composer-error { color: var(--danger) !important; }
.ref-card { padding-bottom: 0.35rem; }
.ref-card-head { border-bottom: 1px solid var(--line); margin-bottom: 0; }

@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 > label.span-2 { grid-column: auto; }
  .edu-level-head, .record-card { flex-direction: column; align-items: stretch; }
  .switch-text { white-space: normal; }
}

/* alpha.48 — reasons under a disabled «ارسال نهایی» */
.submit-reasons { margin-top: .5rem; font-size: .8125rem; line-height: 1.9; color: var(--danger); }
.submit-reasons__head { margin: 0; font-weight: 700; }
.submit-reasons ul { margin: .25rem 0 0; padding: 0; list-style: none; }
.submit-reasons li::before { content: "✖ "; }
.submit-reasons a { color: inherit; text-decoration: underline; }
