:root {
  --ink: #071512;
  --ink-2: #0d2420;
  --panel: rgba(14, 36, 32, 0.72);
  --line: rgba(184, 230, 198, 0.14);
  --mist: #9bb5ad;
  --text: #e7f2ec;
  --brand: #b8e6c6;
  --accent: #f0b429;
  --danger: #ff6b5a;
  --ok: #3dd68c;
  --radius: 18px;
  --font: "Sora", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Noto Serif SC", "Songti SC", serif;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(240, 180, 41, 0.16), transparent 55%),
    radial-gradient(900px 600px at 90% 0%, rgba(61, 214, 140, 0.12), transparent 50%),
    linear-gradient(165deg, #04110e 0%, #0a1f1b 42%, #102821 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(184, 230, 198, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 230, 198, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}

a { color: var(--brand); text-decoration: none; }
button, input, select { font: inherit; }
.hidden { display: none !important; }

/* —— Login composition —— */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  position: relative;
  overflow: hidden;
}

.login-shell::after {
  content: "";
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  right: -18vmax;
  bottom: -22vmax;
  border-radius: 40% 60% 55% 45%;
  background: radial-gradient(circle at 30% 30%, rgba(240, 180, 41, 0.22), transparent 60%);
  filter: blur(8px);
  animation: drift 14s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to { transform: translate3d(-4%, -3%, 0) rotate(8deg); }
}

.login-frame {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(9, 28, 24, 0.92), rgba(8, 22, 20, 0.78));
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(16px);
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  padding: 56px 48px;
  position: relative;
  isolation: isolate;
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 40%, rgba(184, 230, 198, 0.08)),
    url("data:image/svg+xml,%3Csvg width='160' height='160' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 80h160M80 0v160' stroke='%23b8e6c6' stroke-opacity='.08'/%3E%3C/svg%3E");
  z-index: -1;
}

.brand-mark {
  font-family: var(--display);
  font-size: clamp(3.4rem, 7vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: 0.08em;
  margin: 0 0 18px;
  color: var(--brand);
  text-shadow: 0 0 40px rgba(184, 230, 198, 0.25);
}

.brand-line {
  margin: 0;
  max-width: 18em;
  color: var(--mist);
  font-size: 1.05rem;
  line-height: 1.65;
}

.brand-meta {
  margin-top: 48px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: rgba(231, 242, 236, 0.55);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-panel {
  padding: 48px 40px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-panel h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 600;
}

.login-panel .sub {
  margin: 0 0 28px;
  color: var(--mist);
  font-size: 0.92rem;
}

.portal-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
}

.portal-switch button {
  border: 0;
  background: transparent;
  color: var(--mist);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s ease;
}

.portal-switch button.active {
  background: linear-gradient(120deg, #1f4d3f, #16382f);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(184, 230, 198, 0.25);
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--mist);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
  border-color: rgba(184, 230, 198, 0.55);
  box-shadow: 0 0 0 3px rgba(184, 230, 198, 0.12);
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 600;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(120deg, #f0b429, #e89a1a);
  color: #1a1203;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-danger {
  background: rgba(255, 107, 90, 0.12);
  color: #ffb4aa;
  border: 1px solid rgba(255, 107, 90, 0.35);
}
.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { padding: 8px 12px; border-radius: 10px; font-size: 0.85rem; }

.hint {
  margin-top: 16px;
  color: rgba(155, 181, 173, 0.9);
  font-size: 0.8rem;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  padding: 12px 16px;
  border-radius: 12px;
  background: #102821;
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
}
.toast.error { border-color: rgba(255, 107, 90, 0.5); color: #ffb4aa; }

/* —— App shell —— */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.rail {
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 21, 18, 0.9), rgba(10, 28, 24, 0.65));
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail-brand {
  font-family: var(--display);
  font-size: 1.8rem;
  letter-spacing: 0.12em;
  color: var(--brand);
  margin: 0 8px 6px;
}
.rail-tag {
  margin: 0 8px 28px;
  color: var(--mist);
  font-size: 0.78rem;
}

.nav-btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--mist);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 4px;
}
.nav-btn.active, .nav-btn:hover {
  background: rgba(184, 230, 198, 0.08);
  color: var(--text);
}

.rail-foot {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 24px;
}

.main {
  padding: 28px 32px 48px;
  max-width: 1100px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 28px;
}
.topbar h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
}
.topbar p {
  margin: 6px 0 0;
  color: var(--mist);
  font-size: 0.92rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
}
.stat .label { color: var(--mist); font-size: 0.78rem; margin-bottom: 8px; }
.stat .value {
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.stat .value.accent { color: var(--accent); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  padding: 20px;
  margin-bottom: 18px;
}
.panel h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 600;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.table th {
  color: var(--mist);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.table tr:hover td { background: rgba(184, 230, 198, 0.04); }

.empty {
  padding: 36px 12px;
  text-align: center;
  color: var(--mist);
}

.file-input-hidden { display: none; }

@media (max-width: 900px) {
  .login-frame { grid-template-columns: 1fr; }
  .login-brand { padding: 36px 28px 12px; }
  .login-panel { border-left: 0; border-top: 1px solid var(--line); padding: 28px; }
  .app-shell { grid-template-columns: 1fr; }
  .rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .rail-foot { position: static; margin-top: 18px; }
  .stat-row { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 40px; }
}
