/* Porsa stylesheet. Layers in order: fonts, reset, base, layout, components, utilities.
   Tokens live in tokens.css. Logical properties throughout (RTL first). No framework. */

@import url("tokens.aa4a1c5f3169.css");

/* ================================================================ fonts */
@font-face { font-family: "Shabnam"; src: url("../vendor/fonts/shabnam/Shabnam-Light.2ec448debfe2.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Shabnam"; src: url("../vendor/fonts/shabnam/Shabnam-Regular.ec24935dfb05.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Shabnam"; src: url("../vendor/fonts/shabnam/Shabnam-Bold.a931370a97d7.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Mirza"; src: url("../vendor/fonts/mirza/Mirza-SemiBold.ea0e61ea8224.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Mirza"; src: url("../vendor/fonts/mirza/Mirza-Bold.e3f9a0572102.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../vendor/vazirmatn/Vazirmatn[wght].f6d31671339d.woff2") format("woff2-variations"); font-weight: 100 900; font-display: swap; }

/* ================================================================ reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; line-height: var(--leading-body); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: 0; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
table { border-collapse: collapse; }
a { color: inherit; }

/* ================================================================ base */
html {
  font-family: var(--font-text);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
  text-align: right;
  letter-spacing: 0;
}
body { display: flex; flex-direction: column; }
::selection { background: var(--selection); color: var(--text); }
::placeholder { color: var(--text-3); opacity: 1; }
:root { caret-color: var(--thread); accent-color: var(--thread); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
h1, h2, .display { font-family: var(--font-display); font-weight: var(--weight-bold); line-height: var(--leading-display); }
.display { font-size: var(--size-display); }
h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); font-weight: var(--weight-bold); line-height: var(--leading-heading); }
h4 { font-size: var(--size-h4); font-weight: var(--weight-bold); line-height: var(--leading-heading); }
h1, h2, h3, h4 { text-wrap: balance; }
p { max-width: var(--measure); }
a:where(:not([class])) { color: var(--thread); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:where(:not([class])):hover { color: var(--thread-hover); }
hr { border: 0; border-block-start: 1px solid var(--border); }
code, .code, .num { font-family: var(--font-num); }
.code { direction: ltr; unicode-bidi: isolate; }
.num { unicode-bidi: isolate; }
small, .small { font-size: var(--size-small); line-height: var(--leading-tight); }
.micro { font-size: var(--size-micro); line-height: var(--leading-tight); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.ltr { direction: ltr; unicode-bidi: isolate; }
@media (max-width: 640px) { html { font-size: 17px; } }

/* a heading with the panel's single graphite underline */
.titled { display: inline-block; padding-block-end: 2px; border-block-end: 1.5px solid currentColor; margin-block-end: var(--space-3); }

/* ================================================================ layout */
.band {
  background: var(--bg); border-block-end: 1px solid var(--border-strong);
  padding-inline: var(--space-8); min-height: var(--band-height);
  display: flex; align-items: stretch; gap: var(--space-6);
}
.band__brand { display: flex; align-items: center; font-family: var(--font-display); font-weight: var(--weight-bold); font-size: var(--size-h2); color: var(--text); text-decoration: none; }
.band__brand small { font-family: var(--font-text); font-size: var(--size-micro); font-weight: var(--weight-light); color: var(--text-2); margin-inline-start: var(--space-2); }
.band__nav { display: flex; gap: 2px; }
.band__nav a { display: inline-flex; align-items: center; gap: var(--space-2); padding-inline: var(--space-2); white-space: nowrap; color: var(--text-2); text-decoration: none; border-block-end: 3px solid transparent; min-height: var(--band-height); }
.band__nav a[aria-current="page"] { color: var(--text); border-block-end-color: var(--thread); font-weight: var(--weight-bold); }
.band__nav a:hover { color: var(--text); }
.band__end { margin-inline-start: auto; display: flex; align-items: center; gap: var(--space-3); color: var(--text-2); font-size: var(--size-small); white-space: nowrap; }
.band__end strong { color: var(--text); }
.band__end form { display: contents; }
.band--station .band__brand { font-size: var(--size-h2); }
@media (max-width: 640px) {
  .band { flex-wrap: wrap; padding-inline: var(--space-4); gap: 0 var(--space-3); }
  .band__brand { order: 0; min-height: 48px; }
  .band__end { order: 1; }
  .band__nav { order: 2; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .band__nav::-webkit-scrollbar { display: none; }
  .band__nav a { min-height: 44px; }
}

main.page { flex: 1; width: 100%; max-width: 1360px; margin-inline: auto; padding: var(--space-5) var(--space-8) var(--space-10); }
.page-foot { padding: var(--space-4) var(--space-8); color: var(--text-3); font-size: var(--size-micro); border-block-start: 1px solid var(--border); }

/* the record: margin at the start edge, body beside it */
.record { display: grid; grid-template-columns: var(--margin-w) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); }
.record__margin { padding: var(--space-4) var(--space-3) var(--space-4) var(--space-3); border-inline-end: 1px solid var(--thread); font-size: var(--size-small); font-weight: var(--weight-light); color: var(--text-2); display: flex; flex-direction: column; gap: var(--space-3); }
.record__margin dl { display: flex; flex-direction: column; gap: var(--space-3); }
.record__margin dt { font-size: var(--size-micro); color: var(--text-3); font-weight: var(--weight-light); }
.record__margin dd { color: var(--text); font-weight: var(--weight-bold); }
.record__margin .push { margin-block-start: auto; }
.record__body { padding: var(--space-4) var(--space-5); min-width: 0; }
.record__foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-5); border-block-start: 1px solid var(--border-strong); background: var(--surface); border-end-start-radius: var(--radius-sheet); border-end-end-radius: var(--radius-sheet); }
.record--sticky-foot .record__foot { position: sticky; bottom: 0; }
@media (max-width: 1199px) {
  .record { grid-template-columns: minmax(0, 1fr); }
  .record__margin { border-inline-end: 0; border-block-end: 1px solid var(--thread); flex-direction: row; flex-wrap: wrap; gap: var(--space-2) var(--space-5); padding: var(--space-3) var(--space-4); }
  .record__margin dl { flex-direction: row; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
  .record__margin dt { display: inline; margin-inline-end: var(--space-1); }
  .record__margin dd { display: inline; }
  .record__margin .push { margin-block-start: 0; }
}
.record-grid { display: grid; gap: var(--space-5); }
.record-grid--2 { grid-template-columns: 3fr 2fr; }
@media (max-width: 1000px) { .record-grid--2 { grid-template-columns: 1fr; } }

/* the stamp box: staff records only, never a parent surface */
.stamp { display: inline-block; border: 1.5px solid var(--stamp-ink); border-radius: var(--radius-stamp); padding: 1px var(--space-3); font-family: var(--font-num); font-weight: var(--weight-bold); direction: ltr; unicode-bidi: isolate; color: var(--stamp-ink); background: var(--surface); line-height: 1.6; }
.stamp--thread { border-color: var(--thread); color: var(--thread); }

/* page header inside the shell */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-block-end: var(--space-5); }
.page-head p { color: var(--text-2); }

/* ================================================================ components: buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--button-height); padding-inline: var(--space-5);
  border: 1px solid var(--thread); border-radius: var(--radius-control);
  background: var(--thread); color: var(--text-on-accent); font-weight: var(--weight-bold);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) var(--ease-out), border-color var(--t-hover) var(--ease-out);
}
.button:hover { background: var(--thread-hover); border-color: var(--thread-hover); }
.button:active { transform: scale(0.98); }
.button--secondary { background: var(--surface); color: var(--thread); }
.button--secondary:hover { background: var(--thread-soft); border-color: var(--thread); }
.button--quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.button--quiet:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.button--danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.button--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.button--small { min-height: 36px; padding-inline: var(--space-3); font-size: var(--size-small); }
.button[disabled], .button[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.button.is-loading { position: relative; color: transparent; }
.button.is-loading::after { content: ""; position: absolute; inset-block: 50%; inset-inline-start: 50%; width: 18px; height: 18px; margin: -9px; border: 2px solid var(--text-on-accent); border-inline-end-color: transparent; border-radius: 50%; animation: spin 700ms linear infinite; }
.button--secondary.is-loading::after, .button--quiet.is-loading::after { border-color: var(--thread); border-inline-end-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.button-row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }

/* ================================================================ components: forms */
.field { display: flex; flex-direction: column; gap: var(--space-1); margin-block-end: var(--space-4); }
.field > label, .field__label { font-weight: var(--weight-bold); font-size: var(--size-small); }
.field__help { color: var(--text-2); font-size: var(--size-micro); }
.field__error { color: var(--danger); font-size: var(--size-small); font-weight: var(--weight-bold); }
.field--invalid .input { border-color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: var(--input-height); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text); line-height: var(--leading-tight);
  transition: border-color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out);
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--thread); box-shadow: 0 0 0 3px var(--thread-soft); outline: 0; }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
.input[disabled], .select[disabled], .textarea[disabled] { opacity: 0.5; cursor: not-allowed; }
.textarea { min-height: calc(var(--row) * 2); resize: vertical; }
.select { appearance: none; padding-inline-end: var(--space-8); background-image: var(--select-chevron); background-repeat: no-repeat; background-position: left var(--space-3) center; }
.input--ltr, .input.code { direction: ltr; text-align: left; }
.search { position: relative; }
.search .input { padding-inline-start: 40px; }
.search .icon { position: absolute; inset-inline-start: var(--space-3); inset-block-start: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
.check { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--row); cursor: pointer; }
.check input { appearance: none; width: 22px; height: 22px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); display: grid; place-items: center; transition: background-color var(--t-press) var(--ease-out), border-color var(--t-press) var(--ease-out); }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--thread); border-color: var(--thread); }
.check input[type="checkbox"]:checked::after { content: ""; width: 11px; height: 6px; border: 2px solid var(--text-on-accent); border-block-start: 0; border-inline-end: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input[type="radio"]:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-on-accent); }
.check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.jalali { position: relative; }
.jalali .input { padding-inline-end: 40px; direction: ltr; text-align: left; }
.jalali .icon { position: absolute; inset-inline-end: var(--space-3); inset-block-start: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }

