:root {
  --green: #10b981;
  --green-dark: #047857;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --white: #ffffff;
  --bg: #f6fbff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 20px;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08)
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('truetype');
    font-weight: 400;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('truetype');
    font-weight: 500;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-SemiBold.woff2') format('truetype');
    font-weight: 600;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('truetype');
    font-weight: 700;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  /* font-family: Tahoma, Arial, sans-serif; */
  font-family: 'Vazirmatn', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65
}

a {
  color: var(--blue);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

h1,
h2,
h3,
p {
  margin-top: 0
}

small {
  display: block;
  color: var(--muted);
  font-size: .82rem
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: .2s
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12)
}

label {
  font-size: .9rem;
  color: #334155;
  font-weight: 700
}

/* Jalali calendar popover used by every Persian date/date-time field. */
.jalali-date,
.jalali-datetime {
  cursor: pointer;
  background-image: linear-gradient(135deg, transparent 0 82%, #eff6ff 82% 100%);
}

.jalali-picker {
  position: absolute;
  z-index: 1000;
  width: min(320px, calc(100vw - 24px));
  padding: 12px;
  direction: rtl;
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .2);
  color: var(--text)
}

.jalali-picker[hidden] {
  display: none
}

.jalali-picker__header {
  display: grid;
  grid-template-columns: 32px 32px 1fr 32px 32px;
  align-items: center;
  gap: 2px;
  margin-bottom: 10px
}

.jalali-picker__title {
  text-align: center;
  font-size: .96rem;
  color: #0f172a
}

.jalali-picker__nav,
.jalali-picker__day,
.jalali-picker__today,
.jalali-picker__text-button,
.jalali-picker__confirm {
  border: 0;
  font: inherit;
  cursor: pointer
}

.jalali-picker__nav {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  font-size: 1.2rem;
  line-height: 1
}

.jalali-picker__nav:hover,
.jalali-picker__nav:focus-visible {
  background: #dbeafe;
  color: var(--blue)
}

.jalali-picker__weekdays,
.jalali-picker__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center
}

.jalali-picker__weekdays {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800
}

.jalali-picker__day {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155
}

.jalali-picker__day:hover,
.jalali-picker__day:focus-visible {
  background: #dbeafe;
  color: var(--blue);
  outline: none
}

.jalali-picker__day.is-today {
  color: var(--green-dark);
  font-weight: 900;
  box-shadow: inset 0 0 0 1px #6ee7b7
}

.jalali-picker__day.is-selected {
  background: var(--blue);
  color: #fff;
  box-shadow: none
}

.jalali-picker__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line)
}

.jalali-picker__footer label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: .8rem
}

.jalali-picker__time {
  width: 92px;
  padding: 6px 8px;
  border-radius: 9px;
  font-family: inherit;
  direction: ltr
}

.jalali-picker__footer > div {
  display: flex;
  gap: 5px
}

.jalali-picker__today,
.jalali-picker__text-button,
.jalali-picker__confirm {
  padding: 7px 10px;
  border-radius: 9px;
  font-size: .8rem;
  font-weight: 800
}

.jalali-picker__today,
.jalali-picker__text-button {
  background: #eff6ff;
  color: #1d4ed8
}

.jalali-picker__confirm {
  background: var(--blue);
  color: #fff
}

.check {
  display: flex;
  align-items: center;
  gap: 8px
}

.exam-target-mode {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap
}

#multipleChoiceFields {
  display: grid;
  gap: 10px
}

.check input {
  width: auto
}

.app-shell {
  display: flex;
  min-height: 100vh
}

.sidebar {
  width: 288px;
  background: linear-gradient(180deg, #ffffff, #ecfeff);
  border-left: 1px solid var(--line);
  padding: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  z-index: 20
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px
}

.brand.big {
  margin-bottom: 20px
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 24px;
  box-shadow: 0 12px 25px rgba(16, 185, 129, .24)
}

.brand strong {
  display: block
}

.brand small {
  font-size: .78rem
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 7px
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 14px;
  color: #0f172a;
  font-weight: 700
}

.nav-link:hover {
  background: #eef8ff;
  text-decoration: none
}

.nav-title {
  font-size: .76rem;
  color: var(--muted);
  font-weight: 900;
  margin: 14px 8px 4px
}

.sidebar-footer {
  margin-top: 22px;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: .86rem
}

.role-chip {
  display: inline-flex;
  background: #ecfdf5;
  color: var(--green-dark);
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 5px
}

.main {
  flex: 1;
  padding: 22px;
  min-width: 0
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px
}

.topbar h1 {
  font-size: 1.55rem;
  margin-bottom: 2px
}

.topbar p {
  color: var(--muted);
  margin: 0
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px
}

.date-pill {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  color: #475569
}

.icon-button {
  display: none;
  border: 0;
  background: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 20px;
  box-shadow: var(--shadow)
}

.card {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px
}

.soft-help {
  background: linear-gradient(135deg, #eff6ff, #ecfdf5)
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px
}

.section-head h2,
.card h2 {
  font-size: 1.12rem;
  margin-bottom: 8px
}

.grid {
  display: grid;
  gap: 18px
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr))
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden
}

