@font-face {
  font-family: Thmanyah;
  src: url('/fonts/thmanyahsans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Thmanyah;
  src: url('/fonts/thmanyahsans-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Thmanyah;
  src: url('/fonts/thmanyahsans-Black.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: 'Thmanyah Serif';
  src: url('/fonts/thmanyahserifdisplay-Black.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #f7f5ee;
  --surface: #fffefa;
  --surface-soft: #f3f5ef;
  --ink: #12362d;
  --forest: #103c32;
  --green: #0e604e;
  --gold: #a56826;
  --muted: #52685f;
  --line: #dce5db;
  --focus: #146c57;
  --danger: #a52e32;
  font-family: Thmanyah, system-ui, sans-serif;
  background: var(--page);
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(29px, 3.2vw, 44px); font-weight: 900; line-height: 1.18; }
h2 { font-size: 22px; font-weight: 900; line-height: 1.35; }
h3 { font-size: 18px; font-weight: 700; }
a { color: var(--green); text-underline-offset: 3px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background: radial-gradient(ellipse at 42% 23%, #285c4d, transparent 70%), var(--forest);
}
.login-card { width: min(100%, 440px); background: var(--surface); border-radius: 22px; padding: 35px clamp(22px, 6vw, 42px); box-shadow: 0 24px 60px #08271fa1; }
.login-card h1 { margin: 24px 0 15px; font-size: 34px; }
.login-return { display: inline-block; margin-top: 21px; font-size: 14px; }
.starting { margin: 22vh auto 0; text-align: center; padding: 20px; color: var(--muted); }
.wordmark {
  display: inline-flex;
  flex-direction: column;
  width: fit-content;
  align-items: flex-start;
  font: 900 46px/.88 'Thmanyah Serif', Thmanyah, sans-serif;
  text-decoration: none;
  color: #fffdf4;
  padding-block-end: 4px;
}
.wordmark span:last-child { color: #efc27f; }
.wordmark-login, .poster-wordmark { color: var(--forest); }
.wordmark-login span:last-child, .poster-wordmark span:last-child { color: var(--gold); }

.workspace { min-height: 100vh; display: grid; grid-template-columns: minmax(210px, 238px) minmax(0, 1fr); }
.sidebar {
  display: flex;
  gap: 16px;
  flex-direction: column;
  padding: 36px 20px 24px;
  background: var(--forest);
  color: #f5f8ee;
  position: sticky;
  top: 0;
  height: 100dvh;
}
.sidebar > .wordmark, .sidebar-label { margin-inline: 8px; }
.sidebar-label { color: #b6d2c1; font-size: 14px; }
.menu { display: grid; gap: 6px; margin-top: 14px; }
.menu button, .logout {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 12px 10px;
  min-height: 46px;
  text-align: start;
  white-space: normal;
  color: #e0eee2;
  background: transparent;
  font-weight: 700;
}
.menu button svg { flex: 0 0 22px; }
.menu button:hover, .logout:hover { background: #255246; }
.menu button[aria-current] { color: #fffdf4; background: #33705c; }
.sidebar :focus-visible { outline-color: #efc27f; }
.sidebar-foot { margin-top: auto; display: grid; gap: 4px; padding-block-start: 16px; border-top: 1px solid #427266; }
.account-email { display: block; max-width: 100%; margin-inline: 10px; color: #c1dbcf; font-size: 13px; overflow-wrap: anywhere; text-align: start; }
.logout { min-height: 40px; font-size: 14px; }
.main { width: 100%; max-width: 1500px; margin-inline: auto; padding: clamp(23px, 4vw, 65px); }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 25px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(15px, 2.4vw, 27px); min-width: 0; }
.panel-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-block-end: 17px; }
.panel-heading p { margin-block-start: 5px; }
.wrap-heading { flex-wrap: wrap; }
.mosque-layout { display: grid; grid-template-columns: minmax(210px, .75fr) minmax(0, 1.55fr); gap: 18px; align-items: start; }
.mosque-detail, .report-content { display: grid; gap: 18px; min-width: 0; }
.count { border-radius: 8px; padding: 3px 9px; color: var(--green); background: #e8f1e7; font-weight: 700; }
.mosque-list { display: grid; gap: 6px; }
.mosque-choice { border: 1px solid transparent; background: transparent; padding: 7px; color: var(--ink); text-align: start; display: flex; align-items: center; gap: 10px; min-width: 0; border-radius: 10px; }
.mosque-choice:hover { background: var(--surface-soft); }
.mosque-choice[aria-pressed='true'] { background: #e8f1e7; border-color: #b7d1c5; }
.mosque-choice strong { min-width: 0; overflow-wrap: anywhere; }
.emblem { width: 47px; height: 47px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); color: var(--green); flex: 0 0 auto; display: inline-grid; place-items: center; overflow: hidden; }
.emblem img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.emblem-lg { width: 73px; height: 73px; border-radius: 16px; }
.selected-mosque { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 13px; align-items: center; }
.selected-mosque .actions { grid-column: 1 / -1; margin-block-start: 2px; }
.selected-copy { min-width: 0; overflow-wrap: anywhere; }
.selected-copy h2 { font-size: 26px; }
.selected-copy p { margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; text-align: center; padding: 9px 14px; border: 1px solid transparent; border-radius: 10px; font-weight: 700; line-height: 1.4; }
.primary { color: white; background: var(--green); }
.primary:not(:disabled):hover { background: #0a4b3b; }
.secondary { background: #eff4ed; border-color: #d5e3d8; color: var(--ink); }
.secondary:not(:disabled):hover { background: #e0eee3; }
.danger { background: var(--danger); color: white; }
.danger:not(:disabled):hover { background: #812326; }
.button.inline { justify-self: start; }
.search { display: block; margin-block-end: 10px; }
.search input { width: 100%; }
input {
  min-width: 0;
  min-height: 44px;
  background: #fff;
  color: var(--ink);
  border: 1px solid #cbd9ce;
  border-radius: 9px;
  padding: 9px 11px;
}
input[type=file] { padding-block-start: 7px; }
input::file-selector-button { font: inherit; font-size: 13px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--ink); margin-inline-end: 6px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.55; }
.empty { padding-block: 10px; }
.row { display: flex; align-items: center; gap: 10px 14px; justify-content: space-between; border: 0; border-bottom: 1px solid var(--line); padding-block: 13px; min-width: 0; }
.row:last-child { border-bottom: none; padding-block-end: 3px; }
.supervisor-record { flex: 1; min-width: 0; }
.supervisor-record h3 { overflow-wrap: anywhere; }
.supervisor-record p { padding-block-start: 3px; }
.supervisor-row .actions { justify-content: end; }
.small-action { display: inline-flex; align-items: center; min-height: 39px; padding: 5px 8px; border-radius: 7px; background: transparent; border: 1px solid transparent; color: var(--green); font-weight: 700; font-size: 13px; }
.small-action:hover { background: var(--surface-soft); }
.remove-action { color: var(--danger); }
.credential { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-block-start: 7px; grid-column: 1 / -1; }
.credential code { direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; user-select: all; color: #0b372d; background: #ecf2e9; border-radius: 6px; padding: 3px 6px; }
.supervisor-row:has(.credential) { display: grid; grid-template-columns: minmax(0, 1fr) auto; }

.date-field { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; font-weight: 700; font-size: 14px; }
.ranking { margin: 0; padding: 0; list-style: none; }
.rank-row { justify-content: start; }
.rank-number { color: var(--gold); min-width: 25px; font-weight: 900; text-align: center; }
.rank-name { min-width: 0; overflow-wrap: anywhere; flex: 1; font-weight: 700; }
.rank-count { font-weight: 900; white-space: nowrap; color: var(--green); }
.facebook-preview section { border-top: 1px solid var(--line); padding-block: 12px; }
.facebook-preview section:last-child { padding-block-end: 0; }
.facebook-preview h3 span { color: var(--green); font-weight: 700; font-size: 14px; margin-inline-start: 7px; }
.names { margin: 8px 0 0; padding-block: 0; padding-inline: 19px 0; columns: 3 165px; column-gap: 22px; }
.names li { padding-block: 3px; break-inside: avoid; overflow-wrap: anywhere; }
.poster-layout { display: grid; grid-template-columns: minmax(180px, .72fr) minmax(0, 1.28fr); gap: 18px; align-items: start; }
.poster-actions { display: grid; gap: 12px; }
.text-link { width: fit-content; font-weight: 700; font-size: 14px; }
.poster-preview { padding: clamp(25px, 5vw, 52px); text-align: center; min-width: 0; border: 1px solid #deceb1; border-radius: 18px; background: radial-gradient(ellipse at top, #fffcf4 12%, #f0e2c6 100%); }
.poster-wordmark { align-items: center; font-size: clamp(53px, 7vw, 104px); }
.poster-tagline { font-size: clamp(17px, 2.2vw, 23px); font-weight: 700; margin-block: 30px 21px; }
.poster-mosques { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; }
.poster-mosque { display: grid; justify-items: center; align-content: start; gap: 6px; flex: 0 1 124px; overflow-wrap: anywhere; font-weight: 700; }
.poster-mosque .emblem { background: #fefaf1; border-color: #e5d7bd; }
.poster-mosque:has(.emblem) { grid-template-rows: 47px auto; }
.poster-mosque:not(:has(.emblem)) { align-self: end; }

.dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; font-size: 26px; font-family: system-ui, sans-serif; line-height: 1; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); }
dialog { width: min(93%, 475px); max-height: 90dvh; overflow-y: auto; border: 1px solid var(--line); border-radius: 18px; padding: 23px; color: var(--ink); background: var(--surface); box-shadow: 0 12px 50px #08261e57; }
dialog::backdrop { background: #102b23a8; }
.form-stack { display: grid; gap: 7px; }
.form-stack label { font-weight: 700; margin-top: 8px; }
.form-stack > .primary, .dialog-actions { margin-top: 10px; }
.logo-preview .emblem { width: 72px; height: 72px; }
.message { padding: 9px 11px; border-radius: 8px; color: #115040; background: #e3f2e8; font-size: 14px; }
.message[data-error] { color: #80242b; background: #fae9e9; }
.global-message { margin-bottom: 16px; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 196px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
  .main { padding-inline: 24px; }
  .mosque-layout { grid-template-columns: minmax(176px, .7fr) minmax(0, 1.3fr); gap: 12px; }
}
@media (max-width: 820px) {
  .workspace { display: block; }
  .sidebar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'logo label foot' 'nav nav nav'; position: static; height: auto; padding: 15px 19px 10px; gap: 10px; align-items: center; }
  .sidebar > .wordmark { grid-area: logo; margin: 0; font-size: 31px; }
  .sidebar-label { grid-area: label; margin: 0; }
  .menu { grid-area: nav; display: flex; flex-wrap: wrap; margin: 0; }
  .menu button { width: auto; min-height: 42px; padding-block: 7px; }
  .sidebar-foot { grid-area: foot; border: 0; margin: 0; padding: 0; }
  .account-email { display: none; }
}
@media (max-width: 610px) {
  .main { padding: 21px 13px 28px; }
  .sidebar { padding-inline: 12px; }
  .menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .menu button { flex-direction: column; justify-content: center; align-items: center; gap: 3px; padding-inline: 3px; font-size: 12px; text-align: center; }
  .mosque-layout, .poster-layout { grid-template-columns: 1fr; }
  .mosque-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mosque-choice .emblem { width: 37px; height: 37px; }
  .mosque-choice { gap: 6px; font-size: 14px; }
  .selected-mosque .actions { justify-content: start; }
  .poster-preview { grid-row: 1; }
}
@media (max-width: 380px) {
  .supervisor-row, .supervisor-row:has(.credential) { display: grid; grid-template-columns: minmax(0, 1fr); }
  .supervisor-row .actions { justify-content: start; }
  .poster-tagline { margin-block: 23px 15px; }
}

.wordmark img{display:block;width:116px;height:auto}.sidebar .wordmark img{background:#fffaf0;padding:7px}.wordmark-login img{width:172px}.poster-wordmark img{width:min(235px,80%)}
.telegram-panel{padding:18px}.telegram-message{padding:14px 0;border-bottom:1px solid #d5dfd9}.telegram-message h3,.telegram-message p{margin:0 0 8px;white-space:pre-wrap;overflow-wrap:anywhere}.telegram-message textarea{display:block;width:100%;margin-bottom:8px;font:inherit;color:inherit;padding:8px;background:#fff;border:1px solid #adc7c1;border-radius:4px}.telegram-reply{background:#edf4f0;padding:8px}