/* the station numeric keypad */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); direction: ltr; width: 280px; }
.keypad button { min-height: 56px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface-2); font-family: var(--font-num); font-size: 1.375rem; font-weight: var(--weight-bold); color: var(--text); transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) var(--ease-out); }
.keypad button:hover { background: var(--thread-soft); }
.keypad button:active { transform: scale(0.97); }
.keypad button.keypad__ghost { background: transparent; border-color: transparent; color: var(--text-2); font-family: var(--font-text); font-size: var(--size-body); font-weight: var(--weight-regular); }
.pin { display: flex; gap: var(--space-3); direction: ltr; }
.pin span { width: 44px; height: 52px; border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); display: grid; place-items: center; }
.pin span.is-filled::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--text); }

/* ================================================================ components: data */
.table { width: 100%; }
.table th, .table td { padding: var(--space-2) var(--space-3); border-block-end: 1px solid var(--border); text-align: right; vertical-align: middle; }
.table thead th, .table th[scope="col"] { color: var(--text-2); font-weight: var(--weight-bold); font-size: var(--size-micro); border-block-end-color: var(--border-strong); white-space: nowrap; }
.table th[scope="row"] { font-weight: var(--weight-bold); color: var(--text); }
.table th[aria-sort] { cursor: pointer; }
.table th[aria-sort]::after { content: ""; display: inline-block; width: 0; height: 0; margin-inline-start: 6px; border: 4px solid transparent; border-block-start-color: currentColor; vertical-align: 2px; opacity: 0.6; }
.table th[aria-sort="ascending"]::after { transform: rotate(180deg); vertical-align: -1px; }
.table td.num, .table th.num { text-align: left; direction: ltr; }
.table tbody tr:hover { background: var(--surface-2); }
.table--ruled tbody tr { height: var(--row); }
.table--ruled tbody td { border-block-end-color: var(--ruling); }
.table__toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-block-end: var(--space-3); }

