/* LocSim App 包管理 — login gate + upload/list console */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

:root {
  --page-bg: #f4f7fb;
  --page-fg: #18181b;
  --muted: #52525b;
  --subtle: #71717a;
  --sky: #0ea5e9;
  --sky-deep: #0369a1;
  --rose: #e5484d;
  --amber: #d97706;
  --surface: rgba(15, 23, 42, 0.03);
  --border: rgba(15, 23, 42, 0.1);
  --header-bg: rgba(255, 255, 255, 0.84);
  --font: "Inter", "Noto Sans SC", sans-serif;
  --radius: 16px;
}

html, body {
  min-height: 100%;
  background: var(--page-bg);
  color: var(--page-fg);
  font-family: var(--font);
}

body { position: relative; overflow-x: hidden; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  z-index: 0;
}

.glow {
  position: fixed;
  width: 42vw;
  height: 42vw;
  right: -8vw;
  top: -12vw;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.16), transparent 68%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand__mark {
  width: 28px;
  height: 28px;
  color: var(--sky);
}

.brand__mark svg { width: 100%; height: 100%; }

.brand__name {
  display: block;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand__sub {
  display: block;
  font-size: 12px;
  color: var(--subtle);
}

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

.topbar__account { text-align: right; }

.topbar__label {
  display: block;
  font-size: 12px;
  color: var(--subtle);
}

.shell {
  flex: 1;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

body.mode-console .shell {
  width: min(1180px, calc(100% - 40px));
}

body.mode-login .shell,
body.mode-forbidden .shell {
  align-self: center;
  width: min(480px, calc(100% - 48px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 0 64px;
}

.gate { display: grid; gap: 24px; }

.gate__intro h1 {
  font-size: clamp(26px, 5vw, 34px);
  letter-spacing: -0.035em;
  line-height: 1.25;
  margin: 8px 0 10px;
}

.kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sky-deep);
}

.lede,
.panel__head p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.console-stack { display: grid; gap: 20px; }

.module { min-width: 0; }

.panel {
  background: var(--header-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(16px);
}

.panel__head { margin-bottom: 22px; }

.panel__head--row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.panel__tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sky-deep);
  margin-bottom: 10px;
}

.panel__tag--warn { color: var(--amber); }

.panel h2 {
  font-size: 22px;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.panel__head code,
.link-cell code,
td code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
}

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

.field { display: grid; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }

.field input {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0 14px;
  font: inherit;
  color: var(--page-fg);
}

.field input:focus {
  outline: 2px solid rgba(14, 165, 233, 0.35);
  border-color: var(--sky);
}

.otp-row {
  display: flex;
  gap: 12px;
  align-items: end;
}

.field--grow { flex: 1; }

.btn {
  height: 48px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 18px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

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

.btn--primary { background: var(--sky); color: #fff; }
.btn--primary:hover:not(:disabled) { background: #0284c7; }
.btn--danger { background: var(--rose); }
.btn--danger:hover:not(:disabled) { background: #c0392b; }

.btn--ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--page-fg);
}

.btn--small { height: 36px; font-size: 13px; width: fit-content; }

.status {
  min-height: 1.4em;
  font-size: 13px;
  color: var(--muted);
}

.status.is-error { color: var(--rose); }
.status.is-ok { color: var(--sky-deep); }

/* 上传 */
.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 36px 20px;
  border: 2px dashed var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.is-drag {
  border-color: var(--sky);
  background: rgba(14, 165, 233, 0.05);
}

.dropzone.has-file { border-style: solid; }

.dropzone svg { width: 28px; height: 28px; color: var(--sky); }

.dropzone__title { font-weight: 650; color: var(--page-fg); }
.dropzone__hint { font-size: 12px; color: var(--subtle); }

.sync-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.sync-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--sky);
  flex-shrink: 0;
}

.sync-toggle span {
  display: grid;
  gap: 2px;
}

.sync-toggle strong { font-size: 13px; color: var(--page-fg); }
.sync-toggle em { font-style: normal; font-size: 12px; color: var(--subtle); }

.upload-bar { display: grid; gap: 8px; }

.upload-bar__track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}

.upload-bar__fill {
  height: 100%;
  width: 0%;
  background: var(--sky);
  transition: width 0.15s ease;
}

.upload-bar__text { font-size: 12px; color: var(--subtle); }

/* 表格 */
.table-wrap {
  overflow-x: auto;
  margin-top: 4px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 12px;
  color: var(--subtle);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr.is-empty td {
  text-align: center;
  color: var(--subtle);
  padding: 22px 10px;
}

.link-cell {
  min-width: 320px;
}

.link-input {
  width: 100%;
  max-width: 340px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
  margin-bottom: 6px;
}

.copy-btn { height: 30px; font-size: 12px; padding: 0 12px; }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--sky-deep);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.danger-link { color: var(--rose); }

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.42);
  display: grid;
  place-items: end center;
  padding: 24px;
  z-index: 20;
}

.modal[hidden] { display: none; }

.modal__dialog {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 8vh;
}

.modal__dialog h2 { margin-bottom: 10px; }
.modal__dialog p { color: var(--muted); line-height: 1.6; }

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 860px) {
  .topbar {
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  .shell {
    width: min(calc(100% - 32px), 1080px);
    padding-top: 28px;
  }
  body.mode-login .shell,
  body.mode-forbidden .shell {
    width: min(calc(100% - 32px), 480px);
    padding: 32px 0 48px;
  }
  .otp-row {
    flex-direction: column;
    align-items: stretch;
  }
  .otp-row .btn { width: 100%; }
}
