/* Fairman Academy — front-end portal.
 * Everything is scoped under .fma-portal because the portal renders inside the
 * site's theme. Mobile first; wider layouts from 720px / 960px.
 */

.fma-portal {
  --fp-primary: #1f5f8b;
  --fp-primary-d: #174a6d;
  --fp-primary-l: #e8f1f8;
  --fp-bg: #eef3f8;
  --fp-card: #fff;
  --fp-border: #e1e8ef;
  --fp-line: #edf1f5;
  --fp-text: #1d2733;
  --fp-muted: #66768a;
  --fp-green: #067647;
  --fp-green-l: #e3f6ec;
  --fp-red: #b42318;
  --fp-red-l: #fde8e7;
  --fp-amber: #8a5a00;
  --fp-amber-l: #fff3d6;
  --fp-radius: 12px;
  --fp-shadow: 0 1px 2px rgba(16, 40, 64, .04), 0 6px 18px rgba(16, 40, 64, .05);

  box-sizing: border-box;
  direction: inherit;
  text-align: start;
  font-family: Vazirmatn, Tahoma, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.75;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--fp-text);
  background: var(--fp-bg);
  border-radius: 18px;
  padding: 10px;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
}
.fma-portal *, .fma-portal *::before, .fma-portal *::after { box-sizing: border-box; }
.fma-portal :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure) { margin: 0; }
.fma-portal :where(h1, h2, h3, h4) { font-family: inherit; font-weight: 700; line-height: 1.5; letter-spacing: normal; color: inherit; text-transform: none; }
.fma-portal a { color: var(--fp-primary); text-decoration: none; }
.fma-portal a:hover { color: var(--fp-primary-d); text-decoration: underline; text-underline-offset: 3px; }
.fma-portal :focus-visible { outline: 2px solid var(--fp-primary); outline-offset: 2px; border-radius: 6px; }
.fma-portal img { max-width: 100%; height: auto; }
.fma-portal svg.fp-icon { flex-shrink: 0; vertical-align: middle; }
.fma-portal .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* ---------- Utilities ---------- */
.fma-portal .fp-muted { color: var(--fp-muted); }
.fma-portal .fp-small { font-size: 13px; }
.fma-portal .fp-center { text-align: center; }
.fma-portal .fp-mt { margin-top: 12px; }
.fma-portal .fp-mb { margin-bottom: 2px; }
.fma-portal .fp-nowrap { white-space: nowrap; }
.fma-portal .fp-ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }
.fma-portal input.fp-ltr { text-align: left; }
.fma-portal .fp-num { direction: ltr; text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fma-portal .fp-hide-desktop { display: none; }
.fma-portal .fp-narrow { max-width: 520px; margin: 16px auto; width: 100%; }

/* ---------- Form controls ---------- */
.fma-portal :where(input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=url], input:not([type]), select, textarea) {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fp-text);
  background: #fff;
  border: 1px solid #cfd9e4;
  border-radius: 10px;
  box-shadow: none;
  transition: border-color .15s, box-shadow .15s;
  margin: 0;
}
.fma-portal textarea { min-height: 88px; resize: vertical; }
.fma-portal select { appearance: auto; padding-left: 8px; }
.fma-portal :where(input, select, textarea):focus { outline: none; border-color: var(--fp-primary); box-shadow: 0 0 0 3px rgba(31, 95, 139, .15); }
.fma-portal :where(input, select, textarea):disabled { background: #f4f6f9; color: var(--fp-muted); }
.fma-portal input[type=file] { font: inherit; font-size: 14px; max-width: 100%; padding: 6px 0; }
.fma-portal input[type=checkbox], .fma-portal input[type=radio] { width: 18px; height: 18px; accent-color: var(--fp-primary); margin: 0; }

.fma-portal .fp-field, .fma-portal .fma-field { margin-bottom: 14px; }
.fma-portal .fp-field > label, .fma-portal .fma-field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: #2c3a49; }
.fma-portal .fp-help, .fma-portal .fma-field .description { margin: 5px 0 0; font-size: 13px; color: var(--fp-muted); }
.fma-portal .fp-check { display: flex; align-items: center; gap: 8px; margin: 2px 0 16px; font-size: 14px; cursor: pointer; }
.fma-portal .fma-req { color: var(--fp-red); }
.fma-portal .fma-choices { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.fma-portal .fma-choices label { margin: 0; gap: 6px; font-size: 14px; }
.fma-portal .fma-field-ro .fma-value { padding: 9px 12px; background: #f6f8fb; border-radius: 10px; min-height: 44px; }
.fma-portal .fp-form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.fma-portal .fp-inline-form { display: inline; margin: 0; }

/* ---------- Buttons ---------- */
.fma-portal .fp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  color: var(--fp-primary); background: #fff;
  border: 1px solid #c9d8e6; border-radius: 10px;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.fma-portal .fp-btn:hover { background: var(--fp-primary-l); border-color: #a9c3da; color: var(--fp-primary-d); text-decoration: none; }
.fma-portal .fp-btn-primary { background: var(--fp-primary); border-color: var(--fp-primary); color: #fff; box-shadow: 0 2px 6px rgba(31, 95, 139, .25); }
.fma-portal .fp-btn-primary:hover { background: var(--fp-primary-d); border-color: var(--fp-primary-d); color: #fff; }
.fma-portal .fp-btn-ghost { background: #fff; }
.fma-portal .fp-btn-danger-ghost { color: var(--fp-red); border-color: #f1c4c0; background: #fff; }
.fma-portal .fp-btn-danger-ghost:hover { background: var(--fp-red-l); color: var(--fp-red); border-color: #e9a6a0; }
.fma-portal .fp-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.fma-portal .fp-btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.fma-portal .fp-btn-block { width: 100%; }
.fma-portal .fp-btn .fp-icon { width: 18px; height: 18px; }
.fma-portal .fp-icon-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px; border-radius: 8px; color: var(--fp-primary); font-size: 13px; }
.fma-portal .fp-icon-btn:hover { background: var(--fp-primary-l); text-decoration: none; }
.fma-portal .fp-link-danger { background: none; border: 0; padding: 0; margin-top: 6px; font: inherit; font-size: 13px; color: var(--fp-red); cursor: pointer; }
.fma-portal .fp-link-danger:hover { text-decoration: underline; }
.fma-portal .fp-link { font-size: 14px; font-weight: 600; }

/* ---------- Badges & chips (base styles come from fma-common.css) ---------- */
.fma-portal .fma-badge { font-weight: 500; vertical-align: middle; }
.fma-portal .fp-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.fma-portal .fp-chip { display: inline-block; font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 999px; background: #eef1f5; color: #3b4754; white-space: nowrap; }
.fma-portal .fp-chip-green { background: var(--fp-green-l); color: var(--fp-green); }
.fma-portal .fp-chip-red { background: var(--fp-red-l); color: var(--fp-red); }
.fma-portal .fp-chip-amber { background: var(--fp-amber-l); color: var(--fp-amber); }
.fma-portal .fp-chip-blue { background: #e4f0fb; color: var(--fp-primary); }
.fma-portal .fp-count { display: inline-block; min-width: 24px; padding: 0 7px; margin-inline-start: 4px; font-size: 12px; line-height: 22px; text-align: center; border-radius: 999px; background: var(--fp-primary-l); color: var(--fp-primary); font-weight: 600; vertical-align: middle; }

/* ---------- Alerts / flash ---------- */
.fma-portal .fp-alert, .fma-portal .fma-notice {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  border: 1px solid transparent; background: #e4f0fb; color: var(--fp-primary-d);
}
.fma-portal .fma-notice p { margin: 0; }
.fma-portal .fp-alert-error, .fma-portal .fma-notice-error { background: var(--fp-red-l); border-color: #f6c9c5; color: var(--fp-red); }
.fma-portal .fp-alert-warning, .fma-portal .fma-notice-warning { background: var(--fp-amber-l); border-color: #f3dfa6; color: var(--fp-amber); }
.fma-portal .fma-notice-success { background: var(--fp-green-l); border-color: #b9e6cd; color: var(--fp-green); }
.fma-portal .fp-alert-info { background: #e4f0fb; border-color: #c9def1; color: var(--fp-primary-d); }
.fma-portal .fp-inline-note { margin-top: 10px; padding: 6px 10px; font-size: 13px; border-radius: 8px; background: var(--fp-amber-l); color: var(--fp-amber); }

/* ---------- Header & navigation ---------- */
.fma-portal .fp-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 10px 12px; background: var(--fp-card); border-radius: 14px; box-shadow: var(--fp-shadow);
}
.fma-portal .fp-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fma-portal .fp-logo { width: 42px; height: 42px; border-radius: 12px; object-fit: contain; flex-shrink: 0; }
.fma-portal .fp-logo-letter { display: grid; place-items: center; background: linear-gradient(135deg, #1f5f8b, #3b86b8); color: #fff; font-weight: 800; font-size: 20px; }
.fma-portal .fp-brand-name { font-weight: 700; font-size: 15px; line-height: 1.4; }
.fma-portal .fp-brand-sub { font-size: 12px; color: var(--fp-muted); line-height: 1.4; }
.fma-portal .fp-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fma-portal .fp-user-chip { display: flex; align-items: center; gap: 8px; }
.fma-portal .fp-user-text { display: flex; flex-direction: column; line-height: 1.35; }
.fma-portal .fp-user-text b { font-size: 14px; font-weight: 600; }
.fma-portal .fp-user-text small { font-size: 12px; color: var(--fp-muted); }
.fma-portal .fp-avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--fp-primary-l); color: var(--fp-primary); font-weight: 700; font-size: 15px;
}
.fma-portal .fp-avatar-sm { width: 28px; height: 28px; font-size: 13px; }
.fma-portal .fp-avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.fma-portal .fp-logout span { display: none; }

.fma-portal .fp-switch { position: relative; }
.fma-portal .fp-switch > summary { list-style: none; }
.fma-portal .fp-switch > summary::-webkit-details-marker { display: none; }
.fma-portal .fp-switch > summary span { display: none; }
.fma-portal .fp-switch-menu {
  position: absolute; z-index: 60; top: calc(100% + 6px); inset-inline-start: 0; min-width: 220px;
  padding: 6px; background: #fff; border: 1px solid var(--fp-border); border-radius: 12px; box-shadow: 0 12px 30px rgba(16, 40, 64, .16);
}
.fma-portal .fp-switch-menu form { margin: 0; }
.fma-portal .fp-switch-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; font: inherit; font-size: 14px; color: var(--fp-text); text-align: start; cursor: pointer;
}
.fma-portal .fp-switch-menu button:hover { background: var(--fp-primary-l); }

.fma-portal .fp-nav {
  display: flex; gap: 4px; margin: 10px 0 12px; padding: 5px;
  background: var(--fp-card); border-radius: 14px; box-shadow: var(--fp-shadow);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.fma-portal .fp-nav::-webkit-scrollbar { display: none; }
.fma-portal .fp-nav-item {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; color: #4a5a6b; white-space: nowrap;
}
.fma-portal .fp-nav-item .fp-icon { width: 18px; height: 18px; opacity: .85; }
.fma-portal .fp-nav-item:hover { background: #f2f6fa; color: var(--fp-primary); text-decoration: none; }
.fma-portal .fp-nav-item.is-active { background: var(--fp-primary); color: #fff; box-shadow: 0 2px 8px rgba(31, 95, 139, .25); }

.fma-portal .fp-main { display: flex; flex-direction: column; gap: 14px; }
.fma-portal .fp-main > * { min-width: 0; }

/* ---------- Typography blocks ---------- */
.fma-portal .fp-page-title { font-size: 20px; font-weight: 800; line-height: 1.5; }
.fma-portal .fp-section-title { font-size: 17px; font-weight: 700; margin-top: 4px; }
.fma-portal .fp-title { font-size: 19px; font-weight: 800; margin-bottom: 12px; }
.fma-portal .fp-page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fma-portal .fp-backlink { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; font-weight: 600; align-self: flex-start; }
.fma-portal .fp-backlink .fp-icon { width: 18px; height: 18px; }

/* ---------- Cards ---------- */
.fma-portal .fp-card { background: var(--fp-card); border: 1px solid var(--fp-border); border-radius: var(--fp-radius); padding: 14px; box-shadow: var(--fp-shadow); min-width: 0; }
.fma-portal .fp-card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.fma-portal .fp-card-title { font-size: 16px; font-weight: 700; }
.fma-portal .fp-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.fma-portal .fp-hero {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  padding: 18px; border-radius: 14px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #3d8ec2 0%, #1f5f8b 55%, #184c70 100%);
  box-shadow: 0 8px 24px rgba(31, 95, 139, .25);
}
.fma-portal .fp-hero-title { font-size: 21px; font-weight: 800; }
.fma-portal .fp-hero .fp-muted { color: rgba(255, 255, 255, .78); }
.fma-portal .fp-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.fma-portal .fp-hero-meta > div { display: flex; flex-direction: column; padding: 6px 14px; border-radius: 10px; background: rgba(255, 255, 255, .14); line-height: 1.5; }
.fma-portal .fp-hero-meta span { font-size: 12px; }
.fma-portal .fp-hero-meta b { font-size: 15px; }

.fma-portal .fp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.fma-portal .fp-stat {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; color: var(--fp-text);
  background: var(--fp-card); border: 1px solid var(--fp-border); border-radius: var(--fp-radius); box-shadow: var(--fp-shadow);
  border-inline-start: 4px solid #c9d8e6;
}
.fma-portal a.fp-stat:hover { text-decoration: none; border-color: #b8cde0; color: var(--fp-text); }
.fma-portal .fp-stat-label { font-size: 13px; color: var(--fp-muted); }
.fma-portal .fp-stat-value { font-size: 22px; font-weight: 800; line-height: 1.4; }
.fma-portal .fp-stat-value-sm { font-size: 16px; font-weight: 700; }
.fma-portal .fp-stat-red { border-inline-start-color: #e07a70; }
.fma-portal .fp-stat-red .fp-stat-value { color: var(--fp-red); }
.fma-portal .fp-stat-green { border-inline-start-color: #5dbb8a; }
.fma-portal .fp-stat-green .fp-stat-value { color: var(--fp-green); }
.fma-portal .fp-stat-warn { border-inline-start-color: #e5b54a; }
.fma-portal .fp-stat-warn .fp-stat-value { color: var(--fp-amber); }

.fma-portal .fp-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.fma-portal .fp-two-col { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }

.fma-portal .fp-class-card { display: flex; flex-direction: column; }
.fma-portal .fp-class-card .fp-card-actions { margin-top: auto; padding-top: 14px; }
.fma-portal .fp-class-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.fma-portal .fp-class-title { font-size: 17px; font-weight: 800; color: var(--fp-text); }
.fma-portal a.fp-class-title:hover { color: var(--fp-primary); }
.fma-portal .fp-meta { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: #4a5a6b; }
.fma-portal .fp-meta li { display: flex; align-items: flex-start; gap: 8px; }
.fma-portal .fp-meta .fp-icon { width: 18px; height: 18px; color: #8b9aab; margin-top: 3px; }
.fma-portal .fp-meta-inline { flex-direction: row; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; }

.fma-portal .fp-class-head-main { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.fma-portal .fp-class-head-main .fp-page-title { font-size: 21px; }

.fma-portal .fp-subtabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  border-bottom: 1px solid #d8e2ec;
}
.fma-portal .fp-subtabs::-webkit-scrollbar { display: none; }
.fma-portal .fp-subtab {
  flex-shrink: 0; padding: 8px 14px; font-size: 14px; font-weight: 600; color: #536376; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.fma-portal .fp-subtab:hover { color: var(--fp-primary); text-decoration: none; }
.fma-portal .fp-subtab.is-active { color: var(--fp-primary); border-bottom-color: var(--fp-primary); }

.fma-portal .fp-deadline { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13px; background: #eef3f8; color: #3b4a5a; }
.fma-portal .fp-deadline .fp-icon { width: 16px; height: 16px; }
.fma-portal .fp-deadline.is-passed { background: var(--fp-red-l); color: var(--fp-red); }

/* ---------- Empty state ---------- */
.fma-portal .fp-empty { text-align: center; color: var(--fp-muted); padding: 26px 12px; }
.fma-portal .fp-empty .fp-icon { width: 38px; height: 38px; opacity: .55; margin-bottom: 6px; }
.fma-portal .fp-empty p { font-size: 14px; }

/* ---------- Tables ---------- */
.fma-portal .fp-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--fp-border); border-radius: 10px; }
.fma-portal .fp-table { width: 100%; border-collapse: collapse; border-spacing: 0; margin: 0; font-size: 14px; background: #fff; border: 0; }
.fma-portal .fp-table th, .fma-portal .fp-table td { padding: 10px 12px; text-align: start; vertical-align: middle; border: 0; border-bottom: 1px solid var(--fp-line); }
.fma-portal .fp-table thead th { background: #f5f8fb; color: #3b4a5a; font-weight: 600; font-size: 13px; white-space: nowrap; border-bottom: 1px solid var(--fp-border); }
.fma-portal .fp-table tbody tr:last-child > * { border-bottom: 0; }
.fma-portal .fp-table tbody tr:hover > td { background: #fafcfe; }
.fma-portal .fp-table-compact th, .fma-portal .fp-table-compact td { padding: 7px 10px; }
.fma-portal .fp-tr-total td { background: #f5f8fb; font-weight: 600; }
.fma-portal .fp-td-primary a { font-weight: 600; }
.fma-portal .fp-td-action { text-align: end !important; white-space: nowrap; }

/* Statement */
.fma-portal .fp-statement { min-width: 640px; }
.fma-portal .fp-statement .fp-td-desc { min-width: 200px; }
.fma-portal .fp-statement .fp-debit { color: var(--fp-red); }
.fma-portal .fp-statement .fp-credit { color: var(--fp-green); }
.fma-portal .fp-statement tr.is-voided td { color: #9aa5b1; text-decoration: line-through; }
.fma-portal .fp-statement tr.is-voided td .fma-badge { text-decoration: none; }
.fma-portal .fp-statement .fp-icon-btn span { font-size: 13px; }

/* Attendance matrix */
.fma-portal .fp-matrix th, .fma-portal .fp-matrix td { text-align: center; padding: 6px 8px; white-space: nowrap; }
.fma-portal .fp-matrix .fp-sticky { position: sticky; inset-inline-start: 0; z-index: 1; background: #fff; text-align: start; font-weight: 600; box-shadow: var(--fp-sticky-shadow, -1px) 0 0 var(--fp-line); }
.fma-portal .fp-matrix thead .fp-sticky { background: #f5f8fb; }
.fma-portal .fp-sym { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; font-size: 12px; font-weight: 700; line-height: 1; }
.fma-portal .fp-sym-green { background: var(--fp-green-l); color: var(--fp-green); }
.fma-portal .fp-sym-red { background: var(--fp-red-l); color: var(--fp-red); }
.fma-portal .fp-sym-amber { background: var(--fp-amber-l); color: var(--fp-amber); }
.fma-portal .fp-sym-blue { background: #e4f0fb; color: var(--fp-primary); }
.fma-portal .fp-sym-none { color: #b6c0cb; }
.fma-portal .fp-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--fp-muted); }
.fma-portal .fp-legend span { display: inline-flex; align-items: center; gap: 4px; }
.fma-portal .fp-legend .fp-sym { width: 22px; height: 22px; }

/* ---------- Lists ---------- */
.fma-portal .fp-list { list-style: none; margin: 0; padding: 0; }
.fma-portal .fp-list-item { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 11px 0; border-bottom: 1px solid var(--fp-line); }
.fma-portal .fp-list-item:last-child { border-bottom: 0; }
.fma-portal .fp-list-side { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

/* ---------- Attendance form ---------- */
.fma-portal .fp-date-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px dashed var(--fp-border); }
.fma-portal .fp-date-bar .fp-field { margin: 0; }
.fma-portal .fp-field-inline input { width: 150px; }
.fma-portal .fp-date-info { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; font-weight: 600; min-height: 44px; }
.fma-portal .fp-att-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--fp-line); font-size: 14px; }
.fma-portal .fp-att-row { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--fp-line); }
.fma-portal .fp-att-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.fma-portal .fp-att-name b { font-weight: 600; }
.fma-portal .fp-att-note { min-height: 38px !important; font-size: 14px !important; padding: 6px 10px !important; }

.fma-portal .fp-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 3px; background: #f1f5f9; border-radius: 10px; }
.fma-portal .fp-seg-item { position: relative; margin: 0; cursor: pointer; }
.fma-portal .fp-seg-item input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.fma-portal .fp-seg-item span { display: block; padding: 7px 6px; border-radius: 8px; font-size: 13px; font-weight: 500; text-align: center; color: #536376; white-space: nowrap; transition: background .12s, color .12s; }
.fma-portal .fp-seg-item:hover span { background: #e5ebf2; }
.fma-portal .fp-seg-item input:focus-visible + span { outline: 2px solid var(--fp-primary); outline-offset: 1px; }
.fma-portal .fp-seg-present input:checked + span { background: #1a8754; color: #fff; }
.fma-portal .fp-seg-absent input:checked + span { background: #c8372b; color: #fff; }
.fma-portal .fp-seg-late input:checked + span { background: #d39a14; color: #fff; }
.fma-portal .fp-seg-excused input:checked + span { background: var(--fp-primary); color: #fff; }

.fma-portal .fp-att-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; margin-bottom: 8px; }
.fma-portal .fp-att-sum { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border-radius: 10px; background: #f5f8fb; line-height: 1.4; }
.fma-portal .fp-att-sum b { font-size: 20px; font-weight: 800; }
.fma-portal .fp-att-sum span { font-size: 12.5px; color: var(--fp-muted); }
.fma-portal .fp-att-sum-present b { color: var(--fp-green); }
.fma-portal .fp-att-sum-absent b { color: var(--fp-red); }
.fma-portal .fp-att-sum-late b { color: var(--fp-amber); }
.fma-portal .fp-att-sum-excused b { color: var(--fp-primary); }

/* ---------- Grades ---------- */
.fma-portal .fp-grades { font-size: 14px; }
.fma-portal .fp-grades .fp-th-score { text-align: center; }
.fma-portal .fp-grades .fp-th-score small { display: block; font-weight: 400; color: var(--fp-muted); font-size: 12px; }
.fma-portal .fp-grades .fp-td-score { text-align: center; }
.fma-portal .fp-grades .fp-td-name b { display: block; font-weight: 600; white-space: nowrap; }
.fma-portal .fp-grades .fp-td-name small { font-size: 12px; }
.fma-portal .fp-score { width: 64px !important; min-height: 40px !important; padding: 6px 4px !important; text-align: center !important; font-variant-numeric: tabular-nums; }
.fma-portal .fp-score.is-invalid { border-color: var(--fp-red); background: #fff6f5; box-shadow: 0 0 0 3px rgba(180, 35, 24, .12); }
.fma-portal .fp-score-ro { font-weight: 600; }
.fma-portal .fp-grades .fp-td-total { white-space: nowrap; }
.fma-portal .fp-grades .fp-td-comment textarea { min-width: 190px; min-height: 44px; font-size: 13.5px; padding: 6px 10px; }
.fma-portal .fp-grades tr.is-locked > td { background: #fafbfd; }
.fma-portal .fp-sticky-actions { position: sticky; bottom: 0; z-index: 5; margin: 12px -14px -14px; padding: 12px 14px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--fp-border); border-radius: 0 0 var(--fp-radius) var(--fp-radius); backdrop-filter: blur(4px); }

/* ---------- Materials ---------- */
.fma-portal .fp-materials { display: flex; flex-direction: column; gap: 10px; }
.fma-portal .fp-material { padding: 12px 14px; border: 1px solid var(--fp-border); border-inline-start: 4px solid var(--fp-primary); border-radius: 10px; background: #fff; }
.fma-portal .fp-material-homework { border-inline-start-color: #e2a93b; }
.fma-portal .fp-material-announcement { border-inline-start-color: #3aa877; }
.fma-portal .fp-material-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.fma-portal .fp-material-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.fma-portal .fp-material-title { font-size: 15.5px; font-weight: 700; margin: 6px 0 2px; }
.fma-portal .fp-material-body { margin-top: 6px; font-size: 14px; color: #34414f; }
.fma-portal .fp-material-body p { margin: 0 0 6px; }
.fma-portal .fp-material-body p:last-child { margin-bottom: 0; }
.fma-portal .fp-material-body :where(ul, ol) { padding-right: 20px; margin: 0 0 6px; }
.fma-portal .fp-material-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fma-portal .fp-attach { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 10px; border-radius: 8px; background: var(--fp-primary-l); font-size: 13px; font-weight: 500; }
.fma-portal .fp-attach span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.fma-portal .fp-attach .fp-icon { width: 16px; height: 16px; }

/* ---------- Notes ---------- */
.fma-portal .fp-notes { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.fma-portal .fp-note { padding: 10px 12px; border-radius: 10px; background: #f6f8fb; border: 1px solid var(--fp-line); }
.fma-portal .fp-note-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; font-size: 14px; }
.fma-portal .fp-note-body { font-size: 14px; color: #34414f; }

/* ---------- Reports (student) ---------- */
.fma-portal .fp-reports { display: grid; grid-template-columns: 1fr; gap: 12px; }
.fma-portal .fp-report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fma-portal .fp-report-title { font-size: 16px; font-weight: 700; }
.fma-portal .fp-report-title .fp-muted { font-weight: 500; font-size: 14px; }
.fma-portal .fp-report-score { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.fma-portal .fp-percent { font-size: 26px; font-weight: 800; color: var(--fp-primary); line-height: 1.2; }
.fma-portal .fp-percent small { font-size: 15px; }
.fma-portal .fp-details { margin-top: 10px; }
.fma-portal .fp-details > summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--fp-primary); padding: 4px 0; }
.fma-portal .fp-details[open] > summary { margin-bottom: 8px; }
.fma-portal .fp-quote { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #f6f8fb; font-size: 14px; border-inline-start: 3px solid #c9d8e6; }

/* ---------- Profile ---------- */
.fma-portal .fp-profile-head { display: flex; align-items: center; gap: 14px; }
.fma-portal .fp-kv-inline { display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: 14px; color: var(--fp-muted); }
.fma-portal .fp-kv-inline b { color: var(--fp-text); font-weight: 600; }
.fma-portal .fp-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.fma-portal .fp-dl > div { padding: 10px 12px; border-radius: 10px; background: #f6f8fb; }
.fma-portal .fp-dl dt { font-size: 12.5px; color: var(--fp-muted); }
.fma-portal .fp-dl dd { font-weight: 600; margin: 0; }
.fma-portal .fp-cf-grid { display: grid; grid-template-columns: 1fr; column-gap: 16px; }

/* ---------- Auth screens ---------- */
.fma-portal .fp-auth { max-width: 430px; margin: 18px auto 24px; }
.fma-portal .fp-auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 16px; text-align: start; }
.fma-portal .fp-auth-brand .fp-logo { width: 52px; height: 52px; font-size: 24px; }
.fma-portal .fp-auth-name { font-size: 18px; font-weight: 800; line-height: 1.4; }
.fma-portal .fp-auth-card { padding: 22px 18px; }
.fma-portal .fp-choose-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.fma-portal .fp-choose {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  font: inherit; text-align: start; color: var(--fp-text); background: #fff;
  border: 1px solid var(--fp-border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.fma-portal .fp-choose:hover { border-color: var(--fp-primary); background: var(--fp-primary-l); }
.fma-portal .fp-choose > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; line-height: 1.5; }
.fma-portal .fp-choose .fp-icon { color: var(--fp-muted); }

/* ---------- Phone-only: card tables ---------- */
@media (max-width: 719px) {
  .fma-portal .fp-rtable { display: block; }
  .fma-portal .fp-rtable thead { display: none; }
  .fma-portal .fp-rtable tbody, .fma-portal .fp-rtable tr { display: block; width: 100%; }
  .fma-portal .fp-rtable tr { padding: 10px 12px; border-bottom: 1px solid var(--fp-border); }
  .fma-portal .fp-rtable tbody tr:last-child { border-bottom: 0; }
  .fma-portal .fp-rtable td { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 5px 0; border: 0 !important; text-align: end; }
  .fma-portal .fp-rtable td::before { content: attr(data-label); flex-shrink: 0; font-size: 13px; color: var(--fp-muted); text-align: start; }
  .fma-portal .fp-rtable td.fp-td-primary { justify-content: flex-start; flex-wrap: wrap; gap: 6px; font-size: 15px; padding-bottom: 6px; }
  .fma-portal .fp-rtable td.fp-td-primary::before, .fma-portal .fp-rtable td.fp-td-action::before, .fma-portal .fp-rtable td.fp-td-num { display: none; }
  .fma-portal .fp-rtable td.fp-td-action { justify-content: flex-start; padding-top: 8px; }
  .fma-portal .fp-rtable tbody tr:hover > td { background: none; }
  .fma-portal .fp-grades .fp-td-name b { display: inline; }
  .fma-portal .fp-grades .fp-td-comment { flex-direction: column; align-items: stretch; gap: 4px; }
  .fma-portal .fp-grades .fp-td-comment textarea { min-width: 0; }
  .fma-portal .fp-grades .fp-td-print { justify-content: flex-start; }
  .fma-portal .fp-grades .fp-td-print::before { display: none; }
  .fma-portal .fp-grades tr.is-locked { background: #fafbfd; }
  .fma-portal .fp-grades tr.is-locked > td { background: none; }
  .fma-portal .fp-hide-desktop { display: inline; }
  .fma-portal .fp-table-wrap:has(.fp-rtable) { overflow: visible; }
  .fma-portal .fp-date-bar > .fp-btn { flex: 0 0 auto; }
}

/* ---------- Tablet & up ---------- */
@media (min-width: 560px) {
  .fma-portal .fp-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .fma-portal .fp-reports { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .fma-portal .fp-switch > summary span, .fma-portal .fp-logout span { display: inline; }
}

@media (min-width: 720px) {
  .fma-portal { padding: 18px; border-radius: 22px; font-size: 15px; }
  .fma-portal .fp-header { padding: 12px 18px; }
  .fma-portal .fp-card { padding: 18px 20px; }
  .fma-portal .fp-sticky-actions { margin: 14px -20px -18px; padding: 12px 20px; }
  .fma-portal .fp-hero { padding: 22px 24px; }
  .fma-portal .fp-hero-title { font-size: 23px; }
  .fma-portal .fp-page-title { font-size: 22px; }
  .fma-portal .fp-att-row { grid-template-columns: minmax(150px, 1fr) minmax(300px, auto) minmax(160px, 1fr); align-items: center; gap: 14px; }
  .fma-portal .fp-cf-grid { grid-template-columns: 1fr 1fr; }
  .fma-portal .fp-cf-grid .fma-field:has(textarea), .fma-portal .fp-cf-grid .fma-field:has(.fma-choices) { grid-column: 1 / -1; }
  .fma-portal .fp-auth-card { padding: 28px 28px; }
}

@media (min-width: 960px) {
  .fma-portal .fp-two-col { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
  .fma-portal .fp-two-col.fp-two-equal { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fma-portal .fp-stats-4 { grid-template-columns: repeat(4, 1fr); }
}

@media print {
  .fma-portal { background: #fff; padding: 0; }
  .fma-portal .fp-nav, .fma-portal .fp-user, .fma-portal form, .fma-portal .fp-card-actions { display: none !important; }
}

/* User-written text (often English in an RTL page): let each paragraph pick its own direction. */
.fma-portal .fp-material-title,
.fma-portal .fp-material-body :where(p, li, div),
.fma-portal .fp-note-body,
.fma-portal .fp-quote,
.fma-portal .fp-grades .fp-td-comment span,
.fma-portal .fp-bidi { unicode-bidi: plaintext; text-align: start; }
.fma-portal .fp-grades .fp-td-comment textarea,
.fma-portal .fp-att-note,
.fma-portal #fp-att-topic,
.fma-portal #fp-mat-title,
.fma-portal #fp-mat-body,
.fma-portal #fp-note-body { unicode-bidi: plaintext; }

/* Grades: print link inside the name cell; total + percent kept together */
.fma-portal .fp-grades .fp-print-link { display: inline-flex; align-items: center; gap: 3px; margin-top: 2px; font-size: 12.5px; }
.fma-portal .fp-grades .fp-print-link .fp-icon { width: 15px; height: 15px; }
.fma-portal .fp-grades .fp-percent-sm { display: block; }
.fma-portal .fp-grades .fp-td-comment textarea { min-width: 170px; }
@media (min-width: 720px) {
  .fma-portal .fp-grades .fp-td-name small { display: inline-block; margin-left: 8px; }
}
@media (max-width: 719px) {
  .fma-portal .fp-grades .fp-print-link { margin-right: auto; font-size: 13px; }
  .fma-portal .fp-grades .fp-percent-sm { display: inline; margin-right: 8px; }
  .fma-portal .fp-grades .fp-td-comment textarea { min-width: 0; }
}
@media (max-width: 719px) {
  .fma-portal .fp-sticky-actions { flex-wrap: nowrap; gap: 8px; padding: 10px 14px; }
  .fma-portal .fp-sticky-actions .fp-btn { flex: 1 1 0; min-width: 0; padding: 0 8px; font-size: 13.5px; white-space: normal; text-align: center; line-height: 1.35; }
  .fma-portal .fp-sticky-actions .fp-btn-ghost { flex: 0.7 1 0; }
}

@media (max-width: 719px) {
  .fma-portal .fp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fma-portal .fp-stats > :first-child:nth-last-child(odd) { grid-column: 1 / -1; }
  .fma-portal .fp-stat { padding: 12px 14px; }
  .fma-portal .fp-stat-value { font-size: 19px; }
  .fma-portal .fp-stat-value-sm { font-size: 15px; }
  .fma-portal .fp-statement { min-width: 0; }
  .fma-portal .fp-statement tr { display: flex; flex-direction: column; }
  .fma-portal .fp-statement .fp-td-desc { order: -1; display: block; min-width: 0; }
  .fma-portal .fp-statement td:empty { display: none; }
  .fma-portal .fp-statement .fp-num { direction: rtl; }
}

/* ---- Standalone Laravel portal page ---- */
html, body.fp-body { margin: 0; background: #e6edf4; min-height: 100%; }
body.fp-body { padding: 14px 10px 40px; }
body.fp-body .fma-portal { margin-top: 0; }
.fp-site-link { font-size: 13px; color: var(--fp-muted); text-decoration: none; }
.fp-site-link:hover { color: var(--fp-primary); }
.fp-auth-foot { text-align: center; margin-top: 18px; font-size: 13px; }
@media (min-width: 720px) { body.fp-body { padding: 28px 20px 60px; } }
.fma-portal .fp-cf-wide { grid-column: 1 / -1; }
.fma-portal .fp-cf-value { padding: 8px 0; color: var(--fp-text); }
.fma-portal .fp-choices { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 4px; }
.fma-portal .fp-alert-success { background: var(--fp-green-l); color: var(--fp-green); border: 1px solid #b7e4c9; }
.fma-portal .fp-rules { padding-inline-start: 22px; margin: 12px 0 20px; line-height: 2; }
.fma-portal .fp-rules li { margin-bottom: 6px; }
.fma-portal .fp-rule-danger { color: #a3261a; }
.fma-portal .fp-soundcheck { border: 1px dashed var(--fp-border, #dbe3e1); border-radius: 10px; padding: 16px; margin: 8px 0 16px; background: #f8fbfa; }
.fma-portal .fp-soundcheck h3 { margin: 0 0 4px; font-size: 16px; }
.fma-portal .fp-result-score { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-end; margin: 18px 0 6px; }
.fma-portal .fp-result-score > div { display: flex; flex-direction: column; gap: 2px; }
.fma-portal .fp-result-score b { font-size: 40px; line-height: 1.2; color: var(--fp-primary, #1f5f8b); }

[dir="ltr"] .fma-portal, .fma-portal[dir="ltr"] { --fp-sticky-shadow: 1px; }
/* Direction-aware icons (drawn for right-to-left). */
.fma-portal[dir="ltr"] .fp-icon-dir { transform: scaleX(-1); }

/* ---------- Substitute teacher form ---------- */
.fma-portal .fp-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.fma-portal .fp-choices-col { flex-direction: column; align-items: flex-start; }
.fma-portal .fp-choice { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.fma-portal .fp-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fma-portal .fp-choice span { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border: 1.5px solid var(--fp-line); border-radius: 999px; font-size: 14px; background: #fff; color: #3b4a5a; }
.fma-portal .fp-choice span::before { content: ""; width: 14px; height: 14px; flex: none; border: 1.5px solid #9aa8b6; border-radius: 4px; background: #fff; }
.fma-portal .fp-choice input[type=radio] + span::before { border-radius: 50%; }
.fma-portal .fp-choice input:checked + span { border-color: var(--fp-primary); background: var(--fp-primary-l); color: var(--fp-primary-d); font-weight: 600; }
.fma-portal .fp-choice input:checked + span::before { border-color: var(--fp-primary); background: var(--fp-primary); box-shadow: inset 0 0 0 2.5px #fff; }
.fma-portal .fp-choice input:focus-visible + span { outline: 2px solid var(--fp-primary); outline-offset: 2px; }
.fma-portal .fp-late { font-style: normal; font-size: 12px; color: #b45309; font-weight: 600; }
.fma-portal .fp-req { color: #c8372b; }
.fma-portal .fp-err { margin: 5px 0 0; font-size: 13px; color: #c8372b; }
.fma-portal .has-err > input, .fma-portal .has-err > select, .fma-portal .has-err > textarea { border-color: #c8372b; }
.fma-portal .fp-mt-s { margin-top: 8px; }
.fma-portal .fp-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.fma-portal .fp-secno { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-inline-end: 9px; border-radius: 50%; background: var(--fp-primary); color: #fff; font-size: 13px; font-weight: 700; vertical-align: middle; }
.fma-portal .fp-steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 0 0 16px; counter-reset: step; }
.fma-portal .fp-steps li { position: relative; padding: 9px 10px 9px 10px; border-radius: 10px; background: #eef2f6; color: #5d6b7a; font-size: 13px; line-height: 1.35; }
.fma-portal .fp-steps li b { display: block; font-size: 12px; font-weight: 600; opacity: .75; }
.fma-portal .fp-steps li.is-done { background: #e3f4ea; color: #19603d; }
.fma-portal .fp-steps li.is-now { background: var(--fp-primary); color: #fff; }
@media (max-width: 640px) { .fma-portal .fp-steps { grid-template-columns: repeat(2, 1fr); } }
.fma-portal .fp-qa { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; border-top: 1px solid var(--fp-line); }
.fma-portal .fp-qa > dt, .fma-portal .fp-qa > dd { padding: 9px 0; margin: 0; border-bottom: 1px solid var(--fp-line); font-size: 14px; }
.fma-portal .fp-qa > dt { color: var(--fp-muted); font-weight: 600; padding-inline-end: 12px; }
.fma-portal .fp-qa > dd { white-space: pre-line; unicode-bidi: plaintext; }
@media (max-width: 560px) { .fma-portal .fp-qa { grid-template-columns: 1fr; } .fma-portal .fp-qa > dt { border-bottom: 0; padding-bottom: 0; } }
.fma-portal .fp-list-item.is-highlight { background: #f0faf4; margin: 0 -12px; padding-inline: 12px; border-radius: 8px; }
.fma-portal .fp-nav-badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin-inline-start: 6px; border-radius: 999px; background: #d97706; color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1; }
.fma-portal[dir="ltr"] .fp-qa > dd { text-align: left; }
.fma-portal[dir="rtl"] .fp-qa > dd { text-align: right; }

/* ---------- Timetable preferences grid ---------- */
.fma-portal .fp-avail-card { padding: 14px; }
.fma-portal .fp-avail-wrap { overflow-x: auto; }
.fma-portal .fp-avail { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 520px; table-layout: fixed; }
.fma-portal .fp-avail th, .fma-portal .fp-avail td { border-inline-end: 1px solid #c9d3de; border-bottom: 1px solid #c9d3de; text-align: center; padding: 0; height: 52px; }
.fma-portal .fp-avail tr > :first-child { border-inline-start: 1px solid #c9d3de; }
.fma-portal .fp-avail thead th { border-top: 1px solid #c9d3de; background: #d5ebcd; color: #1d3b18; font-weight: 700; font-size: 15px; }
.fma-portal .fp-avail tbody th { background: #b8c8e8; color: #17284a; font-weight: 700; font-size: 13.5px; width: 128px; white-space: nowrap; }
.fma-portal .fp-avail .sep { margin: 0 3px; }
.fma-portal .fp-avail th button { all: unset; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 50px; cursor: pointer; box-sizing: border-box; padding: 4px; }
.fma-portal .fp-avail th button:hover { background: rgba(255,255,255,.35); }
.fma-portal .fp-avail th button:focus-visible { outline: 2px solid var(--fp-primary); outline-offset: -3px; }
.fma-portal .fp-avail-corner { position: relative; width: 128px; background: #fff !important; background-image: linear-gradient(to top right, transparent calc(50% - 1px), #9aa8b6, transparent calc(50% + 1px)) !important; font-size: 12.5px !important; color: #33414f !important; }
.fma-portal .fp-avail-corner .d { position: absolute; top: 6px; inset-inline-end: 10px; }
.fma-portal .fp-avail-corner .h { position: absolute; bottom: 6px; inset-inline-start: 10px; }
.fma-portal .fp-avail-cell { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; margin: 0; cursor: pointer; }
.fma-portal .fp-avail-cell input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fma-portal .fp-avail-cell span { width: 24px; height: 24px; border: 1.5px solid #34495e; border-radius: 3px; background: #dbe4f7; display: grid; place-items: center; transition: background .12s; }
.fma-portal .fp-avail-cell input:checked + span { background: #fff; }
.fma-portal .fp-avail-cell input:checked + span::after { content: ""; width: 7px; height: 13px; border: solid #111; border-width: 0 2.5px 2.5px 0; transform: translateY(-2px) rotate(45deg); }
.fma-portal .fp-avail-cell input:focus-visible + span { outline: 2px solid var(--fp-primary); outline-offset: 2px; }
.fma-portal .fp-avail td:has(input:checked) { background: #eef8ea; }
.fma-portal .fp-avail[data-readonly] .fp-avail-cell { cursor: default; }
.fma-portal .fp-avail-note { margin: 12px 0 0; font-size: 14px; }
.fma-portal .fp-day-short { display: none; }
@media (max-width: 700px) {
  .fma-portal .fp-day-long { display: none; } .fma-portal .fp-day-short { display: inline; }
  .fma-portal .fp-avail { min-width: 0; } .fma-portal .fp-avail tbody th, .fma-portal .fp-avail-corner { width: 74px; font-size: 11.5px; white-space: normal; line-height: 1.25; }
  .fma-portal .fp-avail thead th { font-size: 12.5px; } .fma-portal .fp-avail-cell span { width: 22px; height: 22px; }
  .fma-portal .fp-avail-corner .d, .fma-portal .fp-avail-corner .h { font-size: 10.5px; }
  .fma-portal .fp-avail-card { padding: 8px; }
  .fma-portal .fp-avail tbody th button, .fma-portal .fp-avail tbody th { flex-direction: column; line-height: 1.2; }
  .fma-portal .fp-avail tbody th .t { display: block; white-space: nowrap; }
  .fma-portal .fp-avail tbody th .sep { display: block; margin: 0; line-height: .8; opacity: .6; }
}

/* Online payment */
.fma-portal fieldset.fp-field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.fma-portal fieldset.fp-field legend { font-weight: 600; font-size: 14px; margin-bottom: 8px; padding: 0; }
.fma-portal .fp-paymethods { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.fma-portal .fp-paymethod { position: relative; cursor: pointer; display: block; }
.fma-portal .fp-paymethod input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fma-portal .fp-paymethod-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--fp-line); border-radius: 12px; background: #fff; height: 100%; box-sizing: border-box; }
.fma-portal .fp-paymethod-box small { display: block; color: #66727f; font-size: 12.5px; margin-top: 2px; }
.fma-portal .fp-paymethod input:checked + .fp-paymethod-box { border-color: var(--fp-primary); background: var(--fp-primary-l); box-shadow: 0 0 0 1px var(--fp-primary) inset; }
.fma-portal .fp-paymethod input:focus-visible + .fp-paymethod-box { outline: 2px solid var(--fp-primary); outline-offset: 2px; }
.fma-portal .fp-paymethod-logo { flex: none; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: #5b6775; }
.fma-portal .fp-pm-zarinpal { background: #f4b400; color: #3a2a00; } .fma-portal .fp-pm-stripe { background: #635bff; }
.fma-portal .fp-pm-paypal { background: #003087; } .fma-portal .fp-pm-crypto { background: #f7931a; font-size: 20px; } .fma-portal .fp-pm-test { background: #8a94a0; }
.fma-portal .fp-pay-amount { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; max-width: 260px; }
.fma-portal .fp-pay-preview { min-height: 1.5em; margin: 0 0 12px; font-size: 14px; color: #3b4a5a; }
.fma-portal .fp-pay-preview b { font-variant-numeric: tabular-nums; }
.fma-portal button.fp-link { background: none; border: 0; padding: 0; font: inherit; color: var(--fp-primary); cursor: pointer; text-decoration: underline; margin-inline-start: 6px; }
.fma-portal .fp-pay-result { text-align: center; padding-top: 28px; }
.fma-portal .fp-pay-result .fp-dl { text-align: start; }
.fma-portal .fp-pay-result .fp-form-actions { justify-content: center; }
.fma-portal .fp-pay-result-icon { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; font-size: 28px; font-weight: 700; color: #fff; background: #5b6775; }
.fma-portal .fp-pay-success .fp-pay-result-icon { background: #1f7a4d; } .fma-portal .fp-pay-warning .fp-pay-result-icon { background: #c27c0e; }
.fma-portal .fp-pay-error .fp-pay-result-icon { background: #c8372b; } .fma-portal .fp-pay-info .fp-pay-result-icon { background: #3a6ea5; }
.fma-portal .fp-logo.fma-logo-tint { color: var(--fp-primary); border-radius: 0; }
.fma-portal .fp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; } @media (max-width: 600px) { .fma-portal .fp-grid-2 { grid-template-columns: 1fr; } }

/* Course audio */
.fma-portal .fp-audio-list { list-style: none; margin: 0; padding: 0; }
.fma-portal .fp-audio-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 340px) auto; gap: 10px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--fp-line); }
.fma-portal .fp-audio-list li:first-child { border-top: 0; }
.fma-portal .fp-audio-title b { display: block; } .fma-portal .fp-audio-title span { display: block; }
.fma-portal .fp-audio-list audio { width: 100%; height: 40px; }
@media (max-width: 700px) { .fma-portal .fp-audio-list li { grid-template-columns: 1fr auto; } .fma-portal .fp-audio-list audio { grid-column: 1 / -1; grid-row: 2; } }
