/* Albasheer team dashboard. Design language of the client's website as used for the questionnaire: Tajawal (OFL,
   bundled), red #B20000 with a #E50000→#7F0000 gradient, light grey page, white 24px cards, warm grey text.
   Logical properties throughout, so the layout mirrors in Arabic. */
@font-face {
  font-family: "Tajawal";
  src: url("tajawal-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Tajawal";
  src: url("tajawal-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Tajawal";
  src: url("tajawal-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --red: #b20000;
  --red-light: #e50000;
  --red-dark: #7f0000;
  --orange-light: #ffab74;
  --orange-dark: #fe6c0f;
  --orange: #ff8c42;
  --page: #f3f3f3;
  --card-bg: #ffffff;
  --ink: #55504c;
  --ink-strong: #3a3633;
  --ink-soft: #6f6964;
  --line: #e5e7eb;
  --line-strong: #c8ccd4;
  --control-line: #8c8580;
  --ok: #1a9949;
  --ok-text: #146b34;
  --warn-bg: #fff7e8;
  --warn-text: #7a4d00;
  --danger-bg: #fff0ee;
  --r-card: 24px;
  --r-field: 14px;
  --font: "Tajawal", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 16px / 1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body {
  font-size: 17px;
  line-height: 1.75;
}
a {
  color: var(--red);
}
a:hover {
  color: var(--red-dark);
}
h1,
h2,
h3 {
  color: var(--ink-strong);
  margin: 0 0 12px;
  line-height: 1.3;
  font-weight: 500;
}
h1 {
  font-size: 1.6rem;
}
h3 {
  font-size: 1.05rem;
  margin-block-start: 16px;
}
.muted {
  color: var(--ink-soft);
}
.small {
  font-size: 0.85rem;
}
.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.spacer {
  flex: 1;
}
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--red) 55%, white);
  outline-offset: 2px;
}
.skip {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  background: var(--red);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  z-index: 50;
}
.skip:focus {
  top: 12px;
}

.wrap {
  width: min(1360px, 100%);
  margin-inline: auto;
  padding-inline: clamp(12px, 3vw, 40px);
}
.page {
  padding-block: 24px 48px;
  display: grid;
  gap: 20px;
}

/* top bar */
.topbar {
  background: #fff;
  border-block-end: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-in {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-strong);
  font-weight: 500;
  text-decoration: none;
}
.brand img {
  border-radius: 8px;
}
.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}
.nav-a {
  color: var(--ink);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
}
.nav-a:hover {
  background: var(--page);
  color: var(--ink-strong);
}
.nav-a.active {
  background: linear-gradient(to right, var(--red-light), var(--red-dark));
  color: #fff;
}
html[dir="rtl"] .nav-a.active {
  background: linear-gradient(to left, var(--red-light), var(--red-dark));
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.who-name {
  color: var(--ink-strong);
  font-weight: 500;
}
.lang-switch {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--page);
  color: var(--ink);
  text-decoration: none;
}
.live-status {
  font-size: 0.8rem;
  color: var(--ok-text);
  padding: 2px 10px;
  border-radius: 999px;
  background: #eaf7ef;
}
.live-status.stale {
  color: var(--warn-text);
  background: var(--warn-bg);
}

