/*
 * The administration's own pieces (plan 12, stage 4, D12.150–D12.159), beyond the kit's
 * components: the key's form, a tile that needs attention, the badges of the takedown statuses
 * and the safety verdicts (Figma's local RequestStatus), the review queue's rows, and the
 * takedowns' master-detail (Figma 96:2167): the list at the start, the request's pane at the end.
 */

/* The key: the field, the checkbox and the button on one line where there is room. */
.lq-admin-key {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
}

.lq-admin-key .lq-field {
  flex: 1 1 280px;
}

.lq-admin-key .lq-check {
  min-height: 40px;
}

/* A tile that needs attention: the danger colour on its frame and its label. */
.lq-stat--warn {
  border-color: var(--color-status-danger);
}

.lq-stat--warn .lq-stat__label {
  color: var(--color-status-danger);
}

/* The queue's filters, side by side, their buttons on the fields' line. */
.lq-admin-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

.lq-admin-filters .lq-field {
  flex: 1 1 200px;
  max-width: 280px;
}

/* Codes, links and hashes: left to right, in the mono face, broken anywhere on a narrow cell. */
.lq-code {
  font: 500 12px / 18px var(--font-mono);
  direction: ltr;
  unicode-bidi: isolate;
  overflow-wrap: anywhere;
}

/*
 * Badges of the takedown statuses (Figma's RequestStatus: new is filled, in review is outlined,
 * removed and rejected are muted, the badge's own tint) and of the safety verdicts. Words as well
 * as colour.
 */
.lq-badge--received,
.lq-badge--hidden {
  background: var(--color-bg-inverse);
  color: var(--color-text-inverse);
}

.lq-badge--reviewing {
  background: var(--color-bg-surface);
  box-shadow: inset 0 0 0 1px var(--color-border-strong);
  color: var(--color-text-primary);
}

.lq-badge--countered,
.lq-badge--sensitive {
  background: var(--color-rights-pending-bg);
  color: var(--color-rights-pending);
}

.lq-badge--graphic {
  background: var(--color-status-danger-bg);
  color: var(--color-status-danger);
}

.lq-badge--reinstated,
.lq-badge--safe {
  background: var(--color-status-success-bg);
  color: var(--color-status-success);
}

/* The review queue: one panel per video; a hidden one keeps an amber frame, as before. */
.lq-queue {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lq-queue__row--hidden {
  border-color: var(--color-rights-pending);
}

.lq-queue__row .lq-field {
  flex: 0 1 200px;
}

.lq-queue__row .lq-field__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lq-hide-form .lq-field {
  flex: 1 1 240px;
}

/*
 * Takedowns: the list, and the pane of the request that is open. One column, the pane under the
 * list; from 1280 up, when a request is open, the list narrows to the start and drops its
 * secondary columns, and the pane takes the end (Figma 96:2167).
 */
.lq-td {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* A reference is one word: TR-2026-0917 never breaks at its dashes. */
.lq-td__ref {
  white-space: nowrap;
}

/* The queue's cells a little closer than the package's tables, so its eight columns fit (54:739). */
.lq-td__list .lq-table th,
.lq-td__list .lq-table td {
  padding-inline: 12px;
}

.lq-td__list tr[aria-current] td {
  background: var(--color-bg-subtle);
}

.lq-td__list tr[aria-current] td:first-child {
  position: relative;
}

.lq-td__list tr[aria-current] td:first-child::before {
  content: "";
  position: absolute;
  inset-block: 8px;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--color-accent-amber);
}

.lq-td__pane {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0;
  overflow: hidden;
}

.lq-td__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 24px 0;
}

.lq-td__titles {
  display: flex;
  flex: 1 1 240px;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.lq-td__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.lq-td__nav {
  display: flex;
  flex: none;
  gap: 4px;
  margin-inline-start: auto;
}

.lq-td__body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-inline: 24px;
}

.lq-td__quote {
  padding-inline-start: 12px;
  border-inline-start: 2px solid var(--color-border-strong);
  color: var(--color-text-secondary);
  white-space: pre-line;
}

.lq-td__facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 16px;
  font: 400 14px / 24px var(--font-ui);
}

.lq-td__facts dt {
  color: var(--color-text-muted);
  font: 500 12px / 24px var(--font-ui);
}

