:root {
  --bg: #08090b;
  --panel: #111419;
  --panel-2: #171b22;
  --line: #282f39;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f4f5f7;
  --muted: #a4adb8;
  --faint: #6d7682;
  --orange: #ff7a1a;
  --orange-2: #ff9f43;
  --teal: #1bc7a6;
  --blue: #4ba3ff;
  --green: #34d399;
  --red: #ff5c5c;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  --radius: 8px;
  color-scheme: dark;
  font-family: Inter, Manrope, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at 18% 0%, rgba(255, 122, 26, 0.16), transparent 32%),
    linear-gradient(145deg, #08090b 0%, #0c0f13 48%, #11100d 100%);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(420px, 100%);
  background: rgba(17, 20, 25, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  color: #111;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  font-weight: 900;
  border-radius: 7px;
}

.brand-mark.small {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.auth-panel h1 {
  margin: 18px 0 24px;
  font-size: 32px;
  line-height: 1.05;
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  color: var(--text);
  background: #0c0f13;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  padding: 11px 12px;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(255, 122, 26, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.13);
}

.primary,
.secondary,
.ghost,
.danger,
.icon-button {
  min-height: 40px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary {
  color: #111;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  font-weight: 800;
}

.secondary {
  color: var(--text);
  background: #1f2630;
  border: 1px solid var(--line);
}

.ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}

.ghost:hover,
.secondary:hover,
.icon-button:hover {
  border-color: rgba(255, 122, 26, 0.42);
  color: var(--text);
}

.danger {
  color: #fff;
  background: rgba(255, 92, 92, 0.16);
  border: 1px solid rgba(255, 92, 92, 0.34);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  transition: grid-template-columns 0.2s ease;
}

.app-shell.menu-open {
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 72px;
  height: 100vh;
  background: rgba(8, 9, 11, 0.82);
  border-right: 1px solid var(--line-soft);
  overflow: hidden;
  transition: width 0.2s ease;
}

.sidebar.open {
  width: 252px;
}

.sidebar-inner {
  position: sticky;
  top: 0;
  width: 252px;
  height: 100vh;
  padding: 18px 14px;
  background: rgba(12, 15, 19, 0.98);
  border-right: 1px solid var(--line);
  transition: width 0.2s ease;
  display: flex;
  flex-direction: column;
}

.app-shell:not(.menu-open) .sidebar-inner {
  width: 72px;
}

.menu-toggle {
  position: absolute;
  top: 18px;
  left: 16px;
  width: 42px;
  height: 42px;
  z-index: 4;
  background: #151a21;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  place-content: center;
  gap: 4px;
}

.menu-toggle span {
  width: 18px;
  height: 2px;
  background: var(--orange);
  display: block;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 4px 0 28px 54px;
  min-height: 42px;
}

.app-shell:not(.menu-open) .side-brand {
  margin-left: 0;
  justify-content: center;
}

.app-shell:not(.menu-open) .side-brand strong,
.app-shell:not(.menu-open) .brand-mark.small {
  display: none;
}

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

.nav button,
.side-logout {
  width: 224px;
  height: 44px;
  color: var(--muted);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 7px;
  text-align: left;
}

.app-shell:not(.menu-open) .nav button,
.app-shell:not(.menu-open) .side-logout {
  width: 44px;
  padding: 0;
  justify-content: center;
  gap: 0;
  font-size: 0;
}

.nav button span,
.side-logout span,
.icon-button span,
.table-actions span,
.chip span {
  width: 18px;
  height: 18px;
  display: inline-grid;
}

.nav button.active,
.nav button:hover {
  color: var(--text);
  background: rgba(255, 122, 26, 0.12);
}

.side-logout {
  margin-top: auto;
}

.main {
  min-width: 0;
  padding: 24px clamp(18px, 4vw, 44px) 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--orange-2);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h2 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  margin-top: 6px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--line);
}

.badge.ok {
  color: var(--green);
  background: rgba(52, 211, 153, 0.1);
}

.badge.warn {
  color: var(--orange-2);
  background: rgba(255, 122, 26, 0.1);
}

.badge.muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--text);
  background: #161b22;
  border: 1px solid var(--line);
}

.vault-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 13px 14px;
  background: rgba(255, 122, 26, 0.11);
  border: 1px solid rgba(255, 122, 26, 0.32);
  border-radius: var(--radius);
}

.page {
  display: grid;
  gap: 18px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 170px auto;
  gap: 10px;
  align-items: end;
}

.toolbar.compact {
  grid-template-columns: minmax(220px, 1fr) 160px auto;
}

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

.chip {
  min-height: 32px;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: #141920;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chip.active {
  color: #111;
  background: var(--orange);
  border-color: var(--orange);
  font-weight: 800;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  background: rgba(17, 20, 25, 0.84);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
}

.metric strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 20, 25, 0.88);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 900;
}

tr:last-child td {
  border-bottom: 0;
}

.select-col {
  width: 42px;
  text-align: center;
}

.select-col input {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--orange);
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  background: rgba(255, 122, 26, 0.1);
  border: 1px solid rgba(255, 122, 26, 0.28);
  border-radius: var(--radius);
}

.bulk-bar select {
  width: min(240px, 100%);
}

.account-name {
  display: grid;
  gap: 4px;
}

.account-name strong {
  font-size: 15px;
}

.account-name span {
  color: var(--muted);
  font-size: 12px;
}

.code-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
}

.code {
  font-size: 21px;
  font-weight: 900;
  color: #fff;
  min-width: 84px;
}

.timer {
  width: 62px;
  height: 6px;
  border-radius: 999px;
  background: #252c35;
  overflow: hidden;
}

