/* agentsys: one stylesheet for both hosts. Winam charter (docs/charte), no framework.
   Mobile first: nothing breaks at 360 px. No inline style anywhere (CSP). */

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  --bg: #11151b;
  --surface: #23272f;
  --surface-2: #2b3039;
  --text: #f5f7fa;
  --text-2: rgba(245, 247, 250, 0.45);
  --border: rgba(255, 255, 255, 0.07);
  --green: #00c853;
  --green-soft: rgba(0, 200, 83, 0.12);
  --gold: #ffc107;
  --gold-soft: rgba(255, 193, 7, 0.12);
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, 0.12);
  --r-control: 12px;
  --r-card: 20px;
  --r-pill: 100px;
  --fs-display: 36px;
  --fs-title: 24px;
  --fs-subtitle: 18px;
  --fs-body: 15px;
  --fs-small: 14px;
  --fs-tiny: 11px;
  --tap: 44px;
  --font: Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.5;
}

a { color: var(--green); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Type scale */
.h1 { font-size: var(--fs-title); font-weight: 700; margin: 0 0 20px; }
.h2 { font-size: var(--fs-title); font-weight: 700; margin: 0 0 16px; }
.h3 { font-size: var(--fs-subtitle); font-weight: 700; margin: 0 0 12px; }
.display { font-size: var(--fs-display); font-weight: 700; line-height: 1.1; }
.small { font-size: var(--fs-small); }
.tiny { font-size: var(--fs-tiny); text-transform: uppercase; letter-spacing: 0.06em; }
.muted { color: var(--text-2); }
.amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.brand { color: var(--green); font-weight: 700; font-size: var(--fs-subtitle); margin: 0 0 8px; }

/* Layout */
.page { padding: 16px; max-width: 1440px; margin: 0 auto; }
.centered .page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.narrow { width: 100%; max-width: 400px; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 20px;
  min-width: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 10px 20px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--green); color: var(--bg); width: 100%; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-soft); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Fields */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: var(--fs-small); font-weight: 600; color: var(--text-2); }
.input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  font: inherit;
}
.input:focus { border-color: var(--green); outline: none; }
.input[aria-invalid="true"] { border-color: var(--red); }

/* Messages */
.message { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--r-control); font-weight: 600; }
.message-error { background: var(--red-soft); color: var(--red); }
.message-alert { background: var(--gold-soft); color: var(--gold); }
.message-ok { background: var(--green-soft); color: var(--green); }

/* Badges: the four charter variants */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-tiny);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-neutral { background: var(--border); color: var(--text-2); }

/* Facts (label / value) */
.facts { margin: 0; display: grid; gap: 12px; }
.fact { display: grid; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.fact:last-child { border-bottom: 0; padding-bottom: 0; }
.fact dt { font-size: var(--fs-small); color: var(--text-2); }
.fact dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }

/* Lists and tables */
.list { list-style: none; margin: 0; padding: 0; }
.list-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-small);
}
.list-row:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.table th {
  text-align: left; font-weight: 600; color: var(--text-2); font-size: var(--fs-tiny);
  text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Administration shell: menu on the left from tablet width, on top on a phone */
.shell { display: flex; flex-direction: column; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
}
.sidebar .brand { margin: 0; }
.menu { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; flex: 1 1 100%; order: 3; }
.menu-item {
  display: flex; align-items: center; min-height: var(--tap); padding: 0 12px;
  border-radius: var(--r-control); color: var(--text-2); text-decoration: none;
  font-weight: 600; white-space: nowrap;
}
.menu-item:hover { color: var(--text); }
.menu-item.is-active { background: var(--green-soft); color: var(--green); }
.logout { margin: 0 0 0 auto; }
.workspace { flex: 1; padding: 16px; min-width: 0; }

/* Side panel: the detail of an item slides into the page, never a separate window.
   Opened by a link to its id (:target), closed by a link to "#". No script needed. */
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
  visibility: hidden;
}
.side-panel:target, .side-panel.is-open { transform: none; visibility: visible; }
.side-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }

/* Lot 3 sections: helpers, inline confirmations, forms, filters, queues */
.block { display: block; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table tr.is-selected td { background: var(--green-soft); }
.table-dense td { padding: 6px 10px; }
.panel-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.confirm-box { display: grid; gap: 8px; padding: 14px; border-radius: var(--r-control); background: var(--gold-soft); }
.confirm-box p { margin: 0; }
/* Confirmation on the spot without script: the trigger links to the box's id (:target). */
.confirm-form { display: none; }
.confirm-swap:target .confirm-form { display: grid; }
.confirm-swap:target .confirm-trigger { display: none; }
.pause-card { margin-bottom: 16px; }
.pause-state { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; }
.fieldset legend { padding: 0; }
.input-unit { display: flex; gap: 10px; align-items: center; }
.field-error { color: var(--red); font-size: var(--fs-small); font-weight: 600; }
select.input { appearance: auto; }
.filters { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.queues { margin-bottom: 16px; }
.queue + .queue { margin-top: 20px; }
.queue-head { display: flex; gap: 10px; align-items: center; font-size: var(--fs-body); margin: 0 0 8px; }

@media (min-width: 900px) {
  .page { padding: 24px; }
  .shell { flex-direction: row; }
  .sidebar {
    flex-direction: column; align-items: stretch; flex-wrap: nowrap;
    width: 240px; flex: 0 0 240px; border-bottom: 0; border-right: 1px solid var(--border);
    padding: 24px 16px; position: sticky; top: 0; height: 100vh;
  }
  .sidebar .brand { padding: 0 12px 16px; }
  .menu { flex-direction: column; overflow: visible; flex: 0 0 auto; order: 0; }
  .logout { margin: auto 0 0; }
  .logout .btn { width: 100%; }
  .workspace { padding: 32px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  .side-panel { transition: none; }
}