.lq-td__facts dd {
  overflow-wrap: anywhere;
}

/* The request's log as a line of rings (96:2167): what happened, then when and by whom. */
.lq-td__audit {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding: 0;
  padding-inline-start: 24px;
  list-style: none;
}

.lq-td__audit li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lq-td__audit li::before {
  content: "";
  position: absolute;
  inset-block-start: 6px;
  inset-inline-start: -22px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--color-border-strong);
  border-radius: 50%;
  background: var(--color-bg-surface);
}

/*
 * The status filter as the design's underlined tabs, each with its count (54:739's toolbar,
 * 54:846): the label 16 in medium, the current one in ink over a 3px amber line.
 */
.lq-tdfilter {
  flex: 1 1 auto;
  min-width: 0;
}

.lq-tdfilter .lq-chips {
  gap: 16px;
}

.lq-tdfilter .lq-chip {
  height: 48px;
  margin-block-end: -1px;
  padding-inline: 4px;
  border: 0;
  border-block-end: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font: 500 16px / 24px var(--font-ui);
}

.lq-tdfilter .lq-chip[aria-pressed="true"] {
  border-block-end-color: var(--color-accent-amber);
  background: transparent;
  color: var(--color-text-primary);
}

.lq-tdfilter .lq-chip[aria-pressed="true"] .lq-chip__count {
  color: var(--color-text-muted);
  opacity: 1;
}

/* The actions stay at the foot of the pane while the request scrolls (Figma's sticky footer). */
.lq-td__foot {
  position: sticky;
  inset-block-end: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 16px 24px;
  border-block-start: 1px solid var(--color-border-default);
  background: var(--color-bg-surface);
}

.lq-td__foot p {
  flex: 1 1 200px;
}

@media (min-width: 1280px) {
  .lq-td--open {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }

  /* Beside the pane the list keeps the reference, the content, the state and the deadline, in
     compact rows (at the end of this sheet); the claimant, the basis and the time are in the pane. */
  .lq-td--open .lq-td__aux {
    display: none;
  }
}

@media (max-width: 767px) {
  .lq-td__head,
  .lq-td__foot {
    padding-inline: 16px;
  }

  .lq-td__body {
    padding-inline: 16px;
  }

  .lq-td__facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .lq-td__facts dd + dt {
    margin-block-start: 8px;
  }
}

/*
 * R9 (work package O, D12.300–D12.304): the queue's summary, search, filters and pages, a row's
 * content, basis and deadline, and the pane's content, evidence, history, note and counts
 * (54:739, 96:2167).
 */

/* «جديد 4، قيد المراجعة 7، ضمن المهلة 100%» (96:2133): the figures in ink, the share in green. */
.lq-td-summary {
  align-items: center;
  font: 500 14px / 20px var(--font-ui);
}

.lq-td-summary > .lq-icon {
  width: 16px;
  height: 16px;
  margin-block-start: 0;
  color: var(--color-status-success);
}

.lq-td-summary strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

.lq-td-summary strong.lq-td-summary__met {
  color: var(--color-status-success);
}

.lq-td-summary--late > .lq-icon,
.lq-td-summary strong.lq-td-summary__met--late {
  color: var(--color-status-danger);
}

/* The search over the queue: the design's top bar field, 480 at most. */
.lq-td-search {
  max-width: 480px;
}

/* The tabs at the start and the filters at the end of one line, over one rule (54:846). */
.lq-td-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 12px;
  border-block-end: 1px solid var(--color-border-default);
}

.lq-td-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-block-end: 8px;
}

.lq-td-filters .lq-field {
  flex: 0 1 auto;
  min-width: 0;
}

/* The design's pills say what they filter by their first choice: the label is for readers. */
.lq-td-filters .lq-field__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lq-td-filters .lq-input {
  min-height: 36px;
  padding-block: 5px;
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  font: 500 14px / 20px var(--font-ui);
}

/* A reference opens its request: the table's first word, set as a link would be. */
.lq-td__open {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-primary);
  font: 500 14px / 20px var(--font-ui);
  text-align: start;
  cursor: pointer;
}

.lq-td__open:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lq-td__list tbody tr {
  cursor: pointer;
}

/* The content (54:739): the frame with its platform, the title on two lines, the publisher. */
.lq-td__content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}

