.skeleton {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.skeleton-row {
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 25%, var(--bg) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-row {
    animation: none;
  }
}

.banner-error {
  background: var(--red-bg);
  color: var(--red);
  padding: 9px 12px;
  border-radius: 8px;
  margin: 8px 0;
}

.modal {
  border: 0;
  border-radius: 14px;
  padding: 20px;
  width: min(640px, calc(100vw - 24px));
  max-height: 88vh;
  overflow-y: auto;
}

.modal::backdrop {
  background: rgb(0 0 0 / 40%);
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.field label {
  font-weight: 600;
  font-size: 13px;
}

.field-error {
  color: var(--red);
  font-size: 12px;
  margin: 0;
}

.field-error:empty {
  display: none;
}

.kv {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.mini th,
.mini td {
  padding: 6px 8px;
  font-size: 13px;
}

.child {
  border-top: 1px solid var(--line);
  margin-top: 14px;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-group p {
  margin: 10px 8px 2px;
  font-size: 11px;
  opacity: 0.7;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-filter input {
  flex: 0 0 auto;
}

.checks {
  display: grid;
  gap: 4px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin: 0;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.card dt {
  color: var(--muted);
  font-size: 12px;
}

.card dd {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 700;
}

.matrix th,
.matrix td {
  text-align: center;
}

.matrix td:first-child,
.matrix th:first-child {
  text-align: start;
}

.matrix input,
.grid-perms input {
  width: auto;
}

#list > .btn,
#list > .actions {
  margin-top: 14px;
}

.toast {
  position: fixed;
  inset-block-end: 20px;
  inset-inline-start: 20px;
  background: var(--ink);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 100;
}

.toast-error {
  background: var(--red);
}

.menu-toggle {
  display: none;
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }

  /* The menu becomes a sticky top bar; its items open behind the toggle. */
  aside {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 10px 16px;
    gap: 10px;
    max-height: 100vh;
    overflow-y: auto;
  }

  .brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
  }

  /* Hamburger: three bars that turn into an X while the menu is open. */
  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0 10px;
    background: rgb(255 255 255 / 12%);
    border: 1px solid rgb(255 255 255 / 25%);
    border-radius: 8px;
    cursor: pointer;
  }

  .menu-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--white);
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  aside.menu-open .menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  aside.menu-open .menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  aside.menu-open .menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  aside:not(.menu-open) nav,
  aside:not(.menu-open) > .link {
    display: none;
  }

  main {
    padding: 16px;
  }

  .kv {
    grid-template-columns: 1fr;
  }
}

/* Subscription cards open the filtered list. */
.card-link {
  cursor: pointer;
}

.card-link:hover,
.card-link:focus-visible {
  border-color: var(--brand, var(--line));
}

/* «إشعاراتي»: one row per notification, unread in bold. */
.inbox {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.inbox-item {
  display: grid;
  gap: 4px;
  text-align: start;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
}

.inbox-item.unread {
  border-inline-start: 4px solid var(--brand, var(--line));
}

.inbox-item:not(.unread) strong {
  font-weight: 400;
}
