:root {
  --navy: #15445a;
  --teal: #0da9a6;
  --blue: #3d7eb9;
  --green: #07a869;
  --sand: #c1b489;
  --gray: #c2c1c1;
  --sky: #69cee3;
  --cyan: #218caa;
  --ink: #203746;
  --muted: #687985;
  --line: #e2e9ed;
  --surface: #ffffff;
  --background: #f5f8fa;
  --shadow: 0 12px 34px rgba(21, 68, 90, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--ink); font-family: Tahoma, Arial, sans-serif; line-height: 1.7; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { width: min(1120px, calc(100% - 36px)); margin: auto; min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-content: center; text-align: center; border-radius: 15px 15px 15px 5px; color: white; background: var(--navy); font-size: 12px; font-weight: 800; line-height: 1.25; box-shadow: inset 0 -4px 0 rgba(13,169,166,.65); }
.brand-copy { display: grid; line-height: 1.45; }
.brand-copy strong { color: var(--navy); font-size: 16px; }
.brand-copy small { color: var(--muted); font-size: 12px; }
.admin-link { color: var(--navy); font-size: 13px; font-weight: 700; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; transition: .2s ease; }
.admin-link:hover { color: white; background: var(--navy); border-color: var(--navy); }
.page-shell { width: min(1120px, calc(100% - 36px)); margin: 30px auto 58px; }
.welcome-panel { min-height: 250px; position: relative; overflow: hidden; display: flex; align-items: center; padding: 38px 44px; border-radius: 26px; color: white; background: linear-gradient(115deg, #15445a 0%, #1c6174 65%, #0da9a6 125%); box-shadow: var(--shadow); }
.welcome-copy { position: relative; z-index: 2; max-width: 620px; }
.eyebrow { margin: 0 0 7px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .2px; }
.welcome-panel .eyebrow { color: #a9e9e3; }
h1, h2, p { margin-top: 0; }
.welcome-panel h1 { margin: 0; font-size: clamp(29px, 4vw, 42px); line-height: 1.35; letter-spacing: -.6px; }
.welcome-panel h1 span { color: #b8ece7; }
.welcome-description { max-width: 500px; margin: 13px 0 0; color: #e1eff1; font-size: 14px; }
.welcome-art { position: absolute; left: 55px; top: 50%; width: 220px; height: 220px; transform: translateY(-50%); opacity: .9; }
.art-ring { position: absolute; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; }
.ring-one { inset: 10px; }
.ring-two { inset: 38px; border-color: rgba(255,255,255,.48); }
.art-symbol { position: absolute; inset: 0; display: grid; place-items: center; color: #c1b489; font-size: 95px; text-shadow: 0 8px 28px rgba(0,0,0,.15); }
.services-section { margin-top: 42px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; color: var(--navy); font-size: 25px; }
.search-box { width: min(310px, 100%); display: flex; align-items: center; gap: 9px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--muted); }
.search-box input { width: 100%; height: 44px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-icon { font-size: 25px; line-height: 1; }
.services-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.service-card { min-height: 158px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px 12px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 5px 18px rgba(21,68,90,.035); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; text-align: center; }
.service-card:hover, .service-card:focus-visible { transform: translateY(-5px); border-color: rgba(13,169,166,.5); box-shadow: 0 15px 28px rgba(21,68,90,.1); outline: none; }
.service-icon { width: 76px; height: 76px; display: grid; place-items: center; overflow: hidden; border-radius: 22px; background: #e8f4f5; color: var(--navy); font-size: 30px; font-weight: 800; }
.service-icon img { display: block; width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.service-name { color: var(--navy); font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }
.loading-state, .empty-state { grid-column: 1 / -1; padding: 32px 18px; border: 1px dashed #cbd9df; border-radius: 16px; color: var(--muted); background: rgba(255,255,255,.7); text-align: center; font-size: 14px; }
.site-footer { background: var(--navy); color: #e5eff2; }
.footer-inner { width: min(1120px, calc(100% - 36px)); margin: auto; padding: 25px 0 22px; text-align: center; }
.footer-school { margin: 0 0 10px; color: white; font-weight: 800; }
.credits { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px 22px; margin-bottom: 12px; font-size: 12px; color: #d0e0e5; }
.credits strong { color: #c1b489; }
.footer-inner small { color: #b8cbd2; font-size: 11px; }
/* Admin */
.admin-shell { width: min(1120px, calc(100% - 36px)); min-height: calc(100vh - 170px); margin: 38px auto 55px; }
.panel-card { padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.login-panel { width: min(440px, 100%); margin: 55px auto; text-align: center; }
.admin-heading-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 18px; color: white; background: var(--navy); font-size: 27px; }
.login-panel h1, .admin-title-row h1 { margin: 0 0 5px; color: var(--navy); font-size: 27px; }
.muted { color: var(--muted); font-size: 13px; }
.stack-form { display: grid; gap: 15px; margin-top: 22px; text-align: right; }
.stack-form label { display: grid; gap: 7px; color: var(--navy); font-size: 13px; font-weight: 700; }
.stack-form input:not([type="file"]) { width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid #dce5e9; border-radius: 10px; outline: 0; background: #fbfcfd; color: var(--ink); font-size: 13px; }
.stack-form input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,169,166,.1); }
.stack-form input[type="file"] { width: 100%; padding: 11px; border: 1px dashed #b9cbd2; border-radius: 10px; background: #f8fbfc; font-size: 12px; }
.field-help { color: var(--muted); font-weight: 400; font-size: 11px; }
.primary-button, .secondary-button, .danger-button { min-height: 42px; padding: 9px 16px; border: 0; border-radius: 10px; font-size: 13px; font-weight: 800; transition: .2s ease; }
.primary-button { color: white; background: var(--navy); }
.primary-button:hover { background: var(--cyan); }
.secondary-button { color: var(--navy); background: #eaf1f4; }
.secondary-button:hover { background: #dce9ee; }
.danger-button { color: #a83232; background: #fff0f0; }
.danger-button:hover { background: #ffe0e0; }
.form-message { min-height: 20px; margin: 0; color: var(--muted); font-size: 12px; }
.form-message.error { color: #b42318; }
.form-message.success { color: var(--green); }
.admin-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
.admin-title-row .muted { margin: 5px 0 0; }
.admin-layout { display: grid; grid-template-columns: minmax(270px, .85fr) minmax(0, 1.4fr); align-items: start; gap: 20px; }
.panel-card h2 { margin: 0; color: var(--navy); font-size: 19px; }
.editor-card .stack-form { margin-top: 18px; }
.image-preview-wrap { min-height: 116px; display: grid; place-items: center; border: 1px dashed #cad9df; border-radius: 13px; background: #f8fbfc; color: #8b9aa2; font-size: 12px; }
.image-preview-wrap img { width: 92px; height: 92px; object-fit: contain; }
.form-actions { display: flex; gap: 9px; }
.manager-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.manager-heading .muted { margin: 4px 0 0; }
.count-pill { white-space: nowrap; padding: 5px 10px; border-radius: 999px; color: var(--navy); background: #eaf3f5; font-size: 11px; font-weight: 800; }
.admin-services-list { display: grid; gap: 10px; }
.admin-service-row { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; }
.admin-service-thumb { width: 48px; height: 48px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: #e8f4f5; color: var(--navy); font-size: 18px; font-weight: 800; }
.admin-service-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.admin-service-info { min-width: 0; }
.admin-service-info strong { display: block; color: var(--navy); font-size: 13px; }
.admin-service-info small { display: block; max-width: 100%; overflow: hidden; color: var(--muted); direction: ltr; text-align: right; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.admin-service-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 5px; }
.admin-service-actions button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--navy); background: white; font-size: 11px; }
.admin-service-actions button:hover { border-color: var(--teal); }
.admin-service-actions .delete-action { color: #a83232; }
.compact-footer .footer-inner { padding: 15px 0; }
[hidden] { display: none !important; }
@media (max-width: 800px) {
  .services-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: 1fr; }
  .welcome-art { left: -25px; opacity: .35; }
}
@media (max-width: 560px) {
  .header-inner { min-height: 68px; }
  .brand-mark { width: 43px; height: 43px; }
  .admin-link { padding: 7px 10px; font-size: 11px; }
  .page-shell { margin-top: 18px; }
  .welcome-panel { min-height: 225px; padding: 27px 22px; border-radius: 20px; }
  .welcome-panel h1 { font-size: 30px; }
  .welcome-description { max-width: 290px; font-size: 12px; }
  .welcome-art { left: -75px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .section-heading h2 { font-size: 22px; }
  .search-box { width: 100%; }
  .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .service-card { min-height: 140px; padding: 15px 8px; }
  .service-icon { width: 68px; height: 68px; border-radius: 19px; }
  .service-name { font-size: 12px; }
  .credits { flex-direction: column; gap: 4px; }
  .admin-shell { margin-top: 22px; }
  .panel-card { padding: 19px; }
  .admin-title-row { align-items: start; }
  .admin-title-row h1 { font-size: 23px; }
  .admin-service-row { grid-template-columns: 42px minmax(0,1fr); }
  .admin-service-thumb { width: 42px; height: 42px; }
  .admin-service-actions { grid-column: 1 / -1; justify-content: start; }
}


/* Portal identity and Ministry of Education inspired home page */
.portal-body {
  background: #f7fafb;
}

.identity-row {
  direction: ltr;
  width: min(1180px, calc(100% - 40px));
  min-height: 142px;
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: 1fr minmax(260px, 2fr) 1fr;
  align-items: center;
  gap: 18px;
  background: transparent;
}

.identity-ministry,
.identity-school {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.identity-logo {
  display: block;
  object-fit: contain;
  object-position: center;
}

.ministry-logo {
  width: min(150px, 100%);
  height: 105px;
}

.school-logo {
  width: min(142px, 100%);
  height: 142px;
}

.identity-copy {
  direction: rtl;
  text-align: center;
  padding: 8px 12px;
}

.identity-copy h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(23px, 3vw, 32px);
  font-weight: 900;
  line-height: 1.35;
}

.identity-copy p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.identity-kicker {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.page-shell {
  margin-top: 16px;
}

.welcome-panel {
  min-height: 205px;
  padding: 34px 42px;
  border: 1px solid #dcecef;
  border-radius: 22px;
  color: var(--ink);
  background: linear-gradient(110deg, #f2f9fb 0%, #e8f5f7 58%, #eff9f5 100%);
  box-shadow: 0 10px 28px rgba(21, 68, 90, .055);
}

.welcome-copy {
  max-width: 690px;
}

.welcome-panel .eyebrow {
  color: var(--teal);
}

.welcome-panel h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(27px, 4vw, 39px);
  font-weight: 900;
  line-height: 1.35;
}

.welcome-description {
  max-width: 610px;
  margin: 12px 0 0;
  color: #536c79;
  font-size: 14px;
}

.welcome-art {
  left: 48px;
  width: 205px;
  height: 175px;
  opacity: .72;
}

.art-circle {
  position: absolute;
  display: block;
  border: 1px solid rgba(33, 140, 170, .24);
  border-radius: 50%;
}

.art-circle-one {
  inset: 3px 17px;
}

.art-circle-two {
  inset: 26px 40px;
  border-color: rgba(13, 169, 166, .34);
}

.art-book {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--sand);
  font-size: 82px;
}

.services-section {
  margin-top: 38px;
}

.section-heading h2 {
  font-size: 27px;
}

.services-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.service-card {
  min-height: 218px;
  justify-content: flex-start;
  gap: 0;
  overflow: hidden;
  padding: 0 0 16px;
  border: 1px solid #e2e9ed;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 5px 15px rgba(21, 68, 90, .065);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.service-card:hover,
.service-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(13, 169, 166, .55);
  box-shadow: 0 12px 25px rgba(21, 68, 90, .12);
  outline: none;
}

.service-icon-panel {
  width: 100%;
  min-height: 116px;
  display: grid;
  place-items: center;
  background: #e7f2f5;
}

.service-icon-panel[data-color="0"] { background: #ccebe5; }
.service-icon-panel[data-color="1"] { background: #cfe3f3; }
.service-icon-panel[data-color="2"] { background: #e3dcf1; }
.service-icon-panel[data-color="3"] { background: #f6e4c9; }
.service-icon-panel[data-color="4"] { background: #dcebcf; }
.service-icon-panel[data-color="5"] { background: #ccebed; }

.service-icon {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  color: var(--navy);
  font-size: 35px;
  font-weight: 800;
}

.service-icon img {
  width: 100%;
  height: 100%;
  padding: 3px;
  object-fit: contain;
}

.service-name {
  display: block;
  width: calc(100% - 20px);
  margin: 12px auto 8px;
  color: var(--navy);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.4;
}

.service-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 105px;
  margin-top: auto;
  padding: 4px 17px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
  transition: background .2s ease;
}

.service-card:hover .service-open,
.service-card:focus-visible .service-open {
  background: var(--teal);
}

.loading-state,
.empty-state {
  border-color: #cbdde3;
  border-radius: 17px;
  background: rgba(255, 255, 255, .86);
}

.site-footer {
  background: linear-gradient(108deg, #15445a 0%, #176b83 52%, #0da9a6 100%);
}

.footer-inner {
  padding: 25px 0 19px;
}

.footer-school {
  font-size: 15px;
}

.credits {
  gap: 9px 25px;
  margin-bottom: 10px;
}

.credits strong {
  color: #e4d6aa;
}

.footer-copyright {
  display: block;
}

.admin-entry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 13px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  color: rgba(255, 255, 255, .82);
  background: rgba(255, 255, 255, .07);
  font-size: 10px;
  transition: .2s ease;
}

.admin-entry:hover,
.admin-entry:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .16);
  outline: none;
}

.admin-brand-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.footer-settings-card {
  margin-top: 22px;
}

.footer-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--navy);
  font-size: 14px;
}

.footer-credits-editor {
  display: grid;
  gap: 10px;
}

.credit-editor-row {
  display: grid;
  grid-template-columns: minmax(100px, .7fr) minmax(160px, 1.3fr) auto auto;
  align-items: end;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfe;
}

.credit-editor-row > label {
  display: grid;
  gap: 6px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.credit-editor-row input[type="text"] {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid #dce5e9;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.credit-editor-row .credit-visible {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 39px;
  white-space: nowrap;
}

.credit-remove {
  min-height: 37px;
  padding: 7px 10px;
  font-size: 11px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 9px !important;
}

.checkbox-label input {
  width: 17px;
  height: 17px;
  accent-color: var(--teal);
}

@media (max-width: 800px) {
  .identity-row {
    min-height: 122px;
    grid-template-columns: 90px minmax(0, 1fr) 90px;
    gap: 10px;
  }

  .ministry-logo {
    width: 88px;
    height: 76px;
  }

  .school-logo {
    width: 88px;
    height: 100px;
  }

  .services-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .welcome-art {
    left: -25px;
    opacity: .3;
  }

  .credit-editor-row {
    grid-template-columns: 1fr 1.4fr;
  }
}

@media (max-width: 560px) {
  .identity-row {
    width: calc(100% - 24px);
    min-height: 105px;
    grid-template-columns: 66px minmax(0, 1fr) 66px;
    gap: 5px;
    margin-top: 9px;
  }

  .ministry-logo {
    width: 64px;
    height: 58px;
  }

  .school-logo {
    width: 65px;
    height: 76px;
  }

  .identity-copy {
    padding: 4px 2px;
  }

  .identity-kicker {
    font-size: 9px;
  }

  .identity-copy h1 {
    font-size: 19px;
  }

  .identity-copy p:last-child {
    font-size: 10px;
  }

  .page-shell {
    margin-top: 8px;
  }

  .welcome-panel {
    min-height: 190px;
    padding: 25px 20px;
    border-radius: 17px;
  }

  .welcome-panel h2 {
    font-size: 25px;
  }

  .welcome-description {
    max-width: 300px;
    font-size: 12px;
  }

  .welcome-art {
    left: -90px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading h2 {
    font-size: 23px;
  }

  .services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }

  .service-card {
    min-height: 190px;
  }

  .service-icon-panel {
    min-height: 100px;
  }

  .service-icon {
    width: 70px;
    height: 70px;
  }

  .service-name {
    margin-top: 10px;
    font-size: 14px;
  }

  .service-open {
    font-size: 11px;
  }

  .credits {
    flex-direction: column;
    gap: 5px;
  }

  .credit-editor-row {
    grid-template-columns: 1fr;
  }

  .credit-editor-row .credit-visible {
    min-height: auto;
  }
}

/* إخفاء الزخرفة القديمة من البانر */
.welcome-art {
  display: none !important;
}