.stat-card:after {
  content: "";
  position: absolute;
  left: -30px;
  top: -30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(37, 99, 235, .09)
}

.stat-card.green:after {
  background: rgba(16, 185, 129, .13)
}

.stat-card.red:after {
  background: rgba(239, 68, 68, .12)
}

.stat-card.blue:after {
  background: rgba(37, 99, 235, .13)
}

.stat-card span {
  color: var(--muted);
  font-weight: 800
}

.stat-card strong {
  display: block;
  font-size: 1.65rem;
  margin-top: 6px;
  color: #0f172a;
  word-break: break-word
}

.stat-card small {
  margin-top: 4px
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 14px;
  padding: 10px 16px;
  font-family: inherit;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  transition: .18s;
  white-space: nowrap
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px)
}

.btn.primary {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #fff
}

.btn.ghost {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--line)
}

.btn.tiny {
  padding: 6px 10px;
  font-size: .82rem;
  border-radius: 10px
}

.btn.full {
  width: 100%
}

.link {
  font-weight: 900
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  font-weight: 800
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 900;
  font-size: .78rem
}

.badge.mini {
  padding: 2px 8px;
  background: var(--blue);
  color: #fff
}

.badge.success {
  background: #dcfce7;
  color: #166534
}

.badge.danger {
  background: #fee2e2;
  color: #991b1b
}

.badge.warning {
  background: #fef3c7;
  color: #92400e
}

.stack-form {
  display: grid;
  gap: 10px
}

.inline-form {
  display: flex;
  align-items: end;
  gap: 10px
}

.inline-form.wrap {
  flex-wrap: wrap
}

.inline-form.wrap>* {
  min-width: 180px;
  flex: 1
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px
}

.inline {
  display: inline
}

.reset-form input {
  width: 110px;
  display: inline-block;
  padding: 6px 8px;
  border-radius: 8px
}

.mini-update {
  display: grid;
  gap: 7px;
  min-width: 180px
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px
}

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.flash-wrap {
  margin-bottom: 8px
}

.flash {
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  background: #fff
}

.flash.success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0
}

.flash.danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca
}

.flash.warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a
}

.flash.info {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe
}

.course-list {
  display: grid;
  gap: 12px
}

.course-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #f8fafc)
}

.course-card.compact {
  padding: 13px
}

.course-card h3 {
  margin-bottom: 6px
}

.course-card h3 span {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 700
}

.mini-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0
}

.mini-stats span {
  background: #eff6ff;
  border-radius: 999px;
  padding: 5px 9px;
  color: #334155;
  font-size: .82rem
}

.simple-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px
}

.simple-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px
}

.simple-list li:last-child {
  border-bottom: 0
}

.notice-list {
  display: grid;
  gap: 10px
}

.notice {
  border: 1px solid var(--line);
  border-right: 5px solid var(--blue);
  border-radius: 16px;
  padding: 12px;
  background: #fff
}

.notice.pinned {
  border-right-color: var(--green);
  background: #f0fdfa
}

.empty,
.muted {
  color: var(--muted)
}

.empty-state {
  text-align: center;
  padding: 35px 20px
}

.answer-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  white-space: pre-wrap
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px
}

th {
  text-align: right;
  color: #475569;
  font-size: .86rem;
  padding: 4px 10px
}

td {
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  vertical-align: top
}

td:first-child {
  border-right: 1px solid var(--line);
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px
}

td:last-child {
  border-left: 1px solid var(--line);
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px
}

.wide-table {
  overflow-x: auto
}

.actions-cell {
  min-width: 190px
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  background: linear-gradient(135deg, #ecfdf5, #eff6ff)
}

.login-hero {
  display: grid;
  place-items: center;
  padding: 40px
}

.hero-card {
  max-width: 680px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 34px;
  padding: 38px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px)
}

.hero-card h1 {
  font-size: 2.3rem;
  line-height: 1.35
}

.hero-card p {
  font-size: 1.05rem;
  color: #475569
}

.color-dots {
  display: flex;
  gap: 10px
}

.color-dots span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green)
}

.color-dots span:nth-child(2) {
  background: var(--blue)
}

.color-dots span:nth-child(3) {
  background: #fff;
  border: 1px solid var(--line)
}