.lq-td__thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: 64px;
  border-radius: var(--radius-sm);
}

/* Without the picture the platform stands in the middle of the frame. */
.lq-td__thumb .lq-thumb__slot--start {
  position: static;
}

.lq-td__content-words {
  min-width: 0;
}

.lq-td__title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--color-text-primary);
  font: 400 14px / 24px var(--font-ui);
}

/* In the pane (96:2167): the larger frame, 128 by 72, and the title in medium. */
.lq-td__content--wide {
  align-items: flex-start;
}

.lq-td__content--wide .lq-td__thumb {
  width: 128px;
  border-radius: var(--radius-md);
}

.lq-td__content--wide .lq-td__title {
  font: 500 14px / 20px var(--font-ui);
}

/* The basis or the law, as the design's tag (54:739): ink on muted. */
.lq-td__basis {
  color: var(--color-text-primary);
}

/* A deadline: its icon and words; in danger under six hours, past it, or decided late. */
.lq-td__due {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-primary);
  font: 500 14px / 20px var(--font-ui);
  white-space: nowrap;
}

.lq-td__due > .lq-icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.lq-td__due--late {
  color: var(--color-status-danger);
}

.lq-td__due--ok {
  color: var(--color-text-secondary);
}

/* The page's place and its arrows, at the foot of the list (54:739). */
.lq-td__pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-block: 12px;
}

.lq-td__pages[hidden],
.lq-td__pages .lq-cluster[hidden] {
  display: none;
}

/* The decisions at the end of the foot, the danger last (96:2167). */
.lq-td__actions {
  margin-inline-start: auto;
}

/* «روابط الأدلة»: each link or file on its line, its icon before its words. */
.lq-td__evidence {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lq-td__proof {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font: 500 14px / 22px var(--font-ui);
}

.lq-td__proof > .lq-icon,
.lq-td__proof-link > .lq-icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--color-text-secondary);
}

.lq-td__proof-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--color-text-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* The history under a rule, as the design divides the pane (96:2625). */
.lq-td__history {
  padding-block-start: 24px;
  border-block-start: 1px solid var(--color-border-default);
}

/* «أضف ملاحظة» under the history, and its form when open. */
.lq-td__add {
  display: flex;
}

.lq-td__note-form {
  padding: 16px;
}

.lq-td__add[hidden],
.lq-td__note-form[hidden] {
  display: none;
}

/* What a note or a question uses of its letters and bytes; at a limit, in the danger colour. */
.lq-td__bytes:empty {
  display: none;
}

.lq-td__bytes--full {
  color: var(--color-status-danger);
}

/* A request's state with its mark before the word (54:739): a dot, or a tick once removed. */
.lq-td-status {
  gap: 6px;
}

.lq-td-status::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.lq-td-status--done::before {
  content: none;
}

.lq-td-status > .lq-icon {
  flex: none;
  width: 12px;
  height: 12px;
}

/* The claimant keeps a line where the table has room, the time and date one line each (54:739). */
.lq-td__who {
  min-width: 120px;
}

.lq-td__when {
  white-space: nowrap;
}

/*
 * Beside the pane (96:2167), a request is a compact row: its reference over its content at the
 * start, its state over its deadline at the end, and the open one marked at its start. The
 * columns' names stay for the reader alone.
 */
@media (min-width: 1280px) {
  .lq-td--open .lq-td__list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .lq-td--open .lq-td__list tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "ref state"
      "content due";
    gap: 4px 12px;
    align-items: center;
    padding-block: 12px;
    padding-inline: 16px 12px;
    border-block-end: 1px solid var(--color-border-default);
    border-inline-start: 3px solid transparent;
  }

  .lq-td--open .lq-td__list tbody tr:last-child {
    border-block-end: 0;
  }

  .lq-td--open .lq-td__list tbody td {
    padding: 0;
    border: 0;
    background: none;
  }

  .lq-td--open .lq-td__list tbody tr[aria-current] {
    border-inline-start-color: var(--color-accent-amber);
    background: var(--color-bg-subtle);
  }

  .lq-td--open .lq-td__list tr[aria-current] td:first-child::before {
    content: none;
  }

  .lq-td--open .lq-td__ref-cell {
    grid-area: ref;
  }

  .lq-td--open .lq-td__content-cell {
    grid-area: content;
  }

  .lq-td--open .lq-td__state-cell {
    grid-area: state;
    justify-self: end;
  }

  .lq-td--open .lq-td__due-cell {
    grid-area: due;
    justify-self: end;
  }

  /* The reference as the design's caption over the title; the publisher is in the pane. */
  .lq-td--open .lq-td__list .lq-td__open {
    min-height: 24px;
    font: 500 12px / 24px var(--font-ui);
  }

  .lq-td--open .lq-td__list .lq-td__content {
    min-width: 0;
  }

  .lq-td--open .lq-td__list .lq-td__content-words > .lq-caption {
    display: none;
  }
}

