:root {
  color-scheme: light;
  --bg: #f2f5f1;
  --bg-strong: #0e1b16;
  --panel: #ffffff;
  --panel-soft: #f8faf7;
  --text: #14201b;
  --muted: #5c6a63;
  --border: #d7ded4;
  --accent: #0f8a4b;
  --accent-dark: #0a6639;
  --accent-blue: #1769e0;
  --track: #d43f2f;
  --gold: #f4b23a;
  --success: #0f7a43;
  --error: #b42318;
  --secondary: #e9eee7;
  --shadow: 0 18px 42px rgba(14, 27, 22, 0.12);
  --shadow-soft: 0 10px 24px rgba(14, 27, 22, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-width: 320px;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(15, 138, 75, 0.1) 0 18%, transparent 18% 100%),
    linear-gradient(180deg, #f7faf5 0%, var(--bg) 44%, #eef3ef 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(15, 138, 75, 0.055) 0,
      rgba(15, 138, 75, 0.055) 1px,
      transparent 1px,
      transparent 72px
    ),
    linear-gradient(115deg, transparent 0 68%, rgba(212, 63, 47, 0.08) 68% 70%, transparent 70% 100%);
}

body.landing-page {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(14, 27, 22, 0.92), rgba(14, 27, 22, 0.72)),
    linear-gradient(135deg, #0f8a4b 0 34%, #1769e0 34% 68%, #d43f2f 68% 100%);
}

.app-shell,
.landing-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 28px;
}

.landing-shell {
  place-items: center;
}

.landing-card {
  width: min(760px, 100%);
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  padding: 34px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.landing-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--track), var(--accent-blue));
}

.landing-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 13px 18px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(15, 138, 75, 0.24);
}

.landing-button:hover {
  background: var(--accent-dark);
}

