/* Workspace-level presentation for every admin section.
   Kept separate from the shell and base components so domain screens stay maintainable. */

.view {
  min-width: 0;
}

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 2px 20px;
}

.view-header > div {
  min-width: 0;
}

.view-header h1 {
  margin: 4px 0 5px;
  color: var(--text-primary);
  font-family: "Raleway", "Manrope", sans-serif;
  font-size: clamp(25px, 2vw, 32px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.view-header p {
  max-width: 720px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.view-counter {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 22%, var(--border-subtle));
  border-radius: 999px;
  color: var(--brand-foreground);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 800;
}

.section-kicker {
  margin-bottom: 4px;
  color: var(--brand-foreground);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.card {
  padding: 22px;
}

.card + .card {
  margin-top: 18px;
}

.card-head {
  min-height: 38px;
  margin-bottom: 18px;
}

.card-head h2 {
  font-size: 20px;
  line-height: 1.18;
}

.card-head small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Forms */

.admin-form {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--brand-soft) 48%, transparent), transparent 44%),
    var(--surface-sunken);
}

.admin-form[data-title]::before {
  content: attr(data-title);
  grid-column: 1 / -1;
  padding-bottom: 2px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.toolbar input,
.toolbar select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}

.admin-form input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
}

.admin-form > button {
  min-height: 44px;
  padding-inline: 16px;
  justify-self: stretch;
}

.user-form,
.account-form,
.proxy-form,
.proxy-bulk-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.user-form .account-assignment-field {
  grid-column: 1 / -1;
}

.user-form > button,
.account-form > button,
.proxy-form > button {
  grid-column: 4;
}

.account-assignment-field {
  padding: 12px 14px 14px;
  border-radius: var(--radius-md);
}

.account-assignment-field legend {
  padding: 0 7px;
  color: var(--text-secondary);
  font-weight: 800;
}

.account-assignment-options {
  gap: 9px;
}

.account-assignment-option {
  min-height: 52px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.account-assignment-option > span {
  flex: 1;
}

.account-assignment-option:hover {
  border-color: var(--brand-primary);
  background: var(--surface-hover);
}

.account-assignment-option:has(input:checked) {
  border-color: var(--brand-primary);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.proxy-bulk-form .form-stack {
  grid-column: 1 / -1;
  padding-bottom: 2px;
}

.proxy-bulk-form .form-stack strong {
  color: var(--text-primary);
  font-size: 13px;
}

.proxy-bulk-form .form-stack small {
  max-width: 760px;
  color: var(--text-muted);
  line-height: 1.45;
}

.proxy-bulk-form textarea {
  grid-column: 1 / 4;
  min-height: 122px;
  resize: vertical;
}

.proxy-bulk-form .checkbox-line {
  align-self: center;
  min-height: 44px;
  padding: 0 6px;
}

.proxy-bulk-form > button {
  grid-column: 4;
}

.checkbox-line input {
  accent-color: var(--brand-primary);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(160px, 210px));
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

.toolbar:has(select:nth-child(2):last-child) {
  grid-template-columns: minmax(260px, 1fr) minmax(170px, 220px);
}

#view-won-lots .toolbar,
#view-replay .toolbar {
  grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(170px, 220px)) auto;
}

#view-replay .toolbar {
  grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(170px, 220px));
}

/* Dense entity grids */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
  gap: 16px;
}

.mini-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  box-shadow: 0 1px 2px rgba(13, 26, 46, 0.035);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.mini-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--brand-primary);
  opacity: 0.78;
}

.account-card--manheim::before {
  background: #7057e8;
}

.account-card--iaai::before {
  background: #e04a57;
}