/*
 * The users and the invites (package P, D12.323–D12.327): a user's state and an invite's state
 * as badges, words as well as colour; the list and the open user's pane reuse the takedowns'
 * master-detail. The invite link's field takes the room the banner leaves it.
 */
.lq-badge--active,
.lq-badge--used {
  background: var(--color-status-success-bg);
  color: var(--color-status-success);
}

.lq-badge--disabled {
  background: var(--color-status-danger-bg);
  color: var(--color-status-danger);
}

.lq-badge--unverified {
  background: var(--color-rights-pending-bg);
  color: var(--color-rights-pending);
}

.lq-badge--open {
  background: var(--color-bg-inverse);
  color: var(--color-text-inverse);
}

.lq-badge--expired {
  background: var(--color-bg-muted);
  color: var(--color-text-secondary);
}

#inv-form .lq-grid {
  --lq-gap: 16px;
}

#inv-link .lq-banner__text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

/* An address in a users' or invites' row stays one word: the frame scrolls sideways on a phone. */
#user-list .lq-code,
#inv-list .lq-code,
#adm-list .lq-code {
  white-space: nowrap;
  overflow-wrap: normal;
}

/*
 * The administration's own shell (package P2-A, Figma page 14). From 1024, once inside: the side
 * nav of 248 at the start (the right), the top bar over the open section. Under 1024 the nav is a
 * strip that scrolls sideways under the top bar, and the content takes the screen's width; on
 * phones the search takes its own line. Before the door opens, the top bar and the door alone.
 */
.lq-admin-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "top"
    "nav"
    "main";
  min-height: 100vh;
}

.lq-admin-top {
  grid-area: top;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  min-width: 0;
  min-height: var(--topbar-height);
  padding: 12px var(--page-padding);
  background: var(--color-bg-surface);
  border-block-end: 1px solid var(--color-border-default);
}

.lq-admin-top__brand {
  display: flex;
  flex: none;
}

.lq-admin-top__search {
  flex: 1 1 320px;
  min-width: 0;
  max-width: 480px;
}

.lq-admin-top__search .lq-search {
  width: 100%;
}

.lq-admin-top .lq-admin-top__back {
  margin-inline-start: auto;
}

.lq-admin-nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--color-bg-surface);
  border-block-end: 1px solid var(--color-border-default);
}

.lq-admin-nav__head {
  display: none;
}

.lq-admin-nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* «الإدارة» beside the mark: a dark tag, as drawn. */
.lq-admin-nav__tag {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-inverse);
  color: var(--color-text-inverse);
  font: 600 12px / 18px var(--font-ui);
}

/* The strip: the sections in a row that scrolls, each its icon and name. */
.lq-admin-nav__list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-inline: var(--page-padding);
  scrollbar-width: none;
}

.lq-admin-nav .lq-tab {
  gap: 8px;
  padding-inline: 8px;
}

.lq-admin-nav .lq-tab .lq-icon {
  width: 18px;
  height: 18px;
}

/* A section's count: a small pill beside its name, gone while there is nothing to count. */
.lq-admin-nav .lq-tab__count {
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--color-bg-subtle);
  color: var(--color-text-secondary);
}

.lq-admin-nav .lq-tab__count:empty {
  display: none;
}

/* «الداخل الآن»: who is in, and what they may do from here. */
.lq-admin-me {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px var(--page-padding);
  border-block-start: 1px solid var(--color-border-default);
}

.lq-admin-me__text {
  flex: 1 1 120px;
  min-width: 0;
}

