/* Metis panel: shell, forms, tables, logs. The sitemap views add sitemap.css. */
/* Metis light theme. Everything downstream reads these tokens, so the whole
   panel can be re-skinned from this one block. */
:root {
  --bg: #252525;          /* page — dark, so the light cards stand off it */

  /* Text sitting directly ON the page (header, sub-nav, crumbs) must invert;
     everything inside a card keeps --text, since cards are still light. */
  --on-bg: #f2f2f2;
  --on-bg-muted: #b9bec4;
  --on-bg-line: rgba(255,255,255,.16);
  --accent-bright: #ff5252; /* the red, lifted to read on the dark page */
  --panel: #e1e6ec;       /* cards — a clear step below the page */
  --panel-2: #d0d7e0;     /* raised surfaces, buttons, table heads */
  --tab: #d0d7e0;         /* resting tab */
  --tab-hover: #c4ccd7;
  --input: #ffffff;       /* fields stay white, so they pop off the cards */
  --line: #c2c9d2;        /* hairlines — dark enough to read on a gray card */
  --line-2: #a8b1bc;      /* stronger border, on hover/open */
  --text: #000000;
  --muted: #000000;       /* secondary text is black too — size and weight
                             carry the hierarchy, not colour */

  --accent: #d92121;      /* Metis red — actions, focus, links */
  --accent-2: #8f1616;    /* deep red — secondary emphasis */
  --accent-soft: #fdecec; /* red tint — chips, danger surfaces */
  --accent-line: #f2c4c4;

  /* Status stays semantic: a monitoring panel cannot show "healthy" in red. */
  --ok: #1a7f37;
  --warn: #b06000;
  --bad: #b3181b;

  --code-bg: #d6dce4;
  --shadow: none;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}
header {
  padding: 18px 24px; border-bottom: 1px solid var(--on-bg-line);
  background: var(--bg);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
/* Lockup: the mark, then "Metis" carrying the weight, then the explainer. */
.brand { display: flex; align-items: center; gap: 11px; }
.brandmark { width: 38px; height: auto; flex: none; }
.brandmark .tail  { stroke: rgba(255,255,255,.32); }
.brandmark .trace { stroke: var(--accent-bright); }
.brandmark .now   { fill: var(--accent-bright); }
header h1 {
  margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.1px;
  color: var(--accent-bright);
}
header h1 .wordmark-sub {
  color: var(--on-bg-muted); font-weight: 500; font-size: 13.5px; letter-spacing: 0;
}
header .sub { color: var(--on-bg-muted); font-size: 12.5px; }
.spacer { flex: 1; }

.tabs { display: flex; gap: 8px; padding: 14px 24px 0; }
.tab {
  padding: 10px 18px; border: 1px solid var(--line); border-bottom: none;
  background: var(--tab); color: var(--muted); cursor: pointer;
  border-radius: 8px 8px 0 0; font-weight: 600; font-size: 13.5px;
  transition: background .12s, color .12s;
}
.tab:hover { background: var(--tab-hover); color: var(--text); }
.tab.active {
  background: var(--panel); color: var(--text);
  box-shadow: inset 0 3px 0 var(--accent);
}

main { padding: 0 24px 40px; }
.section { display: none; }
.section.active { display: block; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-top: 16px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 15px; }
.card .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }

/* Form groups: every field is label / control / hint in that order, so the
   controls line up across a row no matter how long the hints are. */