/* ruled station rows: list rows that sit on the ruling */
.ruled { background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--row) - 1px), var(--ruling) calc(var(--row) - 1px) var(--row)); }
.ruled__row { display: grid; align-items: center; min-height: var(--row); gap: var(--space-3); }
.ruled__row--head { color: var(--text-2); font-size: var(--size-micro); font-weight: var(--weight-bold); }

/* status words: colour plus a word, never colour alone */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 1px var(--space-3); border-radius: var(--radius-pill); font-size: var(--size-small); font-weight: var(--weight-bold); white-space: nowrap; }
.status--ok { background: var(--ok-soft); color: var(--ok); }
.status--warn { background: var(--warn-soft); color: var(--warn); }
.status--danger { background: var(--danger-soft); color: var(--danger); }
.status--neutral { background: var(--surface-2); color: var(--text-2); }
.status--thread { background: var(--thread-soft); color: var(--thread); }

/* choice buttons for attendance-like marking */
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.choices button { min-height: 40px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); font-weight: var(--weight-bold); transition: transform var(--t-press) var(--ease-out), background-color var(--t-press) var(--ease-out), border-color var(--t-press) var(--ease-out); }
.choices button:hover { border-color: var(--border-strong); }
.choices button:active { transform: scale(0.97); }
.choices button[aria-pressed="true"].is-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.choices button[aria-pressed="true"].is-warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.choices button[aria-pressed="true"].is-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* draft, approval required: the treatment every AI-written text carries */
.draft { border: 1px dashed var(--warn); background: var(--warn-soft); border-radius: var(--radius-sheet); padding: var(--space-3) var(--space-4); }
.draft__label { display: flex; align-items: center; gap: var(--space-2); color: var(--warn); font-weight: var(--weight-bold); font-size: var(--size-small); margin-block-end: var(--space-2); }
.draft__meta { color: var(--text-2); font-size: var(--size-micro); margin-block-start: var(--space-2); }

