:root {
  color-scheme: light;
  --bg: #eef7ff;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(59, 130, 246, 0.18);
  --line-strong: rgba(14, 165, 233, 0.42);
  --text: #102033;
  --muted: #5d7288;
  --dim: #8aa0b5;
  --cyan: #16c7f2;
  --blue: #2563eb;
  --green: #28d799;
  --red: #e54862;
  --amber: #f59e0b;
  --shadow: 0 24px 70px rgba(37, 99, 235, 0.16);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(37, 99, 235, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 15% 10%, rgba(22, 199, 242, 0.28), transparent 32rem),
    radial-gradient(circle at 92% 4%, rgba(40, 215, 153, 0.22), transparent 28rem),
    linear-gradient(135deg, #f9fdff 0%, #eef7ff 48%, #e8f5ff 100%);
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.aurora {
  position: fixed;
  inset: auto 4% -10% auto;
  width: 46vw;
  height: 46vw;
  pointer-events: none;
  background: radial-gradient(circle, rgba(22, 199, 242, 0.18), transparent 62%);
  filter: blur(16px);
}

.login-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(34, 197, 94, 0.18), transparent 34rem),
    linear-gradient(180deg, #020617 0%, #03140d 52%, #020617 100%);
}

.login-shell::before {
  content: "010101  root  access  101100  data  010010  CARD  STREAM  110011  import  001101  auth  101010  query  011001";
  position: absolute;
  inset: -30% 0;
  z-index: -2;
  color: rgba(47, 255, 140, 0.26);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 18px;
  line-height: 1.8;
  word-spacing: 24px;
  letter-spacing: 3px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.5));
  animation: codeRain 11s linear infinite;
}

.login-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(120deg, transparent 0 35%, rgba(34, 197, 94, 0.12), transparent 62%),
    repeating-linear-gradient(90deg, rgba(34, 197, 94, 0.06) 0 1px, transparent 1px 84px);
  animation: loginSweep 4.8s linear infinite;
}

.login-card {
  position: relative;
  width: min(440px, 100%);
  padding: 34px;
  overflow: hidden;
}

.login-card.glass {
  color: #eafff2;
  border: 1px solid rgba(74, 222, 128, 0.46);
  background: rgba(2, 14, 10, 0.58);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.46), 0 0 38px rgba(34, 197, 94, 0.18);
  backdrop-filter: blur(22px) saturate(150%);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: inherit;
  background: conic-gradient(from var(--scan-angle, 0deg), transparent 0 28%, #20f26f 36%, #22d3ee 44%, transparent 54% 100%);
  animation: borderScan 3.2s linear infinite;
}

.login-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 9px;
  background: rgba(2, 14, 10, 0.78);
}

.login-card .page-subtitle,
.login-card .field label {
  color: rgba(220, 252, 231, 0.74);
}

.login-card input {
  color: #eafff2;
  border-color: rgba(74, 222, 128, 0.34);
  background: rgba(1, 22, 14, 0.76);
}

.login-card input::placeholder {
  color: rgba(220, 252, 231, 0.42);
}

@keyframes codeRain {
  from { transform: translateY(-12%); }
  to { transform: translateY(12%); }
}

@keyframes loginSweep {
  from { background-position: -120vw 0, 0 0; }
  to { background-position: 120vw 0, 84px 0; }
}

@keyframes borderScan {
  to { --scan-angle: 360deg; }
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(24px);
  box-shadow: 18px 0 50px rgba(37, 99, 235, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
  padding: 10px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--blue), var(--green));
  box-shadow: 0 12px 32px rgba(22, 199, 242, 0.42);
}

.brand-title {
  font-weight: 900;
  letter-spacing: 0;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
}

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

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  padding: 0 12px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  color: #0f4fc7;
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65), 0 12px 28px rgba(37, 99, 235, 0.12);
}

.content {
  min-width: 0;
  padding: 24px;
}

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

.result-toolbar {
  margin-bottom: 12px;
}

.page-title {
  margin: 0;
  font-size: 26px;
}

.page-subtitle {
  margin-top: 6px;
  color: var(--muted);
}

.glass {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 18px;
}

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

.stats-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

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

.stat {
  padding: 18px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255,255,255,0.92), rgba(234,248,255,0.72));
}

.stat::after {
  content: "";
  position: absolute;
  inset: auto -30px -46px auto;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: rgba(22, 199, 242, 0.17);
  filter: blur(4px);
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 900;
  color: #0f4fc7;
}

.liquid {
  border: 0;
  border-radius: 9px;
  color: white;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.7), transparent 22%),
    linear-gradient(135deg, var(--cyan), var(--blue) 55%, var(--green));
  min-height: 40px;
  padding: 0 16px;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.24);
}

