/*
 * The console is a tool, not a product surface. It borrows nothing from the
 * app's design system on purpose: this is the one screen where somebody has to
 * read a queue of unpleasant things quickly, and density beats warmth.
 */

:root {
  --bg: #0f1115;
  --panel: #161a21;
  --panel-2: #1c212a;
  --line: #262d38;
  --ink: #e7ebf2;
  --ink-dim: #98a2b3;
  --accent: #6ea8fe;
  --danger: #f4707a;
  --warn: #f0b45e;
  --ok: #6ddc9a;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.5 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}

[hidden] {
  display: none !important;
}

/* -- Sign in -------------------------------------------------------------- */

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate__card {
  width: min(360px, 100%);
  display: grid;
  gap: 14px;
}

.gate__title {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.14em;
}

.gate__sub {
  margin: -8px 0 0;
  color: var(--ink-dim);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-dim);
}

.field input,
.field textarea,
.field select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
  width: 100%;
}

.field input:focus-visible,
.field textarea:focus-visible,
.button:focus-visible,
.chip:focus-visible,
.tab:focus-visible,
.row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* -- Buttons -------------------------------------------------------------- */

.button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  border-color: #3a4353;
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1220;
  font-weight: 600;
}

.button--ghost {
  background: transparent;
}

.button--danger {
  border-color: #5a2b31;
  color: var(--danger);
}

.button--ok {
  border-color: #26523d;
  color: var(--ok);
}

/* -- Shell ---------------------------------------------------------------- */

.shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  /* A grid item's automatic minimum is its content, so without this a wide
     child (a long chat line, a table) widens the page instead of scrolling
     inside its own panel. */
  min-width: 0;
}

/*
 * The top bar wraps, and the tabs scroll inside it.
 *
 * With three tabs this was a single row that always fitted. With nine, plus a
 * role badge, a language picker, an address and two buttons, its intrinsic
 * width is about 1300px — and because flex items do not shrink below their
 * content by default, that width was pushing the whole grid wider than the
 * window. The symptom was a horizontal scrollbar on every tab and the last
 * stat tile cut off; the cause was entirely up here.
 *
 * So: the bar may wrap onto a second line, and the tab strip takes the space
 * that is left and scrolls within itself. A tab strip that scrolls is a
 * normal thing; a page that scrolls sideways is not.
 */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px 18px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.topbar__brand {
  font-weight: 700;
  letter-spacing: 0.12em;
}

.topbar__tag {
  color: var(--ink-dim);
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 6px;
}

.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.who {
  color: var(--ink-dim);
  font-size: 12px;
  font-family: var(--mono);
  /* An address is arbitrary length and it is the least important thing up
     here. It gets a ceiling rather than a share. */
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 4px;
  /* Takes the leftover space and is allowed to be narrower than its contents,
     which `min-width: 0` is what actually permits — `overflow-x` alone does
     nothing on a flex item whose automatic minimum is its content width. */
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-dim);
  padding: 7px 12px;
  font: inherit;
  cursor: pointer;
  /* Without these, "Denetim kaydı" breaks over two lines and makes the whole
     bar taller than every other row in it. */
  white-space: nowrap;
  flex: 0 0 auto;
}

.tab[aria-selected="true"] {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--ink);
}

.split {
  display: grid;
  grid-template-columns: minmax(320px, 40%) 1fr;
  min-height: 0;
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
}

.list {
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.list__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  gap: 6px;
}

.chip {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  padding: 5px 11px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--panel-2);
  color: var(--ink);
  border-color: #3a4353;
}

.list__head .button {
  margin-left: auto;
}

.rows {
  overflow: auto;
  min-height: 0;
}