/* ================================================================ components: feedback */
.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-sheet); border: 1px solid var(--border); background: var(--surface); margin-block-end: var(--space-4); }
.notice .icon { flex: none; margin-block-start: 3px; }
.notice--info { border-color: var(--thread-soft); background: var(--thread-soft); color: var(--text); }
.notice--ok { border-color: var(--ok-soft); background: var(--ok-soft); }
.notice--warn { border-color: var(--warn-soft); background: var(--warn-soft); }
.notice--error { border-color: var(--danger-soft); background: var(--danger-soft); }
.notice--ok .icon { color: var(--ok); } .notice--warn .icon { color: var(--warn); } .notice--error .icon { color: var(--danger); } .notice--info .icon { color: var(--thread); }
.toasts { position: fixed; inset-block-end: var(--space-5); inset-inline-start: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); z-index: 40; width: min(var(--toast-width), calc(100vw - 2 * var(--space-5))); }
.toast { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sheet); box-shadow: var(--shadow-float); transition: opacity var(--t-exit) var(--ease-out), translate var(--t-enter) var(--ease-out); }
@starting-style { .toast { opacity: 0; translate: 0 8px; } }
.toast.is-leaving { opacity: 0; translate: 0 8px; }
.toast .icon { flex: none; margin-block-start: 3px; }
.toast--ok .icon { color: var(--ok); } .toast--error .icon { color: var(--danger); } .toast--info .icon { color: var(--thread); }
.toast__close { margin-inline-start: auto; color: var(--text-3); width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-control); }
.toast__close:hover { background: var(--surface-2); color: var(--text); }

.empty { text-align: center; padding: var(--space-10) var(--space-5); color: var(--text-2); }
.empty .icon { width: 28px; height: 28px; margin-inline: auto; color: var(--text-3); margin-block-end: var(--space-3); }
.empty h3 { color: var(--text); margin-block-end: var(--space-1); }
.empty p { margin-inline: auto; max-width: 48ch; margin-block-end: var(--space-4); }

/* confirmation step without a browser dialog: the action reveals its confirm inline */
.confirm { display: inline-flex; align-items: center; gap: var(--space-2); }
.confirm__ask { display: none; align-items: center; gap: var(--space-2); }
.confirm.is-open .confirm__trigger { display: none; }
.confirm.is-open .confirm__ask { display: inline-flex; }
.confirm__ask span { font-size: var(--size-small); color: var(--text-2); }

/* skeleton: shapes of the final layout, breathing once */
.skeleton { display: block; background: var(--surface-2); border-radius: var(--radius-control); animation: breathe 1600ms var(--ease-in-out) infinite; }
.skeleton--text { height: 1em; margin-block: 0.45em; }
.skeleton--row { height: var(--row); }
@keyframes breathe { 50% { opacity: 0.55; } }

/* ================================================================ components: icons, misc */
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon--small { width: 16px; height: 16px; }
.icon--mirror { transform: scaleX(-1); }
.history { display: flex; gap: 5px; align-items: flex-end; height: 22px; width: 110px; direction: ltr; }
.history i { flex: 1; background: var(--border-strong); border-radius: 1px; }
.history i.is-now { background: var(--thread); }
.meter { display: inline-block; vertical-align: middle; width: 110px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; direction: ltr; }
.meter i { display: block; height: 100%; background: var(--ok); }
.messages { display: flex; flex-direction: column; gap: var(--space-3); }
.message { max-width: 88%; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sheet); background: var(--surface); border: 1px solid var(--border); line-height: 1.75; }
.message--house { align-self: flex-start; }
.message--family { align-self: flex-end; background: var(--thread-soft); border-color: transparent; }
.message__meta { display: block; font-size: var(--size-micro); font-weight: var(--weight-light); color: var(--text-2); margin-block-start: var(--space-1); }
.day-mark { align-self: center; font-size: var(--size-micro); color: var(--text-2); padding-block-end: 2px; border-block-end: 1.5px solid var(--text); }

/* ================================================================ utilities */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack > * + * { margin-block-start: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.grow { flex: 1; }
.push-end { margin-inline-start: auto; }
.center { text-align: center; }
.hide-on-phone { }
@media (max-width: 640px) { .hide-on-phone { display: none !important; } }
@media (min-width: 641px) { .only-phone { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
@media (hover: none) { .table tbody tr:hover { background: transparent; } }
