:root {
  --red: #c91f2e;
  --green: #12824c;
  --black: #151515;
  --ink: #1e2422;
  --muted: #66706b;
  --line: #dfe5e1;
  --paper: #f8faf8;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(15, 26, 20, 0.11);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
}

a { color: inherit; text-decoration: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(248, 250, 248, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: 0; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 2px; }

nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: #35413c;
  font-size: 14px;
  font-weight: 600;
}

nav a:hover { background: #eef4ef; }

.language-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.language-switch button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #35413c;
  font: 800 13px Inter, "Noto Kufi Arabic", sans-serif;
  cursor: pointer;
}

.language-switch button.active {
  background: var(--green);
  color: var(--white);
}

.icon-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.icon-button span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--black);
}

.section, .section-band {
  padding: clamp(46px, 6vw, 82px) clamp(18px, 5vw, 72px);
}

.section-band {
  background:
    linear-gradient(135deg, rgba(18, 130, 76, 0.08), transparent 38%),
    linear-gradient(315deg, rgba(201, 31, 46, 0.08), transparent 36%),
    var(--white);
}

.hero {
  min-height: calc(100vh - 145px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.75fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 820px;
  margin-bottom: 12px;
  color: var(--black);
  font-size: clamp(42px, 6.2vw, 78px);
  line-height: 0.98;
  letter-spacing: 0;
}

.arabic {
  margin-bottom: 22px;
  color: var(--green);
  font-family: "Noto Kufi Arabic", Inter, sans-serif;
  font-size: clamp(19px, 2.5vw, 30px);
  font-weight: 700;
  line-height: 1.55;
  text-align: left;
}

.lead {
  max-width: 670px;
  color: #4f5b55;
  font-size: clamp(16px, 1.55vw, 19px);
  line-height: 1.6;
}

.hero-actions, .contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.button.primary {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 10px 22px rgba(18, 130, 76, 0.24);
}

.button.secondary {
  background: var(--white);
  color: var(--black);
  border-color: var(--line);
}

.hero-panel {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.flag-bars {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  height: 12px;
}

.flag-bars span:nth-child(1) { background: var(--red); }
.flag-bars span:nth-child(2) { background: var(--white); }
.flag-bars span:nth-child(3) { background: var(--black); }

.next-event {
  padding: 34px;
  min-height: 238px;
  background:
    radial-gradient(circle at 88% 18%, rgba(18, 130, 76, 0.17), transparent 28%),
    linear-gradient(180deg, #ffffff, #f4f8f5);
}

.next-event small, .stats dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.next-event strong {
  display: block;
  max-width: 360px;
  margin: 16px 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
}

.next-event p {
  color: #51605a;
  line-height: 1.6;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-top: 1px solid var(--line);
}

.stats div { padding: 22px; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats dd { margin: 7px 0 0; font-size: 18px; font-weight: 800; }

.section-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.section-heading h2 {
  margin-bottom: 8px;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

.section-heading p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-weight: 800;
  cursor: pointer;
}

.filter.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.event-grid, .service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.event-card, .service-grid article {
  min-height: 210px;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(26, 34, 29, 0.06);
}

.event-card time, .event-card .tag, .service-grid span {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.event-card h3, .service-grid h3 {
  margin: 14px 0 10px;
  font-size: 22px;
}

.event-card p, .service-grid p {
  color: #59655f;
  line-height: 1.55;
}

.save-event {
  margin-top: 14px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #cdd6d1;
  border-radius: 8px;
  background: #f9fbfa;
  font-weight: 800;
  cursor: pointer;
}

.save-event.saved {
  background: rgba(18, 130, 76, 0.1);
  color: var(--green);
  border-color: rgba(18, 130, 76, 0.35);
}

.member-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  max-width: 1120px;
}

.member-form .button.primary,
.member-form .form-status,
.application-payment,
.member-form .ocr-box {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  color: #41504a;
  font-size: 13px;
  font-weight: 800;
}

input, select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #cfd8d3;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: 600 14px Inter, sans-serif;
}

.form-status {
  grid-column: 1 / -1;
  min-height: 22px;
  margin: 0;
  color: var(--green);
  font-weight: 800;
}

.hidden { display: none !important; }

.portal-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.login-panel,
.dashboard-shell,
.dashboard-empty,
.dashboard,
.import-panel,
.admin-document-panel,
.accounting-alerts,
.application-review,
.overdue-panel,
.profile-card,
.fee-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(26, 34, 29, 0.06);
}

.login-panel {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 16px;
  padding: 22px;
}

.login-panel img {
  width: 66px;
  height: 66px;
  object-fit: contain;
}

.login-panel h3,
.dashboard h3,
.dashboard-empty h3,
.profile-card h4,
.fee-card h4,
.import-panel h4 {
  margin-bottom: 8px;
}

.security-note,
.dashboard-empty p,
.import-panel p,
.bank-box span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#loginForm,
.profile-card,
.fee-card {
  display: grid;
  gap: 14px;
}

.demo-accounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demo-accounts button,
.mini-action {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.dashboard-shell {
  min-height: 520px;
  overflow: hidden;
}

.dashboard-empty {
  display: grid;
  place-content: center;
  min-height: 520px;
  padding: 28px;
  text-align: center;
  box-shadow: none;
  border: 0;
}

.dashboard {
  padding: 20px;
  border: 0;
  box-shadow: none;
}

.dashboard-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.dashboard-topline small {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-topline h3 {
  font-size: clamp(24px, 3vw, 36px);
}

.import-panel {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(18, 130, 76, 0.08), transparent 48%), var(--white);
}

.import-panel .form-status { grid-column: 1 / -1; }

.admin-document-panel,
.accounting-alerts,
.application-review,
.overdue-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.application-payment {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(18, 130, 76, 0.25);
  border-radius: 8px;
  background: rgba(18, 130, 76, 0.08);
}

.application-payment strong { color: var(--green); }
.application-payment span { color: var(--muted); font-size: 13px; line-height: 1.5; }

.application-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(220px, 0.75fr) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(18, 130, 76, 0.2);
  border-radius: 8px;
  background: rgba(18, 130, 76, 0.04);
}

.application-card div,
.application-card span {
  display: grid;
  gap: 4px;
}

.application-card summary {
  color: var(--green);
  font-weight: 900;
  cursor: pointer;
}

.application-card pre {
  max-height: 180px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  white-space: pre-wrap;
  font: 600 12px/1.5 Inter, "Noto Kufi Arabic", sans-serif;
}

.admin-document-panel {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.admin-document-panel p,
.empty-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.receipt-alert {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(201, 31, 46, 0.18);
  border-radius: 8px;
  background: rgba(201, 31, 46, 0.04);
}

.accounting-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-action.approve {
  color: var(--green);
  border-color: rgba(18, 130, 76, 0.35);
  background: rgba(18, 130, 76, 0.08);
}

.mini-action.danger {
  color: var(--red);
  border-color: rgba(201, 31, 46, 0.3);
  background: rgba(201, 31, 46, 0.06);
}

.receipt-alert div,
.receipt-alert span {
  display: grid;
  gap: 4px;
}

.receipt-alert summary {
  color: var(--green);
  font-weight: 900;
  cursor: pointer;
}

.receipt-alert pre,
.ocr-box {
  max-height: 180px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: #45524c;
  white-space: pre-wrap;
  font: 600 12px/1.5 Inter, "Noto Kufi Arabic", sans-serif;
}

.overdue-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(201, 31, 46, 0.18);
  border-radius: 8px;
  background: #fffafa;
}

.overdue-card div {
  display: grid;
  gap: 4px;
}

.overdue-card span {
  color: #59655f;
  font-size: 13px;
}

.overdue-card b {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(201, 31, 46, 0.1);
  color: var(--red);
  font-size: 12px;
}

.overdue-card.severe {
  border-color: rgba(201, 31, 46, 0.4);
  box-shadow: 0 10px 24px rgba(201, 31, 46, 0.08);
}

.overdue-priority-list {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(201, 31, 46, 0.36);
  border-radius: 8px;
  background: rgba(201, 31, 46, 0.06);
}

.overdue-priority-list h5 {
  margin: 0;
  color: var(--red);
  font-size: 15px;
}

.overdue-priority-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.overdue-priority-list li {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(4, minmax(110px, 1fr));
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: var(--white);
}

.overdue-priority-list span {
  color: #59655f;
  font-size: 12px;
  font-weight: 700;
}

.file-drop {
  position: relative;
  min-width: 180px;
}

.file-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-drop span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 14px;
  border: 1px dashed rgba(18, 130, 76, 0.45);
  border-radius: 8px;
  background: rgba(18, 130, 76, 0.08);
  color: var(--green);
  font-weight: 900;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--white);
}

