@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/IBMPlexSansArabic-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/IBMPlexSansArabic-SemiBold.woff2") format("woff2");
}

:root {
  --primary: #1b8354;
  --primary-dark: #166a45;
  --text: #111927;
  --muted: #4d5761;
  --border: #d2d6db;
  --soft-border: #e5e7eb;
  --page: #f8faf9;
  --white: #fff;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  background: var(--page);
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
}
a { color: var(--primary-dark); }
.site-header {
  align-items: center;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  min-height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
}
.brand { align-items: center; display: flex; gap: 18px; text-decoration: none; }
.brand img { display: block; height: auto; width: 150px; }
.brand span { border-inline-start: 1px solid var(--border); color: var(--text); padding-inline-start: 18px; }
.user-actions { align-items: center; display: flex; gap: 12px; margin-inline-start: auto; }
.account-link {
  align-items: center;
  color: var(--text);
  display: flex;
  font-weight: 600;
  gap: 8px;
  text-decoration: none;
}
.account-link:hover { color: var(--primary-dark); }
.user-avatar {
  align-items: center;
  background: #ecfdf3;
  border-radius: 50%;
  color: var(--primary);
  display: flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}
.user-avatar svg { height: 21px; width: 21px; }
.logout-button {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: .86rem;
  min-height: 38px;
  padding: 6px 14px;
}
.logout-button:hover, .logout-button:focus-visible { background: #f3f4f6; border-color: #9da4ae; }
.auth-pending #apps,
.auth-pending #user-actions,
[hidden] { display: none !important; }
.shell { margin: 0 auto; max-width: 1180px; padding: 64px 28px 80px; width: 100%; }
.apps-shell { min-height: calc(100vh - 146px); }
.loading { color: var(--muted); padding: 80px 0; text-align: center; }
.apps-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 0 auto;
  max-width: 820px;
}
.app-card {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--soft-border);
  border-radius: 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 220px;
  padding: 30px 22px;
  text-align: center;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.app-card:hover, .app-card:focus-visible {
  border-color: #88d8ad;
  box-shadow: 0 10px 24px rgba(17, 25, 39, .08);
  outline: 0;
  transform: translateY(-2px);
}
.app-icon {
  align-items: center;
  background: #ecfdf3;
  border-radius: 50%;
  color: var(--primary);
  display: flex;
  height: 68px;
  justify-content: center;
  margin-bottom: 24px;
  width: 68px;
}
.app-icon svg { height: 38px; width: 38px; }
.app-card strong { font-size: 1.2rem; font-weight: 600; line-height: 1.6; }
.app-card small { color: var(--muted); font-size: .88rem; margin-top: 7px; }
.legal-card {
  background: var(--white);
  border: 1px solid var(--soft-border);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(17, 25, 39, .05);
  margin: 0 auto;
  max-width: 880px;
  padding: clamp(26px, 5vw, 56px);
}
.legal-card h1 { font-size: clamp(1.75rem, 4vw, 2.35rem); margin: 0 0 12px; }
.legal-card .updated { color: var(--muted); margin: 0 0 34px; }
.legal-card h2 { font-size: 1.22rem; margin: 30px 0 8px; }
.legal-card p, .legal-card li { color: var(--muted); line-height: 2; }
.legal-card ul { padding-inline-start: 24px; }
.site-footer {
  background: #f3f4f6;
  border-top: 1px solid var(--soft-border);
  color: var(--muted);
  font-size: .83rem;
  padding: 22px 18px;
  text-align: center;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: center; margin-bottom: 10px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary-dark); text-decoration: underline; }

@media (max-width: 620px) {
  .site-header { min-height: 64px; padding: 0 18px; }
  .brand img { width: 125px; }
  .brand span { font-size: .88rem; }
  .user-actions { gap: 7px; }
  .account-link { font-size: .82rem; }
  .user-avatar { height: 30px; width: 30px; }
  .logout-button { font-size: .76rem; min-height: 34px; padding: 5px 9px; }
  .shell { padding: 32px 16px 52px; }
  .apps-grid { gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-card { min-height: 170px; padding: 22px 12px; }
  .app-icon { height: 56px; margin-bottom: 16px; width: 56px; }
  .app-icon svg { height: 31px; width: 31px; }
  .app-card strong { font-size: 1rem; }
  .app-card small { font-size: .76rem; }
}

@media (max-width: 380px) {
  .brand span { display: none; }
  .user-avatar { display: none; }
  .apps-grid { grid-template-columns: 1fr; }
}