.proxy-card::before {
  background: linear-gradient(90deg, var(--brand-primary), #35a3d8);
}

.mini-card:hover {
  z-index: 1;
  border-color: color-mix(in srgb, var(--brand-primary) 38%, var(--border-subtle));
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.mini-top {
  align-items: center;
  margin-bottom: 14px;
}

.mini-card h3 {
  margin-bottom: 4px;
  color: var(--text-primary);
  font-family: "Raleway", "Manrope", sans-serif;
  font-size: 17px;
  font-weight: 800;
}

.mini-card > p {
  min-height: 20px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 15px 0;
}

.mini-card dl div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}

.mini-card dt {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.mini-card dd {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-actions {
  gap: 7px;
  margin-top: 13px;
}

.entity-actions .row-action,
.bound-user .row-action,
.editor-footer .row-action {
  min-height: 32px;
  border-radius: 7px;
}

.entity-editor {
  gap: 11px;
  margin: 14px 0;
  padding: 15px;
  border-color: color-mix(in srgb, var(--brand-primary) 28%, var(--border-subtle));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--brand-soft) 52%, var(--surface-sunken));
}

.editor-field > span {
  color: var(--text-secondary);
  font-size: 10px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.entity-editor input,
.entity-editor select {
  min-height: 40px;
}

.bound-users {
  gap: 7px;
  margin: 12px 0;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.bound-user {
  min-height: 38px;
  padding: 6px 8px 6px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--surface-sunken);
}

.bound-user > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-slots {
  gap: 9px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.proxy-slot {
  min-height: 68px;
  padding: 10px 11px;
  border-color: var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.proxy-slot > div:first-child {
  min-width: 0;
}

.proxy-slot strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-slot small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

.proxy-slot.is-empty {
  min-height: 54px;
  border-style: dashed;
  background: var(--surface-sunken);
}

.proxy-slot.is-empty strong {
  color: var(--text-secondary);
}

.account-server-auth {
  margin: 13px 0;
  padding: 12px;
  border-color: var(--border-subtle);
  background: var(--surface-sunken);
}

/* Users table */

.table {
  display: block;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.table-row {
  min-width: 1050px;
  min-height: 66px;
  padding: 12px 14px;
  background: var(--surface-raised);
}

.table-head {
  min-height: 44px;
  padding-block: 10px;
  background: var(--surface-sunken);
}

.user-table-row strong {
  color: var(--text-primary);
}

.user-table-row small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.35;
}

.user-table-row .row-actions {
  align-items: flex-start;
}

.chip {
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--surface-sunken);
  font-size: 10px;
  font-style: normal;
}

/* Overview and session workspaces */

.metrics {
  margin-bottom: 18px;
}

.status-grid,
.quick-actions {
  gap: 10px;
}

.status-item {
  min-height: 54px;
  padding: 11px 12px;
}

.quick-actions button {
  min-height: 86px;
  padding: 15px;
}

.workspace-card {
  gap: 12px;
  padding: 16px;
  border-left: 3px solid var(--brand-primary);
}

.workspace-card > div:first-child strong {
  color: var(--text-primary);
  font-size: 14px;
}

.workspace-card > div:first-child small {
  margin-top: 5px;
  color: var(--text-muted);
}

.workspace-sessions {
  gap: 8px 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}

/* Logs */

.logs-shell {
  border: 1px solid var(--border-subtle);
}

.logs-hero {
  padding: 24px 25px 20px;
  background:
    radial-gradient(circle at 92% 0%, color-mix(in srgb, var(--brand-primary) 15%, transparent), transparent 36%),
    linear-gradient(135deg, var(--surface-raised), var(--surface-sunken));
}

.logs-hero h2 {
  margin-top: 5px;
  font-size: 26px;
}

.logs-hero p {
  max-width: 720px;
  line-height: 1.5;
}

.log-tabs {
  gap: 8px;
  padding: 12px 20px;
}

.log-tab {
  min-height: 38px;
  border-radius: var(--radius-sm);
}

.log-panel {
  padding: 21px 22px 24px;
}

.log-panel-head h3 {
  color: var(--text-primary);
  font-size: 18px;
}

.log-panel-head p {
  margin-top: 4px;
  color: var(--text-muted);
}

.toolbar.log-toolbar,
.compact-log-toolbar {
  margin-bottom: 16px;
}

.log-event {
  padding: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-raised);
}

.event-field-grid div {
  min-height: 54px;
  padding: 9px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

/* Won lots and replay */

.won-lots-list,
.replay-list {
  gap: 12px;
}

.won-lot-row {
  padding: 15px 16px;
  border-left-width: 3px;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(13, 26, 46, 0.025);
}

.won-lot-main {
  min-height: 30px;
}

.won-lot-site,
.won-lot-status {
  border-radius: 999px;
  padding: 4px 8px;
}

.replay-card {
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-lg);
}

.replay-meta {
  gap: 8px;
  padding-right: 14px;
  border-right: 1px solid var(--border-subtle);
}

.empty,
.replay-empty-video {
  min-height: 130px;
  padding: 24px;
  border-style: dashed;
  color: var(--text-muted);
  background: var(--surface-sunken);
}

/* Dark mode deliberately styles nested legacy surfaces, not only the page shell. */

:root[data-theme="dark"] .admin-form,
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .entity-editor,
:root[data-theme="dark"] .logs-hero {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.015);
}

:root[data-theme="dark"] .mini-card,
:root[data-theme="dark"] .table,
:root[data-theme="dark"] .log-event,
:root[data-theme="dark"] .replay-card,
:root[data-theme="dark"] .won-lot-row {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1200px) {
  .user-form,
  .account-form,
  .proxy-form,
  .proxy-bulk-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .user-form > button,
  .account-form > button,
  .proxy-form > button,
  .proxy-bulk-form > button {
    grid-column: 3;
  }

  .proxy-bulk-form textarea {
    grid-column: 1 / 3;
  }

  .toolbar.log-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .view-header {
    align-items: flex-start;
    padding-bottom: 15px;
  }

  .view-header h1 {
    font-size: 25px;
  }

  .card {
    padding: 15px;
  }

  .admin-form,
  .user-form,
  .account-form,
  .proxy-form,
  .proxy-bulk-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px;
  }

  .user-form > button,
  .account-form > button,
  .proxy-form > button,
  .proxy-bulk-form > button {
    grid-column: 2;
  }

  .proxy-bulk-form textarea {
    grid-column: 1 / -1;
  }

  .account-assignment-options,
  .toolbar,
  .toolbar:has(select:nth-child(2):last-child),
  #view-won-lots .toolbar,
  #view-replay .toolbar,
  .toolbar.log-toolbar,
  .compact-log-toolbar {
    grid-template-columns: 1fr;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .replay-card {
    grid-template-columns: 1fr;
  }

  .replay-meta {
    padding: 0 0 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
  }
}

@media (max-width: 560px) {
  .view-header p {
    display: none;
  }

  .admin-form,
  .user-form,
  .account-form,
  .proxy-form,
  .proxy-bulk-form {
    grid-template-columns: 1fr;
  }

  .user-form > button,
  .account-form > button,
  .proxy-form > button,
  .proxy-bulk-form > button,
  .user-form .account-assignment-field {
    grid-column: 1;
  }

  .mini-card dl,
  .status-grid,
  .quick-actions {
    grid-template-columns: 1fr;
  }

  .proxy-slot {
    grid-template-columns: 1fr;
  }

  .proxy-slot .topbar-actions {
    justify-content: flex-start;
  }

  .logs-hero,
  .log-panel-head {
    flex-direction: column;
  }
}