.panel {
  width: min(1180px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(215, 222, 212, 0.92);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(520px, 100%);
  display: grid;
  gap: 18px;
}

.hidden {
  display: none !important;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  color: var(--text);
  letter-spacing: 0;
}

h1 {
  margin: 10px 0 12px;
  font-size: 2rem;
  line-height: 1.15;
}

h2 {
  margin: 8px 0 8px;
  font-size: 1.35rem;
  line-height: 1.22;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

.lead,
.helper-text,
.admin-intro {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.lead {
  margin-bottom: 24px;
}

.stack-form,
.form {
  display: grid;
  gap: 14px;
}

.stack-form label,
.form label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.auth-actions,
.dialog-actions,
.admin-action-row,
.landing-actions,
.user-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-actions {
  justify-content: space-between;
}

.dialog-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.user-actions {
  justify-content: flex-end;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.link-button:hover {
  background: transparent;
  color: var(--track);
  text-decoration: underline;
}

.reset-box {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.row {
  display: flex;
  gap: 10px;
}

input {
  min-width: 0;
  width: 100%;
  min-height: 48px;
  padding: 13px 15px;
  border: 1px solid #cbd5c8;
  border-radius: var(--radius);
  font: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 138, 75, 0.14);
}

input[readonly] {
  color: var(--muted);
  background: #f1f5ef;
}

button,
.file-action {
  min-height: 46px;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 17px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

button:hover,
.file-action:hover {
  background: var(--accent-dark);
  box-shadow: 0 10px 22px rgba(15, 138, 75, 0.2);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

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

button.secondary:hover {
  background: #dde7da;
  box-shadow: 0 8px 18px rgba(14, 27, 22, 0.1);
}

.compact-button {
  width: fit-content;
  min-height: 40px;
  padding: 9px 12px;
}

.file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-action input {
  display: none;
}

.status {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #dfe7dc;
  border-radius: var(--radius);
  background: #f7faf5;
  color: var(--muted);
  line-height: 1.45;
}

.status.ok {
  color: var(--success);
  border-color: #c5e6d2;
  background: #eefaf2;
}

.status.error {
  color: var(--error);
  border-color: #f2c7c2;
  background: #fff2f0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.session-box {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.session-role {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e8f7ee;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.session-email {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-section,
.user-nft-section {
  margin: 18px 0 26px;
}

.admin-section {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #f6faf4 100%);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.user-nft-filters,
.profile-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.nft-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.nft-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.nft-card:hover {
  background: #fbfdf9;
  border-color: rgba(15, 138, 75, 0.38);
}

.nft-card-image,
.nft-detail-hero {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(15, 138, 75, 0.1), rgba(23, 105, 224, 0.08)),
    #edf4ef;
}

.nft-card-image {
  aspect-ratio: 1;
}

.nft-detail-hero {
  aspect-ratio: 16 / 10;
}

.nft-card-image img,
.nft-detail-hero img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.nft-image-placeholder,
.nft-detail-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
}

.nft-card-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.nft-card-name {
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.nft-card-code,
.nft-card-meta {
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.empty-nft-state {
  grid-column: 1 / -1;
  padding: 30px 16px;
  border: 1px dashed #b8c8b4;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: #fbfdf9;
}

.nft-detail-page,
.nft-detail-stack,
.nft-detail-section {
  display: grid;
  gap: 14px;
}

.nft-detail-stack {
  gap: 18px;
}

.nft-detail-stack h2 {
  margin-bottom: 0;
}

.nft-detail-list,
.nft-property-grid,
.detail-grid,
.result-grid {
  margin: 0;
  display: grid;
  gap: 12px;
}

.nft-detail-list,
.nft-property-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-grid {
  margin-bottom: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-grid {
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.token-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.nft-detail-list div,
.nft-property-grid div,
.detail-grid div,
.result {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfdf9;
}

.nft-detail-list dt,
.nft-property-grid dt,
.detail-grid dt,
.result span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nft-detail-list dd,
.nft-property-grid dd,
.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.result strong {
  font-size: 1.08rem;
  word-break: break-word;
}

.admin-menu {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-menu-item {
  display: grid;
  gap: 8px;
  align-items: start;
  min-height: 128px;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.admin-menu-item:hover {
  background: #fbfdf9;
  border-color: rgba(15, 138, 75, 0.4);
}

.admin-menu-item.active {
  background: #edf9f1;
  border-color: rgba(15, 138, 75, 0.5);
  box-shadow: inset 0 4px 0 var(--accent), var(--shadow-soft);
}

.admin-menu-label {
  font-weight: 900;
  color: var(--accent-dark);
}

.admin-menu-text {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
  font-weight: 600;
}

.admin-panel,
.selected-nft-actions,
.detail-box,
.create-account-form,
.create-token-form {
  margin-top: 18px;
}

.admin-summary {
  margin-top: 14px;
}

.balance-section {
  margin-top: 8px;
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.accounts-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.accounts-table th,
.accounts-table td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.accounts-table th {
  background: #f1f6ef;
  color: #45534a;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.accounts-table td {
  word-break: break-word;
}

.accounts-table .meta-row td {
  background: #fbfdf9;
  color: var(--muted);
  font-size: 0.92rem;
}

.accounts-table .empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 24px 14px;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-weight: 700 !important;
  color: var(--text);
}

.check-row input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
}

.profile-dialog,
.reset-dialog,
.preview-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 24px 80px rgba(14, 27, 22, 0.32);
}

.profile-dialog {
  width: min(720px, calc(100% - 24px));
}

.reset-dialog {
  width: min(560px, calc(100% - 24px));
  background: transparent;
}

.preview-dialog {
  width: min(1180px, calc(100% - 24px));
  max-height: calc(100vh - 32px);
}

.profile-dialog::backdrop,
.reset-dialog::backdrop,
.preview-dialog::backdrop {
  background: rgba(14, 27, 22, 0.58);
  backdrop-filter: blur(3px);
}

.profile-form,
.reset-dialog .stack-form,
.preview-content {
  padding: 22px;
  background: #fff;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.dialog-close {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  line-height: 1;
  font-size: 1.5rem;
  background: var(--secondary);
  color: var(--text);
}

.dialog-close:hover {
  background: #dce7d8;
}

.preview-table-wrap {
  max-height: 56vh;
}

.preview-table {
  min-width: 1500px;
}

@media (max-width: 1024px) {
  .app-shell,
  .landing-shell {
    padding: 22px;
  }

  .panel {
    padding: 24px;
  }

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

  .nft-grid,
  .result-grid,
  .nft-detail-list,
  .nft-property-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .app-shell,
  .landing-shell {
    padding: 14px;
  }

  .panel,
  .landing-card {
    padding: 20px;
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.18rem;
  }

  .topbar,
  .section-heading,
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .session-box,
  .auth-actions,
  .dialog-actions,
  .admin-action-row,
  .user-actions {
    justify-content: flex-start;
  }

  .session-email {
    max-width: 100%;
  }

  .row button,
  .auth-actions button,
  .dialog-actions button,
  .user-actions button,
  .admin-action-row button,
  .file-action,
  .landing-button {
    width: 100%;
  }

  .admin-section {
    padding: 14px;
  }

  .admin-menu,
  .profile-grid,
  .user-nft-filters,
  .nft-grid,
  .nft-detail-list,
  .nft-property-grid,
  .token-summary,
  .detail-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .admin-menu-item {
    min-height: auto;
  }

  .profile-form,
  .reset-dialog .stack-form,
  .preview-content {
    padding: 18px;
  }
}

@media (max-width: 420px) {
  .app-shell,
  .landing-shell {
    padding: 10px;
  }

  .panel,
  .landing-card {
    padding: 16px;
  }

  input,
  button,
  .file-action {
    min-height: 44px;
  }

  .accounts-table th,
  .accounts-table td {
    padding: 11px 12px;
  }
}