th, td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: #45524c;
  background: #f6f8f6;
  font-weight: 900;
}

td strong { display: block; }
td small { color: var(--muted); }

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-chip.paid { color: var(--green); background: rgba(18, 130, 76, 0.1); }
.status-chip.pending { color: #8a5a00; background: rgba(212, 151, 24, 0.15); }
.status-chip.overdue { color: var(--red); background: rgba(201, 31, 46, 0.1); }

.member-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
}

.profile-card,
.fee-card {
  padding: 18px;
}

.amount-due {
  padding: 22px;
  border-radius: 8px;
  background: var(--black);
  color: var(--white);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 900;
  line-height: 1;
}

.fee-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.fee-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.fee-card dt { color: var(--muted); font-weight: 800; }
.fee-card dd { margin: 0; font-weight: 900; text-align: right; }

.bank-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(18, 130, 76, 0.25);
  border-radius: 8px;
  background: rgba(18, 130, 76, 0.08);
}

.bank-box strong { color: var(--green); }

.document-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(18, 130, 76, 0.22);
  border-radius: 8px;
  background: rgba(18, 130, 76, 0.06);
}

.document-box a {
  color: var(--green);
  font-weight: 900;
  text-decoration: underline;
}

.document-box small,
.document-box span {
  color: var(--muted);
  font-size: 13px;
}

