:root {
  color-scheme: dark;
  --bg: #080b14;
  --panel: #111624;
  --line: #1f232e;
  --muted: #8791a8;
  --text: #f2f5fb;
  --violet: #9478ff;
  --cyan: #53d5da;
  --danger: #ff8b9b;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  pointer-events: none;
  width: 42rem;
  height: 42rem;
  filter: blur(110px);
  opacity: 0.22;
  border-radius: 50%;
  z-index: -1;
}

.ambient-one {
  background: #5737ce;
  top: -22rem;
  left: -15rem;
}

.ambient-two {
  background: #097b94;
  bottom: -23rem;
  right: -20rem;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 1.35fr) minmax(280px, 0.65fr);
  width: 100%;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  justify-self: center;
  width: min(100%, 800px);
  padding: 56px clamp(32px, 8vw, 112px);
}

.brand-mark {
  width: 37px;
  height: 37px;
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  padding: 7px;
  border: 1px solid #7561cf;
  background: #171334;
  transform: skewY(-4deg);
}

.brand-mark span {
  width: 6px;
  background: linear-gradient(#bbaaff, #5e49db);
}

.brand-mark span:nth-child(1) {
  height: 11px;
}

.brand-mark span:nth-child(2) {
  height: 20px;
}

.brand-mark span:nth-child(3) {
  height: 15px;
}

.eyebrow {
  margin: 28px 0 11px;
  letter-spacing: 0.18em;
  color: #9e90e8;
  font-size: 11px;
  font-weight: 700;
}

.login-panel h1 {
  margin: 0;
  font-size: clamp(38px, 4.1vw, 61px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.intro {
  max-width: 390px;
  margin: 22px 0 37px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: #bcc4d5;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.password-field {
  display: flex;
  background: #0e1320;
  border: 1px solid var(--line);
  transition: 0.2s;
}

.password-field:focus-within {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px #9279ff21;
}

.password-field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  padding: 14px 15px;
  color: var(--text);
  background: transparent;
}

.icon-button {
  border: 0;
  background: transparent;
  color: #8390aa;
  padding: 0 14px;
}

.primary-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  margin-top: 10px;
  padding: 14px 17px;
  color: #0c0a18;
  background: linear-gradient(100deg, #a892ff, #69d5e0);
  font-weight: 800;
  transition:
    transform 0.2s,
    filter 0.2s;
}

a.primary-button {
  text-decoration: none;
}

.primary-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.primary-button b {
  font-size: 20px;
}

.form-error {
  margin: 1px 0;
  color: var(--danger);
  font-size: 13px;
}

.security-note {
  margin: 32px 0 0;
  color: #6f7990;
  font-size: 12px;
  line-height: 1.55;
}

.security-note span {
  color: var(--cyan);
  margin-right: 5px;
}

.login-aside {
  position: relative;
  overflow: hidden;
  border-left: 1px solid #22293c;
  min-height: 100%;
  background:
    radial-gradient(circle at 72% 28%, #273661 0, transparent 25%),
    linear-gradient(145deg, #12192d, #0a0e18 68%);
}

.grid-art {
  position: absolute;
  inset: -15%;
  opacity: 0.45;
  background-image:
    linear-gradient(#626eaa3b 1px, transparent 1px),
    linear-gradient(90deg, #626eaa3b 1px, transparent 1px);
  background-size: 52px 52px;
  transform: perspective(420px) rotateX(56deg) translateY(-100px) scale(1.5);
  transform-origin: top;
}

.aside-copy {
  position: absolute;
  top: 40%;
  left: 50%;
  width: min(100% - 64px, 360px);
  transform: translate(-50%, -50%);
  text-align: center;
}

.aside-copy p {
  color: var(--cyan);
  letter-spacing: 0.16em;
  font-size: 10px;
  font-weight: 800;
}

.aside-copy strong {
  display: block;
  margin: 18px 0;
  font-size: clamp(33px, 3.2vw, 52px);
  line-height: 1;
  letter-spacing: -0.055em;
}

.aside-copy span {
  display: block;
  max-width: 290px;
  margin: auto;
  color: #939db3;
  font-size: 14px;
  line-height: 1.55;
}

.aside-pulse {
  position: absolute;
  bottom: 30%;
  left: 50%;
  display: flex;
  align-items: end;
  gap: 11px;
  height: 112px;
  transform: translateX(-50%);
}

.aside-pulse i {
  width: 20px;
  background: linear-gradient(#59d7d8, #826ae6);
  box-shadow: 0 0 20px #58d5da70;
}

.aside-pulse i:nth-child(1) {
  height: 24px;
}

.aside-pulse i:nth-child(2) {
  height: 53px;
}

.aside-pulse i:nth-child(3) {
  height: 93px;
}

.aside-pulse i:nth-child(4) {
  height: 62px;
}

.aside-pulse i:nth-child(5) {
  height: 36px;
}

.admin-view {
  --tab-gradient-primary: #302263;
  --tab-gradient-middle: #171735;
  --tab-gradient-accent: #123343;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 58rem 34rem at -8% 5%, var(--tab-gradient-primary) 0%, var(--tab-gradient-middle) 42%, transparent 73%),
    radial-gradient(ellipse 42rem 30rem at 105% 34%, var(--tab-gradient-accent) 0%, transparent 70%),
    var(--bg);
}

.admin-view[data-active-tab="submissions"] {
  --tab-gradient-primary: #143954;
  --tab-gradient-middle: #10243a;
  --tab-gradient-accent: #1e315c;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
  padding: 0 clamp(24px, 5vw, 76px);
  border-bottom: 1px solid #20283a;
  background: #090d17c9;
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #eef0fa;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.wordmark>span:last-child {
  color: #8f9ab0;
}

.brand-mark.small {
  width: 23px;
  height: 23px;
  gap: 2px;
  padding: 4px;
  transform: none;
}

.brand-mark.small span {
  width: 4px;
}

.brand-mark.small span:nth-child(1) {
  height: 7px;
}

.brand-mark.small span:nth-child(2) {
  height: 13px;
}

.brand-mark.small span:nth-child(3) {
  height: 10px;
}

.topbar-actions {
  display: flex;
  gap: 9px;
  align-items: center;
}

.sync-status {
  color: #73809a;
  margin-right: 8px;
  font-size: 12px;
}

.ghost-button {
  padding: 8px 11px;
  border: 1px solid #2b3449;
  color: #b8c1d1;
  background: #121826;
  font-size: 12px;
  font-weight: 700;
}

.ghost-button:hover {
  border-color: #66728b;
  color: #fff;
}

.dashboard-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 0 64px;
}

.dashboard-heading {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: flex-end;
}

.dashboard-heading .eyebrow {
  margin: 0 0 12px;
}

.dashboard-heading h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.052em;
}

.dashboard-heading h1 span {
  color: var(--violet);
}

.summary {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #101622;
}

.summary div {
  min-width: 98px;
  padding: 12px 17px;
  border-left: 1px solid var(--line);
}

.summary div:first-child {
  border-left: 0;
}

.summary b,
.summary span {
  display: block;
}

.summary b {
  font-size: 21px;
}

.summary span {
  color: #7f8ba2;
  margin-top: 2px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  margin: 43px 0 16px;
}

.search-field {
  display: flex;
  align-items: center;
  width: min(300px, 100%);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #0f1421;
  color: #738098;
}

.search-field > span {
  font-size: 2rem;
  line-height: 1;
}

.search-field input {
  width: 100%;
  padding: 10px 8px;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
}

.list-status {
  color: #7d899f;
  font-size: 12px;
}

.teams-list {
  display: grid;
  gap: 12px;
}

.team-card {
  overflow: hidden;
  border: 1px solid #4c5b7a;
  background: linear-gradient(115deg, #121827, #101522);
  border-radius: 1rem;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.team-card:hover {
  border-color: #273147;
  box-shadow: 0 12px 30px #05081066;
}

.team-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 19px 21px;
}

.team-name-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.team-name {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.token-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 7px;
  color: #8d99af;
  font-size: 12px;
}

.token-meta strong {
  color: #c1c9d8;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid #325a51;
  color: #80dcb0;
  background: #10251f;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.badge:before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge.revoked {
  color: #fd98a6;
  border-color: #6c3846;
  background: #2a151d;
}

.badge.expired {
  color: #e6af6a;
  border-color: #694e2c;
  background: #281e13;
}

.regenerate-button {
  border: 1px solid #574993;
  color: #b8aaff;
  background: #1a1732;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
}

.regenerate-button:hover {
  background: #262044;
}

.records {
  border-top: 1px solid #263046;
}

.record {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr 0.9fr 0.8fr;
  align-items: center;
  gap: 15px;
  padding: 13px 21px;
  border-top: 1px solid #222b3e;
  color: #a9b3c5;
  font-size: 12px;
}

.record:first-child {
  border-top: 0;
}

.record-label {
  display: none;
  color: #707c94;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.record-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record time {
  color: #c2cad8;
}

.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 64px 24px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #344057;
  border-top-color: #6b8cff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  padding: 64px 24px;
  border: 1px dashed #344057;
  text-align: center;
  color: #8e9ab0;
}

.empty-state strong {
  display: block;
  color: #e3e7ef;
  margin-bottom: 7px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 10;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: #03050bd1;
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(100%, 500px);
  padding: 28px;
  border: 1px solid #35415c;
  border-radius: 1rem;
  background: #121827;
  box-shadow: 0 24px 100px #000a;
}

.modal-card h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.modal-card p {
  color: #a3aec1;
  font-size: 14px;
  line-height: 1.6;
}

.warning {
  padding: 12px 14px;
  border-left: 3px solid #e7ac63;
  background: #2a2117;
  color: #e9c38d !important;
}

.warning strong {
  color: #dbd1c4;
}

.confirm-input {
  width: 100%;
  padding: 11px;
  border: 1px solid #374259;
  outline: 0;
  color: #fff;
  background: #0b101c;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
}

.danger-button {
  border: 0;
  padding: 10px 13px;
  color: #201008;
  background: #f4a66b;
  font-size: 12px;
  font-weight: 800;
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 12px;
  font-size: 22px;
}

.token-output {
  display: flex;
  gap: 8px;
  align-items: stretch;
  padding: 11px;
  border: 1px solid #32415a;
  background: #090e18;
}

.token-output code {
  display: block;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #a9eff1;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  padding: 12px 15px;
  border: 1px solid #356a5b;
  color: #aff0d0;
  background: #10251f;
  box-shadow: 0 12px 40px #0009;
  font-size: 13px;
  z-index: 11;
}

@media (max-width: 760px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-aside {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    margin: auto;
  }

  .topbar {
    padding: 0 20px;
  }

  .sync-status {
    display: none;
  }

  .dashboard-shell {
    width: min(100% - 32px, 1200px);
    padding-top: 42px;
  }

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

  .toolbar {
    margin-top: 30px;
  }

  .team-card-header {
    padding: 17px;
    grid-template-columns: 1fr;
  }

  .regenerate-button {
    width: 100%;
  }

  .record {
    grid-template-columns: 1fr 1fr;
    padding: 12px 17px;
    gap: 9px 16px;
  }

  .record-label {
    display: block;
  }

  .record-value {
    white-space: normal;
  }

  .record>div:nth-child(3),
  .record>div:nth-child(4) {
    margin-top: 4px;
  }

  .summary {
    width: 100%;
  }

  .summary div {
    flex: 1;
  }

  .topbar-actions {
    gap: 5px;
  }

  .ghost-button {
    padding: 7px;
  }

  .wordmark {
    font-size: 11px;
  }
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.create-team-button {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 9px 12px;
  color: #0c0a18;
  background: linear-gradient(100deg, #a892ff, #69d5e0);
  font-size: 12px;
  font-weight: 800;
}

.create-team-button:hover {
  filter: brightness(1.08);
}

.modal-field {
  display: block;
  margin: 18px 0 7px;
  color: #bcc4d5;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.credential-json {
  overflow: auto;
  margin: 18px 0;
  padding: 13px;
  border: 1px solid #32415a;
  color: #a9eff1;
  background: #090e18;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-status {
  min-height: 1.5em;
  color: #8b9aae !important;
  font-size: 12px !important;
}

.admin-tabs {
  display: flex;
  gap: 24px;
  padding: 0 clamp(24px, 5vw, 76px);
  border-bottom: 1px solid #20283a;
  background: #090d17b8;
  backdrop-filter: blur(16px);
  position: sticky;
  top: 70px;
  z-index: 4;
}

.admin-tab {
  position: relative;
  padding: 15px 1px 13px;
  border: 0;
  color: #7f8ba2;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.admin-tab:hover { color: #d9dfec; }
.admin-tab.active { color: #c2b6ff; }
.admin-tab.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent 0%, #a892ff55 12%, #a892ff 30%, #69d5e0 70%, #69d5e055 88%, transparent 100%);
}

.submission-table-wrap {
  overflow-x: auto;
  border: 1px solid #273147;
  border-radius: 0.5rem;
  background: #101522;
}

.column-selector { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)); gap: 8px 16px; margin: -8px 0 12px; padding: 12px 15px; border: 1px solid #2d3850; border-radius: .5rem; background: #101725; }
.column-selector-heading { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; color: #8290a8; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.column-selector-heading button { border: 0; padding: 0; color: #b8aaff; background: transparent; font-size: 11px; font-weight: 800; }
.column-selector label { display: flex; align-items: center; gap: 7px; color: #c0c9d8; font-size: 12px; cursor: pointer; }
.column-selector input { accent-color: #9279ff; }

.submission-filters {
  display: grid;
  grid-template-columns: minmax(235px, 1.3fr) auto minmax(300px, 1fr) minmax(300px, 1fr) auto;
  gap: 10px 14px;
  align-items: end;
  margin: 26px 0 12px;
  padding: 11px 13px;
  border: 1px solid #283249;
  border-radius: 0.5rem;
  background: #0d1320;
}
.submission-search-field { width: 100%; }
.submission-filters .search-field {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 12px;
}
.submission-filters .search-field input {
  min-width: 0;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  background: transparent;
}
.column-selector-button { height: 34px; white-space: nowrap; }
.submission-filters fieldset { display: flex; gap: 7px; margin: 0; padding: 0; border: 0; }
.submission-filters legend { margin-bottom: 5px; color: #78849b; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.submission-filters label { display: grid; gap: 5px; color: #919cb0; font-size: 11px; }
.submission-filters input { min-width: 142px; padding: 7px 8px; border: 1px solid #303b54; color: #dbe3f0; background: #090e18; font-size: 12px; }
.filter-actions { display: flex; gap: 8px; }
.submission-pagination-status { color: #7d899f; font-size: 12px; }

.submission-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  font-size: 12px;
}

.submission-table th {
  padding: 10px 14px;
  color: #67748c;
  border-bottom: 1px solid #273147;
  background: #0d1220;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.submission-table td {
  max-width: 210px;
  padding: 12px 14px;
  border-top: 1px solid #20293b;
  color: #b1bbcd;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.submission-table tbody tr:first-child td { border-top: 0; }
.submission-table tbody tr:hover { background: #151d2c; }
.submission-table time { color: #d1d9e5; white-space: nowrap; }
.quantity-cell { color: #9de3d3 !important; white-space: nowrap; }
.raw-button { border: 1px solid #484176; padding: 6px 8px; color: #b8aaff; background: #15152b; font-size: 11px; font-weight: 800; white-space: nowrap; }
.raw-button:hover { border-color: #776cb0; background: #20203e; }
.raw-submission-json {
  max-height: min(55vh, 520px);
  overflow: auto;
  margin: 18px 0;
  padding: 13px;
  border: 1px solid #32415a;
  color: #a9eff1;
  background: #090e18;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-top: 14px; }
.pagination-top { margin-top: 0; margin-bottom: 14px; }
.pagination-separator { margin-inline: -4px; padding: 0rem 0.5rem; color: var(--cyan); }
.pagination .ghost-button:disabled { cursor: not-allowed; opacity: .45; }
.pagination-actions { display: flex; gap: 8px; }
.page-jump { display: flex; align-items: center; gap: 6px; color: #8995aa; font-size: 12px; white-space: nowrap; }
.page-jump input { width: 54px; padding: 7px 5px; border: 1px solid #2b3449; color: #dbe3f0; background: #121826; font-size: 12px; text-align: center; }

.team-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.revoke-button {
  border: 1px solid #653846;
  padding: 8px 11px;
  color: #f2a1ac;
  background: #28151d;
  font-size: 12px;
  font-weight: 800;
}

.revoke-button:hover {
  border-color: #a55565;
  background: #371a25;
}

.revoke-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.record-header {
  padding-top: 8px;
  padding-bottom: 8px;
  color: #5f574b;
  background: #0d1220;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .team-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .record-header {
    display: none;
  }
}

@media (max-width: 760px) {
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .admin-tabs { padding: 0 20px; }
  .submission-filters { grid-template-columns: 1fr auto; align-items: stretch; }
  .submission-filters fieldset { grid-column: 1 / -1; flex-wrap: wrap; }
  .submission-filters fieldset label { flex: 1 1 140px; }
  .submission-filters input { min-width: 0; width: 100%; }
  .column-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pagination { gap: 12px; }
}
