:root {
  --bg: #f4f1e8;
  --ink: #1d2430;
  --muted: #4f5b69;
  --card: rgba(255, 255, 255, 0.72);
  --line: rgba(17, 28, 45, 0.12);
  --primary: #005f73;
  --primary-2: #0a9396;
  --accent: #ee9b00;
  --danger: #bb3e03;
  --shadow: 0 18px 40px rgba(11, 38, 63, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 10%, #f7f0d8 0, transparent 34%),
    radial-gradient(circle at 85% 20%, #dbeee8 0, transparent 38%),
    var(--bg);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(0, 95, 115, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 95, 115, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}

.bg-orb {
  position: fixed;
  filter: blur(40px);
  opacity: 0.4;
  pointer-events: none;
}

.orb-a {
  width: 320px;
  height: 320px;
  left: -70px;
  top: -100px;
  background: #ee9b00;
}

.orb-b {
  width: 420px;
  height: 420px;
  right: -120px;
  bottom: -120px;
  background: #0a9396;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.glass {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

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

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #ca6702);
  box-shadow: 0 0 0 6px rgba(238, 155, 0, 0.2);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

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

.lang-switch-inline {
  display: grid;
  grid-template-columns: auto 120px;
  align-items: center;
  gap: 8px;
  margin: 2px 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.lang-switch-inline select {
  padding: 7px 10px;
  font-size: 12px;
}

.page-lang-switch {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

#nav {
  display: grid;
  gap: 10px;
}

.sidebar-user {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.user-meta {
  display: grid;
  gap: 2px;
  margin-bottom: 10px;
}

.user-meta b {
  font-size: 13px;
}

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

.nav-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  color: var(--ink);
  text-align: left;
  font-weight: 600;
  padding: 11px 14px;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(120deg, var(--primary), var(--primary-2));
  transform: translateY(-1px);
}

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

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.login-only {
  width: min(1100px, 100%);
}

.view {
  display: none;
  animation: rise 0.45s ease;
}

.view.active {
  display: block;
}

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

h2 {
  margin: 0;
  font-size: 28px;
}

h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

p {
  color: var(--muted);
}

.card,
.hero-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 18px;
}

.badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--primary);
  border: 1px solid rgba(0, 95, 115, 0.22);
  background: rgba(0, 95, 115, 0.08);
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.login-grid,
.detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: block;
  margin: 8px 0 4px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 11px;
  font: inherit;
  color: var(--ink);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid rgba(10, 147, 150, 0.7);
  outline-offset: 2px;
}

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

.btn {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-top-color: #fff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: spin 0.8s linear infinite;
}

.btn.primary {
  color: #fff;
  background: linear-gradient(130deg, var(--primary), var(--primary-2));
}

.btn.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
}

.btn.oauth {
  width: 100%;
  margin-bottom: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.btn.oauth.microsoft {
  background: #f7fbff;
}

.btn.oauth.loading::after {
  border-color: rgba(29, 36, 48, 0.25);
  border-top-color: var(--ink);
}

.btn.small {
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.sidebar-user .btn.small:not(.ghost) {
  color: #fff;
  border: 0;
  background: linear-gradient(130deg, var(--primary), var(--primary-2));
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.subtle {
  color: var(--muted);
  margin-top: 10px;
  font-size: 12px;
}

#register-toggle-btn {
  width: 100%;
  margin-top: 8px;
}

.error-text {
  min-height: 18px;
  margin-top: 8px;
  color: var(--danger);
  font-size: 12px;
}

.tips {
  margin: 8px 0 0 15px;
  color: var(--muted);
  font-size: 13px;
}

.dropzone {
  border: 1px dashed #7da4ac;
  border-radius: 12px;
  padding: 18px;
  margin: 8px 0 12px;
  color: #3e5564;
  background: rgba(10, 147, 150, 0.08);
}

.dropzone.uploading {
  border-color: #0a9396;
  background: rgba(10, 147, 150, 0.14);
}

.dropzone.uploaded {
  border-color: #2a9d8f;
  background: rgba(42, 157, 143, 0.12);
}

.dropzone.failed {
  border-color: #bb3e03;
  background: rgba(187, 62, 3, 0.1);
}

.status-text {
  min-height: 18px;
  margin: 2px 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.status-text.ok {
  color: #2a9d8f;
}

.status-text.fail {
  color: var(--danger);
}

.upload-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}

.upload-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.09);
  overflow: hidden;
}

.upload-progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-2), var(--primary));
}

