:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #657085;
  --line: #dfe5ef;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok-bg: #dff7ed;
  --ok: #047857;
  --off-bg: #e9edf4;
  --off: #5b6474;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  background: #152238;
  color: white;
  padding: 22px 16px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 22px;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
}

.nav-logout {
  margin: 0;
}

.nav-logout button {
  width: 100%;
  border: 0;
  padding: 10px 12px;
  background: transparent;
  color: #cbd5e1;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}

.nav-logout button:hover {
  background: #263954;
  color: #ffffff;
}

.sidebar a.active,
.sidebar a:hover {
  background: #263954;
  color: #ffffff;
}

.content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: 220px;
  padding: 28px;
}

.site-footer {
  margin-top: auto;
  padding: 24px 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.page-head {
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.page-head p,
.muted {
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stats div,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats div {
  padding: 18px;
}

.stats strong {
  display: block;
  font-size: 30px;
}

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

.panel {
  padding: 18px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.panel.narrow {
  max-width: 620px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.page-head-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.page-head-actions form {
  flex: 0 0 auto;
}

.history-stats {
  grid-template-columns: repeat(2, minmax(160px, 260px));
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

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

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

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

.path {
  max-width: 520px;
  word-break: break-all;
  font-family: Consolas, "Courier New", monospace;
}

.hash {
  white-space: nowrap;
  font-family: Consolas, "Courier New", monospace;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.quota-form input[type="number"] {
  width: 86px;
  min-height: 34px;
}

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

.empty-cell {
  padding: 28px 8px;
  text-align: center;
}

.pill {
  display: inline-block;
  min-width: 42px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  text-align: center;
}

.pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.pill.off {
  background: var(--off-bg);
  color: var(--off);
}

.pill.warn {
  background: #fff3d7;
  color: var(--warn);
}

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

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

.notice,
.error {
  max-width: 620px;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.notice {
  background: var(--ok-bg);
  color: var(--ok);
}

.error {
  background: #fee2e2;
  color: var(--danger);
}

.login-body {
  min-height: 100svh;
  overflow: hidden;
  background: #e9f5ef;
}

.login-shell {
  position: relative;
  min-height: 100svh;
  isolation: isolate;
}

.login-site-footer {
  position: absolute;
  right: 24px;
  bottom: 14px;
  left: 24px;
  z-index: 2;
  padding: 0;
  color: #52736b;
}

.login-flow,
.login-grid {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.login-flow {
  z-index: -2;
}

.login-grid {
  z-index: -1;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(25, 105, 83, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 105, 83, 0.07) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.65) 54%, transparent 82%);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 60px;
  width: min(1080px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: 36px 48px;
}

.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 12px 0 6px;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #153b34;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  gap: 3px;
  width: 28px;
  height: 28px;
  padding: 5px;
  border: 1px solid rgba(13, 111, 80, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 8px 24px rgba(24, 91, 72, 0.1);
}

.brand-mark i {
  display: block;
  width: 5px;
  border-radius: 2px 2px 0 0;
  background: #0f8f67;
}

.brand-mark i:nth-child(1) {
  height: 8px;
}

.brand-mark i:nth-child(2) {
  height: 15px;
  background: #42a99d;
}

.brand-mark i:nth-child(3) {
  height: 11px;
  background: #477f9c;
}

.login-intro-copy {
  max-width: 680px;
  padding-bottom: 5vh;
}

.login-eyebrow,
.login-form-kicker {
  display: inline-block;
  color: #177a5d;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.login-intro-copy h1 {
  margin: 16px 0 14px;
  color: #12372f;
  font-size: 64px;
  line-height: 1.08;
  letter-spacing: 0;
}

.login-intro-copy p {
  margin: 0;
  color: #4d6961;
  font-size: 20px;
  line-height: 1.7;
}

.login-signal {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: #46665e;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
}

.login-signal i {
  width: 36px;
  height: 1px;
  background: rgba(24, 108, 84, 0.32);
}

.signal-pulse {
  width: 8px;
  height: 8px;
  border: 2px solid #e9f5ef;
  border-radius: 50%;
  background: #16a36f;
  box-shadow: 0 0 0 1px rgba(16, 163, 111, 0.26);
  animation: signal-pulse 2.4s ease-in-out infinite;
}

.login-form-wrap {
  display: grid;
  place-items: center;
  min-width: 0;
}

.login-panel {
  width: 100%;
  max-width: 404px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(24, 103, 82, 0.16);
  border-radius: 8px;
  padding: 36px;
  box-shadow: 0 24px 70px rgba(25, 73, 62, 0.14);
}

.login-form-head {
  margin-bottom: 30px;
}

.login-form-head h2 {
  margin: 10px 0 8px;
  color: #183b33;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.login-form-head p {
  margin: 0;
  color: #6a7e78;
  font-size: 14px;
}

.login-fields {
  display: grid;
  gap: 18px;
}

.login-field {
  gap: 8px;
  color: #2d4942;
  font-size: 13px;
  font-weight: 700;
}

.login-field input {
  width: 100%;
  min-height: 48px;
  border-color: #d8e5e0;
  background: #f8fbfa;
  color: #153a32;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.login-field input::placeholder {
  color: #96a9a3;
}

.login-field input:hover {
  border-color: #accbc0;
}

.login-field input:focus {
  border-color: #16865f;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(22, 134, 95, 0.12);
}

.login-error,
.login-notice {
  margin-top: 16px;
  border-radius: 6px;
  padding: 11px 12px;
  font-size: 12px;
  line-height: 1.6;
}

.login-error {
  border: 1px solid #fecaca;
  background: #fff2f2;
  color: #a51d2d;
}

.login-notice {
  border: 1px solid #bfe3d3;
  background: #effaf5;
  color: #176b50;
}

.table-action {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #b8d8cb;
  background: #f2faf6;
  color: #116a50;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.table-action:hover {
  background: #e2f4ec;
  color: #0b5b43;
}

.admin-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid #cfe0da;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 28px 80px rgba(20, 57, 48, 0.24);
}

.admin-dialog::backdrop {
  background: rgba(12, 31, 27, 0.45);
  backdrop-filter: blur(3px);
}

.dialog-panel {
  display: grid;
  gap: 16px;
  padding: 24px;
}

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

.dialog-head h2 {
  margin: 4px 0 0;
  color: #173d34;
  font-size: 22px;
}

.dialog-kicker {
  color: #188060;
  font-size: 11px;
  font-weight: 800;
}

.dialog-close {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid #d6e2de;
  background: #f5f8f7;
  color: #587069;
  font-size: 22px;
  line-height: 1;
}

.dialog-close:hover {
  background: #eaf3ef;
  color: #204f42;
}

.dialog-account {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #25946e;
  background: #f1f8f5;
  color: #5e716b;
  font-size: 13px;
}

.dialog-account strong {
  color: #194f40;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.button-secondary {
  border: 1px solid #ccd9d5;
  background: #ffffff;
  color: #526a63;
}

.button-secondary:hover {
  background: #f2f6f4;
}

.login-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 50px;
  margin-top: 22px;
  padding: 0 18px;
  background: #087c58;
  box-shadow: 0 12px 28px rgba(8, 124, 88, 0.2);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.login-submit:hover {
  background: #096c50;
  box-shadow: 0 14px 32px rgba(8, 105, 78, 0.25);
  transform: translateY(-1px);
}

.login-submit:active {
  transform: translateY(0);
}

.login-submit:focus-visible {
  outline: 3px solid rgba(8, 124, 88, 0.2);
  outline-offset: 3px;
}

.login-submit-arrow {
  font-size: 20px;
  font-weight: 400;
  transition: transform 160ms ease;
}

.login-submit:hover .login-submit-arrow {
  transform: translateX(3px);
}

.login-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  color: #84978f;
  font-size: 11px;
}

.login-footnote span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3ea880;
}

@keyframes signal-pulse {
  0%, 100% {
    box-shadow: 0 0 0 1px rgba(16, 163, 111, 0.2);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(16, 163, 111, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .signal-pulse,
  .login-submit,
  .login-submit-arrow {
    animation: none;
    transition: none;
  }
}

@media (max-width: 980px) {
  .login-layout {
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 36px;
    width: min(920px, 100%);
    padding: 28px;
  }

  .login-intro {
    padding: 8px 0;
  }

  .login-intro-copy h1 {
    font-size: 50px;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .content {
    margin-left: 0;
    padding: 18px;
  }

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

  .page-head-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .login-body {
    overflow: auto;
  }

  .login-grid {
    opacity: 0.22;
    mask-image: none;
  }

  .login-layout {
    grid-template-columns: 1fr;
    align-content: start;
    width: 100%;
    padding: 0;
  }

  .login-intro {
    min-height: auto;
    padding: 24px 24px 0;
  }

  .login-intro-copy,
  .login-signal {
    display: none;
  }

  .login-form-wrap {
    place-items: start center;
    padding: 24px;
    border-left: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .login-panel {
    max-width: 460px;
    padding: 28px;
  }
}

@media (max-width: 460px) {
  .login-intro {
    padding: 20px 18px 0;
  }

  .login-form-wrap {
    padding: 20px 18px 30px;
  }

  .login-site-footer {
    position: static;
    padding: 0 18px 18px;
  }

  .login-panel {
    padding: 24px 20px;
  }

  .login-form-head h2 {
    font-size: 27px;
  }
}