.row {
  width: 100%;
  text-align: start;
  display: grid;
  gap: 4px;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.row:hover {
  background: var(--panel);
}

.row[aria-current="true"] {
  background: var(--panel-2);
  box-shadow: inset 3px 0 0 var(--accent);
}

.row__top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row__note {
  color: var(--ink-dim);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__meta {
  color: var(--ink-dim);
  font-size: 11px;
  font-family: var(--mono);
}

.badge {
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  white-space: nowrap;
}

.badge--risk {
  border-color: #5a2b31;
  color: var(--danger);
}

.badge--ok {
  border-color: #26523d;
  color: var(--ok);
}

.badge--warn {
  border-color: #5a4a26;
  color: var(--warn);
}

/* -- Detail --------------------------------------------------------------- */

.detail {
  overflow: auto;
  min-height: 0;
  padding: 18px;
}

.detail h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.block h3 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  align-items: baseline;
}

.kv dt {
  color: var(--ink-dim);
  font-size: 12px;
}

.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.quote {
  margin: 0;
  padding: 10px 12px;
  background: var(--panel-2);
  border-left: 2px solid var(--line);
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty {
  color: var(--ink-dim);
  padding: 24px 16px;
  text-align: center;
}

.error {
  color: var(--danger);
  margin: 0;
}

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: 18px;
  margin-inline: auto;
  width: max-content;
  max-width: 90vw;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
}

.spin {
  color: var(--ink-dim);
  padding: 18px;
}

/* ==========================================================================
 * The wider console
 *
 * Everything below was added when the moderation console became an admin
 * panel: an overview, people, plans, chat, switches, announcements and staff.
 * The palette above is unchanged — a tool, dense, dark, borrowing nothing from
 * the app.
 *
 * Layout is flex and grid throughout, with no left/right margins hard-coded,
 * so Arabic mirrors correctly on `dir="rtl"` without a second stylesheet.
 * ========================================================================== */

.view {
  padding: 18px;
  display: grid;
  gap: 16px;
  align-content: start;
  overflow-y: auto;
  min-width: 0;
}

/* -- Panels --------------------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.panel__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.panel--danger {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}

.panel--danger > summary {
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 600;
}

.note {
  margin: 0;
  color: var(--ink-dim);
  font-size: 12.5px;
  line-height: 1.55;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-dim);
  word-break: break-all;
}

/* -- Overview tiles ------------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.tile {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 4px;
  text-align: start;
  color: inherit;
  font: inherit;
}

.tile__value {
  font-size: 26px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.tile__label {
  color: var(--ink-dim);
  font-size: 12.5px;
}

.tile--warn {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
}

.tile--warn .tile__value {
  color: var(--warn);
}

.tile--link {
  cursor: pointer;
}

.tile--link:hover {
  border-color: var(--accent);
}

/* -- Split list / detail -------------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 16px;
  align-items: start;
}

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

.list,
.detail {
  display: grid;
  gap: 12px;
  align-content: start;
}

.detail__body {
  display: grid;
  gap: 14px;
  align-content: start;
}

.rows {
  display: grid;
  gap: 8px;
}

.row {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.row:hover {
  border-color: var(--accent);
}

.row[aria-current='true'] {
  border-color: var(--accent);
  background: var(--panel-2);
}

.row--static {
  cursor: default;
}

.row--static:hover {
  border-color: var(--line);
}

.row__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.row__side {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row__title {
  font-weight: 600;
}

.row__sub,
.row__meta {
  color: var(--ink-dim);
  font-size: 12px;
}

.row__note {
  color: var(--ink);
  font-size: 12.5px;
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.row__top {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* -- The person header ---------------------------------------------------- */

.person {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.person__name {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.person__name h2 {
  margin: 0;
  font-size: 19px;
}

/* -- Key/value ------------------------------------------------------------ */

.kv {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 13px;
}

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

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

/* -- Badges --------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  white-space: nowrap;
}

.badge--ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
}

.badge--warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
}

.badge--bad {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}

.badge--info {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

/* -- Controls ------------------------------------------------------------- */

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.searchbar {
  display: flex;
  gap: 8px;
}

.searchbar .input {
  flex: 1;
}

.input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
}

.input--compact {
  width: auto;
  padding: 5px 8px;
  font-size: 12.5px;
}

.input:focus-visible,
.button:focus-visible,
.row:focus-visible,
.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  padding: 4px 12px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.chip--on {
  color: var(--ink);
  border-color: var(--accent);
}

.chip--id {
  font-family: var(--mono);
  font-size: 11.5px;
}

.link {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  text-align: start;
}

.link--danger {
  color: var(--danger);
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
}

.check--block {
  align-items: flex-start;
  margin-top: 6px;
}

.checks {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.quote {
  margin: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 13px;
}

/* -- Tabs ----------------------------------------------------------------- */

.tab--on {
  color: var(--ink);
  border-color: var(--accent);
}

/* -- Chat ----------------------------------------------------------------- */

.chat {
  display: grid;
  gap: 10px;
}

.chat__body {
  display: grid;
  gap: 8px;
  max-height: 460px;
  overflow-y: auto;
}

.msg {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.msg--removed {
  opacity: 0.6;
  border-style: dashed;
}

.msg__head {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.msg__who {
  font-weight: 600;
  font-size: 12.5px;
}

.msg__when {
  color: var(--ink-dim);
  font-size: 11.5px;
}

.msg__text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* -- People list ---------------------------------------------------------- */

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.people li {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* -- History -------------------------------------------------------------- */

.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.history li {
  border-inline-start: 2px solid var(--line);
  padding-inline-start: 10px;
  display: grid;
  gap: 2px;
}

.history__action {
  font-family: var(--mono);
  font-size: 12px;
}

.history__when {
  color: var(--ink-dim);
  font-size: 11.5px;
}

.history__reason {
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

/* -- Switches ------------------------------------------------------------- */

.flags {
  display: grid;
  gap: 10px;
}

.flag {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 8px;
  background: var(--panel-2);
}

.flag--set {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.flag__name {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.flag__values {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.flag__label {
  color: var(--ink-dim);
  font-size: 12px;
  font-family: var(--mono);
}

.flag__label--strong {
  color: var(--ink);
}

.flag__controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.flag__controls .input {
  width: auto;
  min-width: 120px;
}

/* -- Reveal --------------------------------------------------------------- */

.reveal__out:not(:empty) {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 10px;
}

/* -- Modal ---------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 20px;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 55%);
}

.modal__card {
  position: relative;
  width: min(520px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.modal__title {
  margin: 0;
  font-size: 16px;
}

.modal__body {
  display: grid;
  gap: 12px;
}

.modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* -- Toast tones ---------------------------------------------------------- */

.toast--ok {
  border-color: color-mix(in srgb, var(--ok) 50%, var(--line));
}

.toast--bad {
  border-color: color-mix(in srgb, var(--danger) 50%, var(--line));
}

.person__id {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