/* The name stays on its line; what the person is in wraps under it rather than being cut. */
.lq-admin-me__text p:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lq-admin-me__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.lq-admin-main {
  grid-area: main;
  min-width: 0;
  padding: var(--page-padding);
}

.lq-admin-main:focus {
  outline: none;
}

.lq-admin-shell--in .lq-admin-main {
  padding-block-start: 40px;
}

/* The panels take the main's width; a table's frame scrolls inside them, never the page. */
.lq-admin-panels {
  min-width: 0;
}

/* A section's heading and the line under it (Figma page 14). */
.lq-admin-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-block-end: 32px;
}

.lq-admin-head p {
  color: var(--color-text-secondary);
  font: 400 16px / 28px var(--font-ui);
}

@media (min-width: 1024px) {
  .lq-admin-shell--in {
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "nav top"
      "nav main";
  }

  .lq-admin-shell--in .lq-admin-top {
    position: sticky;
    inset-block-start: 0;
    z-index: 15;
    flex-wrap: nowrap;
  }

  .lq-admin-shell--in .lq-admin-top__brand {
    display: none;
  }

  /* The column: the mark and its line, the sections, and who is in at the foot. */
  .lq-admin-nav {
    position: sticky;
    inset-block-start: 0;
    z-index: 16;
    height: 100vh;
    overflow-y: auto;
    padding: 20px 16px 16px;
    border-block-end: 0;
    border-inline-end: 1px solid var(--color-border-default);
  }

  .lq-admin-nav__head {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-inline: 4px;
  }

  .lq-admin-nav__list {
    flex-direction: column;
    margin-block: 24px 16px;
    padding: 0;
    overflow: visible;
  }

  .lq-admin-nav .lq-tab {
    width: 100%;
    height: 44px;
    gap: 12px;
    padding: 0 14px 0 12px;
    border-radius: var(--radius-md);
  }

  .lq-admin-nav .lq-tab .lq-icon {
    width: 20px;
    height: 20px;
  }

  .lq-admin-nav .lq-tab > span:not(.lq-tab__count) {
    flex: 1;
    text-align: start;
  }

  .lq-admin-nav .lq-tab:hover {
    background: var(--color-bg-subtle);
  }

  .lq-admin-nav .lq-tab[aria-selected="true"] {
    background: var(--color-bg-muted);
    font-weight: 600;
  }

  /* The amber mark stands at the start of the chosen section, as the app's nav marks its page. */
  .lq-admin-nav .lq-tab[aria-selected="true"]::after {
    inset-inline: 0 auto;
    inset-block: 12px;
    width: 3px;
    height: auto;
    border-radius: 2px;
  }

  .lq-admin-me {
    margin-block-start: auto;
    padding: 16px 4px 0;
  }
}

/* The door (Figma page 14, «تحقق المشرف»): one card of 440 on the canvas, as the sign-in's. */
.lq-admin-door {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding-block: 40px 24px;
}

.lq-admin-door__card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 440px;
  padding: 32px;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: var(--color-bg-surface);
}

.lq-admin-door__title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lq-admin-door__mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-bg-selection-soft);
  color: var(--color-text-primary);
}

.lq-admin-door__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 4px 16px;
}

.lq-admin-door__links:not(:has(> :not([hidden]))) {
  display: none;
}

.lq-admin-door__who {
  padding-block-start: 16px;
  border-block-start: 1px solid var(--color-border-default);
  text-align: center;
}

/* Before the door opens, the status line sits over the card, as wide as it. */
.lq-admin-shell:not(.lq-admin-shell--in) #status {
  max-width: 440px;
  margin-inline: auto;
}

/* A button that reads as a link in the run of the text: «أعد إرسال الرمز»، «اخرج». */
.lq-admin-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-primary);
  font: 600 14px / 24px var(--font-ui);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lq-admin-link:hover {
  text-decoration-thickness: 2px;
}

.lq-admin-door__links .lq-admin-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* The code: one field of six wide figures, left to right in the mono face. */
.lq-admin-code {
  height: 56px;
  font: 600 24px / 32px var(--font-mono);
  letter-spacing: 0.5em;
  text-align: center;
  text-indent: 0.5em;
}

/* The administrators (Figma page 14 «المشرفون»): the way to add one, the table, two cards. */
.lq-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-block-end: 24px;
}