.upload-progress b {
  font-size: 12px;
}

.provider-hint {
  margin: 2px 0 8px;
}

.switch-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 10px;
  position: relative;
}

.switch-line label {
  margin: 0;
}

.switch {
  width: 46px;
  height: 26px;
  border-radius: 16px;
  background: #d0d7de;
  position: relative;
  pointer-events: none;
}

.switch::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  background: #fff;
}

.switch.on {
  background: var(--primary-2);
}

.switch.on::after {
  left: 23px;
}

.switch-input {
  position: absolute;
  right: 0;
  width: 46px;
  height: 26px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.switch-input:focus-visible + .switch {
  outline: 2px solid rgba(10, 147, 150, 0.7);
  outline-offset: 2px;
}

.switch-input:not(:checked) + .switch {
  background: #d0d7de;
}

.switch-input:not(:checked) + .switch::after {
  left: 3px;
}

.progress-wrap {
  display: grid;
  gap: 10px;
}

.progress,
.report-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.09);
  overflow: hidden;
}

.progress span,
.report-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ca6702);
}

.kv {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  font-size: 14px;
}

.kv span {
  color: var(--muted);
}

.wallet-panel {
  margin: 8px 0;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(10, 147, 150, 0.08);
}

.ok {
  color: #2a9d8f;
}

.warn {
  color: #ca6702;
}

.fail {
  color: var(--danger);
}

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

.filters {
  display: grid;
  grid-template-columns: 130px 130px 130px 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.history-account {
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}

.table-scroll {
  overflow-x: auto;
}

.table-scroll table {
  min-width: 760px;
}

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

.amount-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.amount-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.amount-card.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(130deg, var(--primary), var(--primary-2));
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  font-size: 14px;
  text-align: left;
}

th {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.tag {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tag.ok {
  background: rgba(42, 157, 143, 0.18);
}

.tag.warn {
  background: rgba(238, 155, 0, 0.2);
}

.tag.fail {
  background: rgba(187, 62, 3, 0.15);
}

.tag.info {
  background: rgba(0, 95, 115, 0.18);
  color: #0b4f60;
}

.preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preview.preview-stacked {
  grid-template-columns: 1fr;
}

.preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.preview-hint {
  min-height: 18px;
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.preview-hint.error {
  color: var(--danger);
}

.slide {
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  color: var(--muted);
}

.slide.translated {
  background: #f3fcfc;
}

.slide h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink);
}

.preview-list {
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
}

.preview-line {
  padding: 5px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

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

.preview-line.diff {
  background: rgba(238, 155, 0, 0.18);
  border-radius: 6px;
  padding-left: 4px;
  padding-right: 4px;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.modal-card {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 16px;
}

.stagger {
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.45s ease forwards;
}

.stagger:nth-child(2) {
  animation-delay: 0.05s;
}
.stagger:nth-child(3) {
  animation-delay: 0.1s;
}
.stagger:nth-child(4) {
  animation-delay: 0.15s;
}
.stagger:nth-child(5) {
  animation-delay: 0.2s;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    height: auto;
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #nav {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow: auto;
  }
  .panel-grid,
  .model-cards,
  .detail-grid,
  .login-grid,
  .two-col,
  .preview,
  .filters {
    grid-template-columns: 1fr;
  }
}