.ghost {
  min-height: 40px;
  border-radius: 9px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,0.72);
  padding: 0 14px;
}

.danger {
  border-color: rgba(229, 72, 98, 0.48);
  color: var(--red);
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label,
.tool-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 9px;
  background: rgba(255,255,255,0.86);
  outline: 0;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(22, 199, 242, 0.14);
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 190px;
  padding: 12px;
  resize: vertical;
}

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

.compact-actions {
  margin-top: 0;
}

.inline-field {
  display: inline-flex;
  align-items: center;
}

.move-country-field {
  min-width: 170px;
}

.query-panel {
  display: grid;
  gap: 16px;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.account-list-panel,
.account-detail-panel {
  min-height: 560px;
}

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

.account-item {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 78px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255,255,255,0.72);
}

.account-item.active,
.account-item:hover {
  border-color: var(--line-strong);
  background: rgba(232, 248, 255, 0.96);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.12);
}

.account-name {
  font-weight: 900;
}

.account-meta,
.account-time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.account-editor {
  display: grid;
  gap: 18px;
}

.account-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.detail-box {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.62);
}

.password-edit-field {
  max-width: 360px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.search-field input {
  height: 44px;
}

.column-tools {
  display: grid;
  gap: 10px;
}

.head-filter-row,
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.head-filter {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: rgba(255,255,255,0.72);
}

.head-filter.active,
.head-filter:hover {
  color: #0f4fc7;
  border-color: var(--line-strong);
  background: rgba(232, 248, 255, 0.95);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
}

.pagination {
  justify-content: flex-end;
  margin-top: 14px;
}

.page-size-field {
  grid-template-columns: auto 88px;
  align-items: center;
}

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

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  color: var(--text);
  font-size: 13px;
}

.check-pill input,
.row-check,
#selectAllRows,
.import-row-check,
#selectAllImportRows {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.table-wrap {
  overflow: auto;
  max-height: 62vh;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.58);
}

.import-wrap {
  max-height: 68vh;
}

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

.mapping-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.mapping-table th,
.mapping-table td {
  min-width: 172px;
  max-width: 260px;
}

.mapping-table .select-col {
  min-width: 34px;
  max-width: 34px;
}

.mapping-table .warning-col {
  min-width: 92px;
  max-width: 92px;
}

.mapping {
  min-width: 150px;
  height: 40px;
}

th,
td {
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #36516d;
  background: rgba(239, 249, 255, 0.96);
}

.select-col {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}

.action-col {
  width: 128px;
  min-width: 128px;
  white-space: nowrap;
}

td.action-col {
  display: flex;
  gap: 6px;
  align-items: center;
}

.mini {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

.edit-cell input {
  min-width: 140px;
  height: 32px;
  padding: 0 9px;
}

.editing-row td {
  background: rgba(232, 248, 255, 0.9);
}

.warning-col {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

tr.preview-garbage td {
  background: rgba(229, 72, 98, 0.14);
}

tr.preview-garbage .warning-col {
  color: var(--red);
}

tr.preview-missing td {
  background: rgba(245, 158, 11, 0.16);
}

tr.preview-missing .warning-col {
  color: var(--amber);
}

tr.tested-live-row td {
  color: #087a42;
  background: rgba(40, 215, 153, 0.1);
}

.tested-note-col {
  min-width: 150px;
}

.tested-note-input {
  height: 32px;
  min-width: 130px;
}

td.copy-cell {
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: copy;
}

td.copy-cell:hover {
  color: #0f4fc7;
  background: rgba(22, 199, 242, 0.1);
}

.section-title {
  margin: 0 0 14px;
  font-size: 17px;
}

.result-toolbar .section-title {
  margin-bottom: 4px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255,255,255,0.7);
}

.country-preset-form {
  grid-template-columns: minmax(220px, 1fr) auto;
  margin-bottom: 14px;
}

.country-preset-list {
  margin-top: 10px;
}

.country-preset-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-delete {
  min-height: 24px;
  border: 0;
  border-radius: 999px;
  padding: 0 8px;
  color: var(--red);
  background: rgba(229, 72, 98, 0.1);
}

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

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 54px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--blue), var(--green));
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  transition: 160ms ease;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 35, 60, 0.2);
  backdrop-filter: blur(8px);
}

.modal {
  width: min(760px, 100%);
  padding: 20px;
  background: rgba(255, 255, 255, 0.92);
}

.export-grid {
  padding: 4px 0 8px;
}

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

.empty {
  color: var(--dim);
  padding: 24px;
  text-align: center;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-grid,
  .two-col,
  .form-grid,
  .search-row,
  .account-layout,
  .account-detail-grid {
    grid-template-columns: 1fr;
  }
}