.timer span {
  display: block;
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, var(--orange), var(--teal));
}

.group-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.04);
}

.account-group-select {
  min-width: 150px;
  max-width: 220px;
  padding: 8px 10px;
  background: #10141a;
}

.group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
}

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

.table-actions button {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #151a21;
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-grid;
  place-items: center;
}

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

.form-actions button {
  width: auto;
  min-width: 150px;
  padding: 0 16px;
}

.api-keys-panel {
  display: grid;
  gap: 14px;
}

.api-key-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.api-key-form button {
  min-width: 150px;
  padding: 0 16px;
}

.api-key-secret {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(52, 211, 153, 0.32);
  border-radius: 7px;
  background: rgba(52, 211, 153, 0.08);
}

.api-key-secret code {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 18px;
}

.panel {
  background: rgba(17, 20, 25, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.panel h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.panel-headline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-headline h3 {
  margin-bottom: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.audit-row {
  display: grid;
  grid-template-columns: 180px 190px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.audit-row:last-child {
  border-bottom: 0;
}

.audit-row code {
  color: var(--orange-2);
}

.import-file-panel {
  display: grid;
  gap: 14px;
}

.import-batch-controls {
  align-items: end;
}

.import-file-list {
  display: grid;
  gap: 10px;
}

.import-file-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1fr) 42px;
  align-items: end;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.import-file-row.has-error {
  border-color: rgba(255, 92, 92, 0.36);
  background: rgba(255, 92, 92, 0.08);
}

.import-file-row p {
  margin-top: 6px;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.status-line:last-child {
  border-bottom: 0;
}

.confirmation-note {
  margin-top: 14px;
  line-height: 1.5;
}

.confirmations-panel {
  padding: 0;
  overflow: hidden;
}

.confirmations-panel > h3 {
  padding: 18px 18px 0;
}

.confirmation-account-list {
  display: grid;
  gap: 0;
}

.confirmation-account {
  border-top: 1px solid var(--line-soft);
}

.confirmation-account-head {
  width: 100%;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.confirmation-account.open .confirmation-account-head,
.confirmation-account-head:hover {
  background: rgba(255, 122, 26, 0.08);
}

.confirmation-head-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.confirmation-dropdown {
  padding: 16px 18px 18px;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid var(--line-soft);
}

.confirmation-dropdown-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.confirmation-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 14px;
}

.confirmation-items {
  display: grid;
  gap: 10px;
}

.confirmation-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
}

.confirmation-item.failed,
.confirmation-history-item.failed {
  border-color: rgba(255, 92, 92, 0.44);
  background: rgba(255, 92, 92, 0.08);
}

.confirmation-item.processing {
  border-color: rgba(255, 122, 26, 0.42);
  background: rgba(255, 122, 26, 0.08);
}

.confirmation-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.confirmation-select input {
  width: 16px;
  height: 16px;
}

.confirmation-item p {
  margin-top: 6px;
}

.confirmation-item code {
  display: block;
  color: var(--orange-2);
  font-size: 12px;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confirmation-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.confirmation-history-panel {
  margin-top: 18px;
}

.confirmation-history-list {
  display: grid;
}

.confirmation-history-entry {
  border-top: 1px solid var(--line-soft);
}

.confirmation-history-head {
  width: 100%;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.confirmation-history-head:hover,
.confirmation-history-entry.open .confirmation-history-head {
  background: rgba(255, 122, 26, 0.08);
}

.confirmation-history-details {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.confirmation-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
}

.confirmation-history-item p {
  margin-top: 6px;
}

.confirmation-history-item code {
  display: block;
  color: var(--orange-2);
  font-size: 12px;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-error {
  color: #ff9f9f;
}

.steam-session-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.steam-session-form textarea {
  min-height: 86px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.checkbox-label input {
  width: 16px;
  height: 16px;
}

.steam-session-divider {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.payload-grid {
  display: grid;
  gap: 10px;
}

.payload-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
}

.payload-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.payload-row code {
  color: var(--text);
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted-text {
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.64);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-panel {
  width: min(520px, 100%);
  background: #111419;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  max-width: 360px;
  padding: 12px 14px;
  background: #151a21;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.menu-open {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    width: 0;
    height: 0;
    overflow: visible;
  }

  .sidebar-inner {
    position: fixed;
    inset: 0 auto 0 0;
    width: 252px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open .sidebar-inner {
    transform: translateX(0);
  }

  .app-shell:not(.menu-open) .sidebar-inner {
    width: 252px;
  }

  .app-shell:not(.menu-open) .nav button,
  .app-shell:not(.menu-open) .side-logout {
    width: 224px;
    padding: 0 12px;
    justify-content: flex-start;
    gap: 12px;
    font-size: inherit;
  }

  .app-shell:not(.menu-open) .side-brand {
    margin: 4px 0 28px 54px;
    justify-content: flex-start;
  }

  .app-shell:not(.menu-open) .brand-mark.small {
    display: grid;
  }

  .app-shell:not(.menu-open) .side-brand strong {
    display: block;
  }

  .main {
    padding-top: 82px;
  }

  .toolbar,
  .toolbar.compact,
  .api-key-form,
  .api-key-secret,
  .two-col,
  .metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .auth-panel {
    padding: 24px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .panel-headline,
  .bulk-bar,
  .import-file-row {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .payload-row {
    grid-template-columns: 1fr 42px;
  }

  .payload-row > span {
    grid-column: 1 / -1;
  }

  .confirmation-account-head,
  .confirmation-history-head,
  .confirmation-dropdown-top,
  .confirmation-item,
  .confirmation-history-item {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .confirmation-head-meta,
  .confirmation-actions {
    justify-content: flex-start;
  }
}
