.agents-page {
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--n1-ink);
  background-color: var(--n1-paper);
  background-image:
    linear-gradient(rgba(67, 45, 27, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(67, 45, 27, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
}

.agents-page .n1-world-header {
  position: fixed;
}

.agents-back {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--n1-ink);
  background: var(--n1-surface);
  border: 2px solid var(--n1-ink);
  box-shadow: 2px 2px 0 var(--n1-ink);
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.agents-back:hover {
  background: var(--n1-yellow);
  transform: translateY(-1px);
}

.agents-console {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 104px 0 70px;
}

.agents-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: 0 2px 18px;
  border-bottom: 2px solid var(--n1-ink);
}

.agents-kicker {
  color: var(--n1-red-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.agents-hero h1 {
  margin: 9px 0 4px;
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.agents-hero p {
  max-width: 650px;
  margin: 10px 0 0;
  color: #6d594d;
  font-size: 13px;
  line-height: 1.5;
}

.agents-hero-rules {
  display: grid;
  grid-template-columns: repeat(3, auto);
  border: 2px solid var(--n1-ink);
  box-shadow: 4px 4px 0 var(--n1-ink);
  background: var(--n1-surface);
}

.agents-hero-rules span {
  min-width: 92px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  color: #6d594d;
  border-right: 1px solid var(--n1-line-soft);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agents-hero-rules span:last-child { border-right: 0; }
.agents-hero-rules b { color: var(--n1-green); font-family: "Archivo Black", sans-serif; font-size: 18px; }
.agents-hero-rules small { display: block; font-size: 9px; font-weight: 900; }

.agents-layout {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 260px minmax(410px, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.agents-panel {
  min-width: 0;
  background: var(--n1-surface);
  border: 2px solid var(--n1-ink);
  box-shadow: 5px 6px 0 var(--n1-ink);
}

.agents-panel-heading {
  min-height: 58px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--n1-mint);
  border-bottom: 2px solid var(--n1-ink);
  text-transform: uppercase;
}

.agents-panel-heading.is-yellow { background: var(--n1-yellow); }
.agents-panel-heading.is-violet { background: var(--n1-violet-soft); }

.agents-panel-heading span {
  color: var(--n1-green);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.agents-panel-heading.is-yellow span { color: var(--n1-red-dark); }
.agents-panel-heading.is-violet span { color: var(--n1-violet); }

.agents-panel-heading strong {
  font-family: "Archivo Black", sans-serif;
  font-size: 13px;
  font-weight: 400;
}

.agents-panel-heading strong b { font: inherit; color: var(--n1-red-dark); }
.agents-panel-heading strong em { font: inherit; font-style: normal; }

.agents-roster,
.agents-live {
  position: sticky;
  top: 94px;
}

.agent-profile-list {
  padding: 12px;
  display: grid;
  gap: 9px;
}

.agent-profile-card {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 9px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--n1-ink);
  background: var(--n1-paper-deep);
  border: 2px solid var(--n1-line-soft);
  text-align: left;
  cursor: pointer;
}

.agent-profile-card:hover {
  border-color: var(--n1-ink);
}

.agent-profile-card.is-selected {
  background: var(--n1-mint);
  border-color: var(--n1-ink);
  box-shadow: 3px 3px 0 var(--n1-ink);
  transform: translate(-1px, -1px);
}

.agent-profile-avatar,
.agent-portrait {
  display: grid;
  place-items: center;
  background: var(--n1-surface);
  border: 2px solid var(--n1-ink);
}

.agent-profile-avatar {
  width: 48px;
  height: 48px;
}

.agent-profile-avatar img,
.agent-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.agent-profile-card strong,
.agent-profile-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-profile-card strong { font-size: 13px; }
.agent-profile-card small { margin-top: 3px; color: #6d594d; font-size: 10px; font-weight: 750; }

.agent-profile-state {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b6aa97;
}

.agent-profile-state.is-live {
  background: var(--n1-green);
  box-shadow: 0 0 0 2px var(--n1-surface);
}

.agent-outline-btn,
.agent-primary-btn,
.agent-danger-btn {
  min-height: 38px;
  padding: 8px 12px;
  border: 2px solid var(--n1-ink);
  box-shadow: 3px 3px 0 var(--n1-ink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.agents-roster > .agent-outline-btn {
  width: calc(100% - 24px);
  margin: 0 12px 14px;
}

.agent-outline-btn { color: var(--n1-ink); background: var(--n1-surface); }
.agent-primary-btn { color: white; background: var(--n1-green); }
.agent-danger-btn { color: white; background: var(--n1-red); }
.agent-outline-btn:hover { background: var(--n1-yellow); }
.agent-primary-btn:hover { background: var(--n1-red-dark); }
.agent-danger-btn:hover { background: var(--n1-ink); }
.agent-outline-btn:disabled,
.agent-primary-btn:disabled,
.agent-danger-btn:disabled { cursor: not-allowed; opacity: 0.45; }

#agent-profile-form { padding: 18px; }

.agent-identity {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.agent-portrait {
  position: relative;
  min-height: 104px;
  background: var(--n1-mint);
  box-shadow: 4px 4px 0 var(--n1-ink);
}

.agent-portrait img { max-width: 86px; max-height: 86px; }

.agent-portrait span {
  position: absolute;
  right: -2px;
  bottom: -2px;
  padding: 4px 7px;
  color: white;
  background: var(--n1-ink);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.agent-identity-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 11px;
  align-content: end;
}

.agent-field { display: block; min-width: 0; }

.agent-field > span,
.agent-style-fieldset legend {
  display: block;
  margin-bottom: 5px;
  color: #6d594d;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.agent-field em { font-style: normal; font-weight: 650; letter-spacing: 0; text-transform: none; }

.agent-field input,
.agent-field select,
.agent-field textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  color: var(--n1-ink);
  background: var(--n1-paper-deep);
  border: 2px solid var(--n1-ink);
  border-radius: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 750;
}

.agent-field input,
.agent-field select { height: 40px; padding: 7px 9px; }
.agent-field textarea { padding: 9px 10px; resize: vertical; line-height: 1.45; }
.agent-field input:focus,
.agent-field select:focus,
.agent-field textarea:focus { outline: 3px solid var(--n1-yellow); outline-offset: 1px; }

.agent-style-fieldset {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.agent-style-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.agent-style-grid label { min-width: 0; cursor: pointer; }
.agent-style-grid input { position: absolute; opacity: 0; pointer-events: none; }

.agent-style-grid label > span {
  min-height: 72px;
  padding: 10px 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: center;
  gap: 2px 8px;
  color: #6d594d;
  background: var(--n1-surface-muted);
  border: 2px solid var(--n1-line-soft);
}

.agent-style-grid i { grid-row: 1 / span 2; align-self: center; color: var(--n1-green); font-size: 16px; }
.agent-style-grid b { color: var(--n1-ink); font-size: 11px; text-transform: uppercase; }
.agent-style-grid small { font-size: 9px; font-weight: 750; }

.agent-style-grid input:checked + span {
  background: var(--n1-mint);
  border-color: var(--n1-ink);
  box-shadow: 3px 3px 0 var(--n1-ink);
  transform: translate(-1px, -1px);
}

.agent-style-grid input:focus-visible + span { outline: 3px solid var(--n1-yellow); outline-offset: 2px; }

.agent-number-grid {
  margin-top: 17px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 10px;
}

.agent-notes { margin-top: 15px; }

.agent-form-actions {
  margin-top: 16px;
  padding-top: 15px;
  display: grid;
  grid-template-columns: auto 1fr 1.35fr;
  gap: 10px;
  border-top: 1px solid var(--n1-line-soft);
}

.agent-message {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--n1-green);
  font-size: 11px;
  font-weight: 850;
}

.agent-message.is-error { color: var(--n1-red-dark); }

.agent-live-list {
  min-height: 210px;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.agent-empty-state {
  min-height: 184px;
  padding: 28px 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #927d6d;
  background: var(--n1-paper-deep);
  border: 2px dashed var(--n1-line-soft);
  text-align: center;
}

.agent-empty-state i { color: var(--n1-green); font-size: 26px; }
.agent-empty-state strong { color: var(--n1-ink); font-size: 12px; text-transform: uppercase; }
.agent-empty-state span { max-width: 180px; font-size: 10px; line-height: 1.45; }

.agent-live-card {
  padding: 11px;
  background: var(--n1-paper-deep);
  border: 2px solid var(--n1-ink);
}

.agent-live-main {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.agent-live-avatar { width: 38px; height: 38px; background: var(--n1-mint); border: 1px solid var(--n1-ink); }
.agent-live-avatar img { width: 100%; height: 100%; object-fit: contain; }
.agent-live-title strong,
.agent-live-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-live-title strong { font-size: 12px; }
.agent-live-title small { margin-top: 2px; color: #6d594d; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.agent-net { font-family: "Archivo Black", sans-serif; font-size: 13px; }
.agent-net.is-up { color: var(--n1-green); }
.agent-net.is-down { color: var(--n1-red-dark); }

.agent-live-stats {
  margin-top: 9px;
  padding-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  border-top: 1px solid var(--n1-line-soft);
}

.agent-live-stats span { min-width: 0; color: #927d6d; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.agent-live-stats b { display: block; margin-top: 2px; color: var(--n1-ink); font-size: 10px; overflow: hidden; text-overflow: ellipsis; }

.agent-live-actions { margin-top: 9px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.agent-live-actions a,
.agent-live-actions button {
  min-height: 30px;
  display: grid;
  place-items: center;
  color: var(--n1-ink);
  background: var(--n1-surface);
  border: 1px solid var(--n1-ink);
  font-size: 9px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}
.agent-live-actions a:hover { background: var(--n1-mint); }
.agent-live-actions button { color: white; background: var(--n1-red); }

.agent-floor-note {
  margin: 0 12px 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px;
  color: #6d594d;
  background: var(--n1-violet-soft);
  border: 1px solid var(--n1-violet);
  font-size: 9px;
  font-weight: 750;
  line-height: 1.45;
}

.agent-floor-note i { color: var(--n1-violet); }

@media (max-width: 1080px) {
  .agents-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .agents-live { position: static; grid-column: 1 / -1; }
  .agent-live-list { grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 0; }
  .agent-empty-state { grid-column: 1 / -1; min-height: 130px; }
}

@media (max-width: 760px) {
  .agents-console { width: calc(100% - 28px); padding-top: 92px; }
  .agents-hero { grid-template-columns: 1fr; }
  .agents-hero-rules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .agents-hero-rules span { min-width: 0; padding: 8px; }
  .agents-layout { grid-template-columns: 1fr; }
  .agents-roster { position: static; }
  .agent-profile-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agents-workbench,
  .agents-live { grid-column: auto; }
}

@media (max-width: 560px) {
  .agents-page .n1-world-header { height: 64px; padding: 8px 12px; }
  .agents-page .n1-stamp { width: 42px; height: 42px; }
  .agents-page .n1-brand { gap: 9px; }
  .agents-page .n1-brand-copy strong { font-size: 14px; }
  .agents-page .n1-brand-copy small { font-size: 8px; }
  .agents-back { width: 36px; padding: 0; justify-content: center; font-size: 0; }
  .agents-back i { font-size: 12px; }
  .agents-page #n1-wallet { min-height: 34px; padding: 0 8px; }
  .agents-console { width: calc(100% - 22px); padding-top: 84px; }
  .agents-hero h1 { font-size: 38px; }
  .agents-hero-rules { display: none; }
  .agent-profile-list { grid-template-columns: 1fr; }
  .agent-identity { grid-template-columns: 82px minmax(0, 1fr); gap: 12px; }
  .agent-portrait { min-height: 82px; }
  .agent-portrait img { max-width: 66px; max-height: 66px; }
  .agent-identity-fields { grid-template-columns: 1fr; }
  .agent-style-grid { grid-template-columns: 1fr; }
  .agent-style-grid label > span { min-height: 56px; }
  .agent-number-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-form-actions { grid-template-columns: 1fr 1fr; }
  .agent-form-actions .agent-primary-btn { grid-column: 1 / -1; grid-row: 1; }
  .agent-live-list { grid-template-columns: 1fr; }
}