/* cards */
.card {
  background: var(--card-bg);
  border-radius: var(--r-card);
  padding: clamp(16px, 2.4vw, 28px);
  box-shadow:
    0 1px 2px rgb(20 0 0 / 0.04),
    0 8px 24px -12px rgb(20 0 0 / 0.1);
  min-width: 0;
}
.card-h {
  font-size: 1.2rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
summary.card-h {
  cursor: pointer;
  display: list-item;
  margin: 0;
}
details[open] > summary.card-h {
  margin-block-end: 12px;
}
.count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  padding-inline: 8px;
  border-radius: 999px;
  background: var(--page);
  font-size: 0.85rem;
  color: var(--ink-strong);
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.queues {
  display: grid;
  gap: 20px;
}
.queue.safety {
  border: 2px solid var(--red);
}
.login {
  max-width: 460px;
  margin: 6vh auto 0;
  width: 100%;
}

/* buttons and forms */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font: 500 1rem var(--font);
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(to right, var(--red-light), var(--red-dark));
  border: 1px solid var(--red);
  transition:
    filter 0.2s,
    box-shadow 0.2s;
}
html[dir="rtl"] .btn {
  background: linear-gradient(to left, var(--red-light), var(--red-dark));
}
.btn:hover:not(:disabled) {
  background: linear-gradient(to right, var(--orange-light), var(--orange-dark));
  border-color: var(--orange);
  color: #fff;
  box-shadow: 0 10px 24px -10px rgb(254 108 15 / 0.7);
}
.btn:disabled,
.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-ghost {
  font: 500 0.95rem var(--font);
  color: var(--red-dark);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--red);
  background: var(--danger-bg);
}
.btn.small,
.btn-ghost.small {
  padding: 4px 12px;
  font-size: 0.88rem;
}
form.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
}
.stack {
  display: grid;
  gap: 12px;
}
.stack label,
.settings label {
  display: grid;
  gap: 4px;
  color: var(--ink-strong);
  font-weight: 500;
}
label.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
  font: inherit;
  color: var(--ink-strong);
  background: #fcfcfb;
  border: 1px solid var(--control-line);
  border-radius: var(--r-field);
  padding: 8px 12px;
  min-height: 40px;
  max-width: 100%;
}
textarea {
  width: 100%;
  resize: vertical;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgb(178 0 0 / 0.1);
  background: #fff;
}
.search input[type="search"] {
  flex: 1;
  min-width: 240px;
}
fieldset.route {
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 12px 16px;
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}
legend {
  color: var(--red);
  font-weight: 700;
  padding-inline: 6px;
}

/* notices */
.notice {
  margin: 0;
  padding: 12px 18px;
  border-radius: var(--r-field);
}
.notice.ok {
  background: #eaf7ef;
  color: var(--ok-text);
}
.notice.err {
  background: var(--danger-bg);
  color: var(--red-dark);
  border: 1px solid #f3c4bc;
  font-weight: 500;
}
.window {
  padding: 8px 14px;
  border-radius: var(--r-field);
  margin: 8px 0;
}
.window.ok {
  background: #eaf7ef;
  color: var(--ok-text);
}
.window.closed {
  background: var(--warn-bg);
  color: var(--warn-text);
}

/* tables */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: start;
  padding: 10px 8px;
  border-block-end: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.88rem;
}
.cases .headline a {
  color: var(--ink-strong);
  text-decoration: none;
  font-weight: 500;
}
.cases .headline a:hover {
  color: var(--red);
}
.cases .sub {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-block-start: 2px;
}
.case-no {
  font-weight: 700;
  text-decoration: none;
}
.empty {
  margin: 0;
}
.rubric th {
  width: 60%;
}