.login-card {
  align-self: center;
  justify-self: start;
  width: min(420px, 92%);
  background: #fff;
  border-radius: 28px;
  padding: 30px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px
}

.demo-users {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px
}

.demo-users span {
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: .72rem;
  color: #475569
}

.chat-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  height: calc(100vh - 140px);
  min-height: 600px
}

.chat-sidebar,
.chat-panel {
  margin-bottom: 0;
  min-height: 0
}

.thread-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  max-height: calc(100% - 95px)
}

.thread-item {
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  color: var(--text);
  background: #fff
}

.thread-item.active {
  border-color: var(--blue);
  background: #eff6ff
}

.thread-item span {
  display: block;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px
}

.messages {
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  border-radius: 18px;
  margin: 12px 0
}

.message {
  max-width: 70%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 12px;
  background: #fff;
  align-self: flex-start
}

.message.mine {
  background: #dbeafe;
  border-color: #bfdbfe;
  align-self: flex-end
}

.message .meta {
  font-size: .76rem;
  color: var(--muted);
  margin-bottom: 4px
}

.message-form {
  display: flex;
  gap: 10px
}

.message-form input {
  flex: 1
}

.new-chat-form {
  margin-bottom: 12px
}

.new-chat-form select {
  min-width: 0
}

.attendance-list {
  display: grid;
  gap: 8px;
  max-height: 380px;
  overflow: auto
}

.attendance-row {
  display: grid;
  grid-template-columns: 1fr 110px 1fr;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px
}

.question-list {
  display: grid;
  gap: 12px
}

.question-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 15px;
  margin-bottom: 12px
}

.question-card ol {
  margin-bottom: 0
}

.question-card li.correct {
  color: #166534;
  font-weight: 900
}

.question-card li.chosen {
  background: #eff6ff;
  border-radius: 8px
}

.option {
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  margin: 8px 0
}

.option input {
  width: auto
}

.rating-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.rating-row label {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px
}

.rating-row input {
  width: auto
}

.exam-form {
  display: grid;
  gap: 12px
}

/* Clickable cards (class cards) */
.clickable-card {
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    display: block;
    color: var(--text);
    text-decoration: none;
}
.clickable-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 50px rgba(15, 23, 42, .15);
    text-decoration: none;
}

/* Sidebar layout for class detail */
.sidebar-layout {
    grid-template-columns: 260px 1fr;
}
.class-sidebar {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow: auto;
}
.class-sidebar ul {
    gap: 4px;
}
.class-sidebar li {
    padding: 8px 10px;
    border-radius: 10px;
    border-bottom: none;
}
.class-sidebar li a {
    display: block;
    width: 100%;
    font-weight: 700;
    text-decoration: none;
}
.class-sidebar li.active {
    background: #eff6ff;
    border-right: 3px solid var(--blue);
}
.class-detail {
    min-width: 0;
}

/* Question action buttons */
.question-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}

/* Modal dialog */
.modal-card {
    border: none;
    border-radius: 22px;
    padding: 22px;
    max-width: 560px;
    width: 92vw;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .35);
}
.modal-card::backdrop {
    background: rgba(15, 23, 42, .45);
}

@media (max-width:1100px) {
  .grid.three {
    grid-template-columns: 1fr 1fr
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr)
  }

  .chat-layout {
    grid-template-columns: 280px 1fr
  }

  .login-screen {
    grid-template-columns: 1fr
  }

  .login-hero {
    display: none
  }

  .login-card {
    justify-self: center
  }
}

@media (max-width:820px) {
  .app-shell {
    display: block
  }

  .sidebar {
    position: fixed;
    right: 0;
    transform: translateX(105%);
    transition: .2s;
    width: min(86vw, 310px);
    box-shadow: var(--shadow)
  }

  .sidebar.open {
    transform: translateX(0)
  }

  .main {
    padding: 14px
  }

  .icon-button {
    display: block
  }

  .topbar {
    align-items: flex-start
  }

  .top-actions {
    display: none
  }

  .grid.two,
  .grid.three,
  .stats-grid {
    grid-template-columns: 1fr
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch
  }

  .form-row {
    grid-template-columns: 1fr
  }

  .chat-layout {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr
  }

  .chat-sidebar {
    max-height: 330px
  }

  .chat-panel {
    min-height: 520px
  }

  .message {
    max-width: 88%
  }

  .attendance-row {
    grid-template-columns: 1fr
  }

  .simple-list li {
    align-items: flex-start;
    flex-direction: column
  }

  .sidebar-layout {
    grid-template-columns: 1fr
  }
  .class-sidebar {
    position: static;
    max-height: none;
  }

  .topbar h1 {
    font-size: 1.25rem
  }
}