@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("/fonts/NotoNaskhArabic-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("/fonts/NotoNaskhArabic-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
:root {
  --bg: #f3efe6;
  --ink: #1c1915;
  --muted: #5e574c;
  --card: #fffdf8;
  --line: #e4d9c8;
  --green: #0e6b52;
  --green-dark: #084736;
  --navy: #1d3557;
  --danger: #8d2f2a;
  --warn-bg: #fff4df;
  --ok-bg: #e7f6ef;
  --bad-bg: #fdecea;
  --shadow: 0 8px 24px rgba(40, 32, 18, 0.06);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Naskh Arabic", Tahoma, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  overflow-x: hidden;
  overflow-wrap: anywhere;
}
a { color: var(--navy); }
button, .button, .action {
  appearance: none;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: white;
  font: inherit;
  min-height: 52px;
  padding: 12px 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-align: center;
}
button.secondary, .button.secondary, .action.secondary { background: var(--navy); }
button.linkish {
  background: transparent;
  color: white;
  min-height: 40px;
  padding: 6px 10px;
}
button:disabled { opacity: 0.65; cursor: progress; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #c9851a;
  outline-offset: 2px;
}
.topbar { background: var(--green-dark); color: white; }
.topbar a, .topbar .linkish { color: white; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 14px 16px 10px; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; overflow-wrap: anywhere; }
.nav { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
.nav a, .nav .linkish { min-height: 44px; display: inline-flex; align-items: center; }
.who { margin: 8px 0 0; font-size: 0.95rem; }
.page { max-width: 1100px; margin: 0 auto; padding: 18px 16px 48px; }
h1 { font-size: 1.7rem; margin: 0 0 12px; }
h2 { margin: 0 0 8px; font-size: 1.25rem; }
.lead, .note, .muted { color: var(--muted); }
.card, .stats article, .action {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.card { padding: 16px; margin: 14px 0; }
.stack { display: grid; gap: 12px; }
.narrow { max-width: 560px; }
label { display: grid; gap: 6px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid #cfc4b2;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  min-height: 48px;
  background: white;
  color: var(--ink);
}
textarea { resize: vertical; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stats article { padding: 14px; display: grid; gap: 4px; }
.stats span { color: var(--muted); }
.stats strong { font-size: 2rem; line-height: 1; }
.home-actions { display: grid; gap: 12px; margin-top: 16px; }
.action { font-size: 1.15rem; font-weight: 700; min-height: 72px; }
.actions, .row-actions, .pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters { display: grid; gap: 12px; }
.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner { border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.success, .form-ok { background: var(--ok-bg); color: #0d5c45; }
.error, .form-error { background: var(--bad-bg); color: var(--danger); }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-weight: 700; }
.badge-valid::before { content: "✓"; }
.badge-broken::before { content: "✕"; }
.badge-valid, .status-valid { background: #e5f6ef; color: #0d5c45; }
.badge-broken, .status-broken { background: #fde8e4; color: #8a2b1d; }
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: right; vertical-align: top; }
th { background: #f7f1e6; }
.empty { text-align: center; padding: 28px 16px; }
.details { display: grid; gap: 10px; }
.details div { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 8px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab { background: white; color: var(--ink); border: 1px solid var(--line); }
.tab.is-active { background: var(--green); color: white; }
.modal { position: fixed; inset: 0; background: rgba(28, 25, 21, 0.45); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal[hidden] { display: none; }
.modal-card { background: white; border-radius: 18px; padding: 16px; max-width: 560px; width: min(560px, 100%); max-height: min(92vh, calc(100vh - 32px)); max-height: min(92dvh, calc(100dvh - 32px)); overflow: auto; }
#export-fallback { display: grid; gap: 8px; }
#export-fallback[hidden] { display: none; }
.plain { padding-inline-start: 18px; }
.form-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(255, 253, 248, 0.96);
  padding-top: 8px;
}
@media (min-width: 800px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .home-actions { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; }
}
@media (max-width: 800px) {
  .page, .topbar-inner { padding-inline: max(12px, env(safe-area-inset-left)); }
  .home-actions .action, .export-row .actions, .filters button, .page-head .button { width: 100%; }
  .export-row .actions { display: grid; }
  .modal { align-items: end; padding: 0; }
  .modal-card { border-radius: 18px 18px 0 0; max-height: 92dvh; }
  h1 { font-size: 1.35rem; }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border: 1px solid var(--line); border-radius: 14px; margin: 0 0 12px; padding: 8px; background: white; }
  table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 4px; }
  table.responsive td::before { content: attr(data-label); font-weight: 700; color: var(--muted); }
  .details div { grid-template-columns: 1fr; }
}