/* chips and grades */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.82rem;
  color: var(--ink);
  background: #fff;
  white-space: nowrap;
}
.chip.danger {
  border-color: var(--red);
  color: var(--red-dark);
  background: var(--danger-bg);
}
.chip.warn {
  border-color: #f7d9a0;
  color: var(--warn-text);
  background: var(--warn-bg);
}
.chip.team {
  border-color: var(--ink-strong);
  color: var(--ink-strong);
}
.chip.st-qualified,
.chip.st-used_on_air {
  border-color: var(--ok);
  color: var(--ok-text);
}
.chip.st-reviewing,
.chip.st-following_up {
  border-color: var(--orange);
  color: var(--warn-text);
}
.chip.st-closed {
  color: var(--ink-soft);
}
.chip.ds-failed {
  border-color: var(--red);
  color: var(--red-dark);
}
.grade {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-weight: 700;
  color: #fff;
  flex: none;
}
.grade-A {
  background: linear-gradient(135deg, #1fb559, #0e6e33);
}
.grade-B {
  background: linear-gradient(135deg, #3e8ede, #1d5a9a);
}
.grade-C {
  background: linear-gradient(135deg, #f2a33a, #b36a08);
}
.grade-D {
  background: linear-gradient(135deg, #9a938e, #5e5853);
}
.grade-none {
  background: var(--page);
  color: var(--ink-soft);
}
.score {
  font-weight: 700;
  color: var(--ink-strong);
}

/* case */
.case-head {
  display: grid;
  gap: 16px;
}
.case-title {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.case-title .grade {
  width: 52px;
  height: 52px;
  font-size: 1.5rem;
  border-radius: 16px;
}
.case-title h1 {
  margin: 0;
}
.case-title .sub {
  margin: 4px 0 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.case-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.safety-line {
  margin: 8px 0 0;
  color: var(--red-dark);
}
.facts {
  margin: 0;
  display: grid;
}
.fact {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 12px;
  padding-block: 8px;
  border-block-end: 1px solid var(--line);
}
.fact:last-child {
  border: 0;
}
.fact dt {
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.fact dd {
  margin: 0;
  color: var(--ink-strong);
  min-width: 0;
  overflow-wrap: anywhere;
}
.revealed {
  margin-block-start: 6px;
  padding: 6px 12px;
  border-radius: var(--r-field);
  background: var(--warn-bg);
  color: var(--warn-text);
  display: inline-block;
}
.citations li,
.flags li {
  margin-block-end: 6px;
}
.notes {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 10px;
}
.note-text {
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink-strong);
}
.media-index {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.case-links {
  padding-inline-start: 1.2em;
}

/* timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.msg {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  max-width: 86%;
  background: #fff;
}
.msg.in {
  justify-self: start;
  background: #fbfaf9;
}
.msg.out {
  justify-self: end;
  background: #fff5f3;
  border-color: #f3d2cc;
}
.msg.by-team {
  background: #f1f6ff;
  border-color: #cfe0f7;
}
.msg.cited {
  box-shadow: 0 0 0 3px rgb(178 0 0 / 0.25);
}
.msg:target {
  box-shadow: 0 0 0 3px var(--red);
}
.msg-head {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.msg-head strong {
  color: var(--ink-strong);
}
.msg-text {
  margin: 6px 0 0;
  white-space: pre-wrap;
  color: var(--ink-strong);
  overflow-wrap: anywhere;
}
.msg-error {
  color: var(--red-dark);
  margin: 4px 0 0;
  font-size: 0.85rem;
}
.media {
  border-block-start: 1px dashed var(--line-strong);
  margin-block-start: 8px;
  padding-block-start: 8px;
}
.media-head {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.85rem;
}
.filename {
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.media-body {
  margin-block: 8px;
  display: grid;
  gap: 6px;
}
.preview {
  max-width: min(420px, 100%);
  max-height: 360px;
  border-radius: 12px;
  background: #000;
}
img.preview {
  background: transparent;
}
.media-links {
  display: flex;
  gap: 14px;
  font-size: 0.9rem;
}
.circulation {
  margin: 6px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.88rem;
}
.analysis p {
  margin: 4px 0;
}
pre.text {
  white-space: pre-wrap;
  font: inherit;
  font-size: 0.92rem;
  background: var(--page);
  padding: 10px;
  border-radius: 10px;
  max-height: 320px;
  overflow: auto;
}

/* gallery, alerts */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.tile {
  margin: 0;
  display: grid;
  gap: 8px;
}
.tile video {
  width: 100%;
  border-radius: 14px;
  background: #000;
  max-height: 360px;
}
.alert-list {
  margin: 0;
  padding-inline-start: 1.2em;
}
.template {
  border-block-start: 1px solid var(--line);
  padding-block-start: 12px;
}
.tpl-body {
  margin: 0;
  background: var(--page);
  padding: 8px 12px;
  border-radius: 10px;
}
.tpl-name {
  margin: 0;
}
.user-actions {
  display: grid;
  gap: 6px;
}

/* WhatsApp pairing */
.wa-qr {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-block: 12px;
}
.wa-qr img {
  width: 280px;
  height: 280px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-field);
}
.wa-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0 0 12px;
}
.wa-facts dt {
  color: var(--ink-strong);
  font-weight: 500;
}
.wa-facts dd {
  margin: 0;
}

@media (max-width: 860px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .fact {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .msg {
    max-width: 100%;
  }
  .nav {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none;
  }
}