.lq-admin-toolbar p {
  flex: 0 1 560px;
}

#adm-status:not(:empty) {
  margin-block-end: 16px;
}

.lq-admin-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 24px;
  margin-block-start: 24px;
}

.lq-admin-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 20px / 32px var(--font-heading);
}

.lq-admin-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lq-admin-person__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

/* A cell of two lines (a badge over its words, a name over its id), held to the start. */
.lq-admin-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

/* «أنت»: the account looking at the list, in the selection's soft amber. */
.lq-badge--self {
  background: var(--color-bg-selection-soft);
  color: var(--color-text-primary);
}

/* The log's filters: the fields share the line, the buttons at its end. */
#aud-form .lq-field {
  flex: 1 1 160px;
}

.lq-admin-filters__actions {
  flex: none;
}

#aud-count:empty {
  display: none;
}

@media (max-width: 767px) {
  .lq-admin-top__search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .lq-admin-door {
    padding-block: 16px;
  }

  .lq-admin-door__card {
    padding: 24px 16px;
  }

  .lq-admin-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* What the module shows and hides inside the shell: a class that lays a block out must not bring
   it back. */
.lq-admin-shell [hidden] {
  display: none;
}

/*
 * The organizations (package P2-B, R43; Figma «المؤسسات», page 14): the toolbar (the words, the
 * states as chips, «أنشئ مؤسسة» at the end), an organization's state as a badge, the open one's
 * pane: the plan and quotas in two by two tiles, the members as rows, the danger zone in a red
 * frame; the plan dialog's limits; and the sessions in the user pane (R46).
 */
.lq-badge--suspended {
  background: var(--color-status-danger-bg);
  color: var(--color-status-danger);
}

.lq-badge--deleting {
  background: var(--color-rights-pending-bg);
  color: var(--color-rights-pending);
}

.lq-org-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.lq-org-toolbar .lq-field {
  flex: 1 1 240px;
  max-width: 360px;
}

/* The chips take a line of their own on a phone, and scroll there rather than widen the page. */
.lq-org-filter {
  flex: 1 1 320px;
  min-width: 0;
}

.lq-org-toolbar__create {
  margin-inline-start: auto;
}

.lq-org-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.lq-org-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lq-org-quota {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.lq-org-quota .lq-stat {
  padding: 16px;
  border-color: transparent;
  background: var(--color-bg-subtle);
}

.lq-org-quota .lq-stat--warn {
  border-color: var(--color-status-danger);
}

.lq-org-quota .lq-stat__value {
  font-size: 20px;
  line-height: 28px;
  overflow-wrap: anywhere;
}

.lq-org-members__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lq-org-members {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lq-org-member {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-block: 12px;
  border-block-end: 1px solid var(--color-border-default);
}

.lq-org-member__who {
  display: flex;
  flex: 1 1 160px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lq-org-member .lq-field {
  flex: 0 1 132px;
}

/* The role's label is spoken (it names the member), not shown: the row says who. */
.lq-org-member .lq-field__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lq-org-member__actions {
  flex: none;
}

.lq-org-danger {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  border: 1px solid var(--color-status-danger);
  border-radius: var(--radius-lg);
}

.lq-org-danger__title {
  color: var(--color-status-danger);
}

.lq-org-danger__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding-block: 12px;
}

.lq-org-danger__row + .lq-org-danger__row {
  border-block-start: 1px solid var(--color-border-default);
}

.lq-org-danger__row > div {
  flex: 1 1 220px;
}

.lq-org-danger [hidden],
.lq-org-limit[hidden] {
  display: none;
}

.lq-org-limits {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.lq-org-limit {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 16px;
}

.lq-org-limit .lq-field {
  flex: 1 1 200px;
}

.lq-usr-sessions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 479px) {
  .lq-org-quota {
    grid-template-columns: minmax(0, 1fr);
  }
}

/*
 * Settings and secrets (package P2-C, R44 and R45; Figma «الإعدادات والمفاتيح السرية»). The
 * settings are one card: its tabs along the top with the last save at their end, each setting a
 * row (its title and line at the start, its control at the end), then the save in a foot. A
 * group the server does not answer yet keeps its controls focusable but faded (aria-disabled).
 * The secrets' sources are badges in words; a test's result is a line in the row.
 */
.lq-setcard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 0;
}

.lq-setcard > .lq-tabs {
  grid-row: 1;
  grid-column: 1;
  padding-inline: 24px;
  border-block-end: 0;
}

.lq-setcard > .lq-setcard__saved {
  grid-row: 1;
  grid-column: 2;
  align-self: center;
  padding-inline: 16px 24px;
}

.lq-setcard > .lq-tabpanel {
  grid-column: 1 / -1;
  padding: 8px 24px;
  border-block-start: 1px solid var(--color-border-default);
}

.lq-admin-panels .lq-setcard > .lq-tabpanel {
  padding-block-start: 8px;
}

.lq-setcard__foot {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  align-items: center;
  gap: 12px 16px;
  padding: 16px 24px;
  border-block-start: 1px solid var(--color-border-default);
}

.lq-setcard__audit {
  margin-inline-start: auto;
}

.lq-setrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  padding-block: 16px;
  border-block-end: 1px solid var(--color-border-default);
}

.lq-setgroup > .lq-setrow:last-child,
.lq-tabpanel > .lq-setrow:last-child {
  border-block-end: 0;
}

.lq-setrow__text {
  display: flex;
  flex: 1 1 280px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lq-setrow__control {
  display: flex;
  flex: 0 1 240px;
  justify-content: flex-end;
}

.lq-setrow__control--wide {
  flex-basis: 360px;
}

.lq-setrow__control--switch {
  flex: none;
}

.lq-setgroup {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Held, waiting for the server: still reachable by the keyboard, read as not taking a change. */
.lq-input[aria-disabled="true"] {
  background: var(--color-bg-subtle);
  color: var(--color-text-secondary);
  cursor: not-allowed;
}

.lq-toggle[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
}

.lq-seccard {
  padding-inline: 0;
}

.lq-seccard > :not(#sec-list) {
  margin-inline: 24px;
}

/* The server's state and the section's line take no room until they say something; the live
   line stays in the tree, so what it says later is heard. */
#sec-state:empty {
  display: none;
}

#sec-status:not(:has(.lq-banner)) {
  margin-block-start: calc(-1 * var(--lq-gap, 16px));
}

/* A key's source and its last test, each as wide as its words. */
.lq-secstatus {
  align-items: flex-start;
}

.lq-secname {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

#sec-list .lq-secname .lq-code {
  white-space: nowrap;
  overflow-wrap: normal;
}

.lq-secactions {
  flex-wrap: nowrap;
  gap: 4px;
}

.lq-badge--secdb {
  background: var(--color-status-success-bg);
  color: var(--color-status-success);
}

.lq-badge--secenv {
  background: var(--color-bg-muted);
  color: var(--color-text-secondary);
}

.lq-badge--secunset {
  background: var(--color-status-danger-bg);
  color: var(--color-status-danger);
}

/* A test's line: its reason may be long, and breaks within the narrow status column. */
.lq-sectest {
  overflow-wrap: anywhere;
}

.lq-sectest--ok {
  color: var(--color-status-success);
}

.lq-sectest--fail {
  color: var(--color-status-danger);
}

/* The value's field with its eye beside it, at the field's foot. */
.lq-secvalue {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.lq-secvalue .lq-field {
  flex: 1 1 auto;
}

.lq-secvalue .lq-iconbtn {
  flex: none;
  width: 44px;
  height: 44px;
}

@media (max-width: 767px) {
  .lq-setcard {
    grid-template-columns: minmax(0, 1fr);
  }

  .lq-setcard > .lq-tabs,
  .lq-setcard > .lq-tabpanel,
  .lq-setcard__foot {
    padding-inline: 16px;
  }

  /* One column: the last save over the tabs, in the page's order. */
  .lq-setcard > .lq-tabs,
  .lq-setcard > .lq-setcard__saved {
    grid-row: auto;
    grid-column: 1;
  }

  .lq-setcard > .lq-setcard__saved {
    padding: 12px 16px 0;
  }

  .lq-setrow__text {
    flex-basis: 200px;
  }

  .lq-setrow__control:not(.lq-setrow__control--switch) {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .lq-seccard > :not(#sec-list) {
    margin-inline: 16px;
  }
}