.group { margin-top: 18px; }
.group:first-of-type { margin-top: 4px; }
.group > h3 {
  margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted);
  padding-bottom: 7px; border-bottom: 1px solid var(--line);
}
.form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 18px; align-items: start; }
.form.two { grid-template-columns: repeat(2, 1fr); }
.form.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1040px) { .form, .form.four { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .form, .form.two, .form.four { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; min-width: 0; }
.field > label {
  display: block; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.field > .fhint { margin: 6px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
.field.endbtn { justify-content: flex-start; }
.field.endbtn > label { visibility: hidden; }

input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; background: var(--input); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* Keyword list: one keyword per line, so it needs real height. */
textarea.keywords {
  height: 128px; padding: 9px 11px; line-height: 1.6; resize: vertical;
  white-space: pre; overflow-x: auto;
}
.kwcount { float: right; font-weight: 400; font-size: 12px; color: var(--muted); }
.kwcount.over { color: var(--bad); }

/* Standalone toggle, styled as its own bordered strip so it can't be
   mistaken for one of the text fields. */
/* Wins over the generic `.field > label` block rule above. */
.field > label.toggle, .toggle {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; margin: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--input);
  cursor: pointer; white-space: normal; font-weight: 400; overflow: visible;
}
.field > label.toggle:hover { border-color: var(--accent); }
.toggle input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.toggle .tt { display: block; font-size: 13px; font-weight: 600; }
.toggle .th { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

.check { display: flex; align-items: center; gap: 9px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.check span { font-size: 13px; }

.btn {
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer;
  font: inherit; font-weight: 600;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; border-color: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger  { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.btn.ghost   { background: transparent; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(26,127,55,.16); }
.dot.off { background: #a8b0ba; }

/* countries */
.countries { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); }
.country { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 6px; font-size: 13px; }
.country:hover { background: #eceff3; }
.country input { width: 15px; height: 15px; accent-color: var(--accent); }
.country .code { color: var(--muted); font-size: 11.5px; font-family: ui-monospace, Consolas, monospace; }

.chiprow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
  /* Neutral by default, so red is free to mean "selected" (see .sm-filters). */
.chip { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 5px 9px; border-radius: 999px; font-size: 12px; display: inline-flex; align-items: center; gap: 8px; }
.chip button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.chip button:hover { color: var(--accent); }

/* log */
pre.log {
  margin: 0; padding: 12px 14px; background: var(--code-bg); border: 1px solid var(--line);
  border-radius: 8px; height: 300px; overflow: auto; white-space: pre-wrap;
  word-break: break-word; font: 12.5px/1.55 ui-monospace, Consolas, monospace; color: #000000;
}
pre.log .ok { color: var(--ok); }
pre.log .bad { color: var(--bad); }
pre.log .warn { color: #a15c00; }
pre.log .sys { color: var(--muted); }

/* table */
.tablewrap { overflow: auto; max-height: 440px; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { padding: 8px 11px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--panel-2); color: var(--muted); font-weight: 600; position: sticky; top: 0; }
td.status-FOUND { color: var(--ok); font-weight: 600; }
td.status-NOT_FOUND, td.status-NO_TOP_STORIES { color: var(--warn); }
td.status-ERROR, td.status-CAPTCHA { color: var(--bad); font-weight: 600; }
td a { color: var(--accent); }

.toast {
  position: fixed; bottom: 22px; right: 22px; background: var(--panel-2);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 11px 16px; border-radius: 8px; font-size: 13px;
  opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { border-left-color: var(--bad); }

/* ---------------------------------------------------------------- access */
/* Hides what a standard user cannot use. Presentation only: the server checks
   the role and the property scope on every request. */
body.role-user .admin-only { display: none !important; }

.userbox { display: inline-flex; align-items: center; gap: 10px; margin-left: 14px; }
.userbox .who { color: var(--on-bg); font-size: 13px; font-weight: 600; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rolebadge { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--on-bg-line); color: var(--on-bg-muted); }
.rolebadge.admin { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn.onbg { color: var(--on-bg); border-color: var(--on-bg-line); background: transparent; }
.btn.onbg:hover { border-color: var(--on-bg); }

.scopebar .row { align-items: flex-end; gap: 18px; }

/* sign-in */
body.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.loginwrap { width: 100%; max-width: 400px; padding: 24px; }
.logincard { padding: 28px; }
.logincard .field { margin-bottom: 14px; }
.loginbrand { text-align: center; margin-bottom: 20px; }
.loginbrand h1 { margin: 8px 0 2px; font-size: 24px; }
.loginerror { color: var(--bad); background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 0 0 16px; }

/* admin */
.pill { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); margin: 1px 3px 1px 0; white-space: nowrap; }
.pill.admin { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pill.off { color: var(--bad); border-color: var(--accent-line); background: var(--accent-soft); }
.proplist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px;
  max-height: 260px; overflow: auto; padding: 2px; }

/* Sitemap monitor controls that act on a property, a sitemap or an issue.
   They are rendered by sitemap.js, so they are matched by their data hooks. */
body.role-user [data-smact],
body.role-user [data-pact="sync"], body.role-user [data-pact="discover"],
body.role-user [data-pact="fetch"], body.role-user [data-pact="settings"],
body.role-user [data-sact="fetch"], body.role-user [data-sact="resubmit"],
body.role-user [data-sact="toggle"],
body.role-user [data-iact="ack"], body.role-user [data-iact="mute"],
body.role-user [data-iact="resolve"], body.role-user [data-iact="fetch"],
body.role-user [data-gact], body.role-user [data-aact],
body.role-user [data-editprop], body.role-user [data-delprop] { display: none !important; }
body.role-user #sm_sm_interval { pointer-events: none; opacity: .7; }