[dir="rtl"] body,
body.rtl {
  font-family: "Noto Kufi Arabic", Inter, system-ui, sans-serif;
}

[dir="rtl"] .site-header,
[dir="rtl"] .brand,
[dir="rtl"] .hero-actions,
[dir="rtl"] .contact-actions,
[dir="rtl"] .dashboard-topline,
[dir="rtl"] .fee-card dl div {
  flex-direction: row-reverse;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] p,
[dir="rtl"] label,
[dir="rtl"] th,
[dir="rtl"] td,
[dir="rtl"] .arabic,
[dir="rtl"] .section-heading,
[dir="rtl"] .next-event,
[dir="rtl"] .login-panel,
[dir="rtl"] .dashboard,
[dir="rtl"] .dashboard-empty,
[dir="rtl"] .footer {
  text-align: right;
}

[dir="rtl"] .fee-card dd {
  text-align: left;
}

[dir="rtl"] .hero {
  direction: rtl;
}

[dir="rtl"] .hero-copy,
[dir="rtl"] .hero-panel,
[dir="rtl"] .portal,
[dir="rtl"] .section {
  direction: rtl;
}

[dir="rtl"] table {
  direction: rtl;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 16px;
}

.gallery-grid div {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  border-radius: 8px;
  color: var(--white);
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72)),
    linear-gradient(135deg, var(--green), var(--red));
}

.gallery-grid div:nth-child(2) { background: linear-gradient(135deg, #141414, #406b4d); }
.gallery-grid div:nth-child(3) { background: linear-gradient(135deg, #8a1821, #202020); }

.gallery-grid strong { font-size: 24px; }
.gallery-grid span { margin-top: 8px; font-family: "Noto Kufi Arabic", Inter, sans-serif; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 46px clamp(18px, 5vw, 72px);
  background: var(--black);
  color: var(--white);
}

.footer img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  margin-bottom: 16px;
}

.footer h2 {
  margin-bottom: 8px;
  font-family: "Noto Kufi Arabic", Inter, sans-serif;
  font-size: 24px;
}

.footer p { color: rgba(255,255,255,0.72); }
.footer .button.secondary { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.25); }

@media (max-width: 900px) {
  .site-header { align-items: flex-start; }
  nav {
    position: absolute;
    top: 80px;
    left: 18px;
    right: 18px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }
  nav.open { display: flex; }
  .language-switch { margin-left: auto; }
  .icon-button { display: block; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding-top: 48px; }
  .event-grid, .service-grid, .member-form, .gallery-grid, .portal-layout, .metric-grid, .member-dashboard-grid { grid-template-columns: 1fr; }
  .login-panel { position: static; }
  .import-panel,
  .admin-document-panel,
  .receipt-alert,
  .application-card,
  .overdue-card,
  .overdue-priority-list li { grid-template-columns: 1fr; }
  .dashboard-topline { flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .stats div { border-right: 0; border-bottom: 1px solid var(--line); }
  .footer { flex-direction: column; }
}

@media (max-width: 520px) {
  .brand { min-width: 0; }
  .brand strong { font-size: 13px; }
  .brand small { font-size: 11px; }
  .brand img { width: 44px; height: 44px; }
  h1 { font-size: 42px; }
  .section, .section-band { padding-left: 16px; padding-right: 16px; }
}
