:root {
  --bg: #eef3f1;
  --bg-soft: #f7faf8;
  --panel: #ffffff;
  --panel-muted: #f5f8f7;
  --ink: #17211f;
  --muted: #66736f;
  --line: #dce5e1;
  --brand: #08776f;
  --brand-strong: #045c56;
  --brand-soft: #dff3ef;
  --danger: #c0392f;
  --ok: #128046;
  --shadow: 0 22px 70px rgba(28, 49, 45, 0.14);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(115deg, rgba(8, 119, 111, 0.08), transparent 34%),
    radial-gradient(circle at 82% 6%, rgba(247, 185, 87, 0.12), transparent 28%),
    var(--bg);
}

a {
  color: var(--brand);
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.page {
  width: min(1500px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.topbar,
.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(220, 229, 225, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 26px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.brand span {
  color: var(--muted);
  font-size: 14px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.nav form {
  margin: 0;
}

.nav a,
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.nav a.active,
.button.primary,
button.primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 10px 25px rgba(8, 119, 111, 0.22);
}

.button.danger,
button.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.button.ghost,
button.ghost {
  background: transparent;
}

.nav a:hover,
.button:hover,
button:hover {
  transform: translateY(-1px);
}

.panel {
  padding: 28px;
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.subtle {
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: 14px;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(8, 119, 111, 0.12);
}

.switch {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.switch-row {
  justify-content: space-between;
}

.switch input {
  width: auto;
  min-height: auto;
}

.toggle-switch {
  position: relative;
  min-width: 58px;
  width: 58px;
  min-height: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #d4dbd8;
  background: #dfe6e3;
  box-shadow: none;
}

.toggle-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(19, 32, 30, 0.18);
  transition: transform 0.16s ease;
}

.toggle-switch.is-on {
  background: var(--brand);
  border-color: var(--brand);
}

.toggle-switch.is-on span {
  transform: translateX(26px);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toolbar form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.toolbar input {
  width: min(360px, 100%);
}

.subtabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-muted);
}

.subtab {
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 14px;
  color: var(--muted);
}

.subtab.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(8, 119, 111, 0.18);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

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

th,
td {
  padding: 17px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: var(--panel-muted);
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  border: 1px solid rgba(8, 119, 111, 0.16);
  white-space: nowrap;
}

.pill.warn {
  color: #9a5a00;
  background: #fff3df;
  border-color: #f0dcc0;
}

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

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.message {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.message.success {
  border-color: rgba(18, 128, 70, 0.28);
  color: var(--ok);
  background: #f2fbf6;
}

.message.error {
  border-color: rgba(192, 57, 47, 0.28);
  color: var(--danger);
  background: #fff6f5;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 27, 25, 0.42);
}

.modal.is-open {
  display: flex;
}

.modal-card {
  width: min(1040px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 32px 90px rgba(15, 27, 25, 0.28);
  padding: 28px;
}

.modal-card.narrow {
  width: min(620px, 100%);
}

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

.modal-head h3 {
  margin: 0;
  font-size: 24px;
}

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

.mini-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  background: #fff;
}

.mini-panel h3 {
  margin-top: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #f7faf8 0%, #eef3f1 100%);
}

.login-card {
  width: min(460px, 100%);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.login-copy {
  margin-bottom: 18px;
}

.login-copy h1 {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.login-copy p {
  margin: 0;
  color: var(--muted);
}

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

.welcome-toast {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(247, 250, 248, 0.78);
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.welcome-toast span {
  display: inline-flex;
  padding: 22px 32px;
  border-radius: 24px;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 24px;
}

.welcome-toast.is-hidden {
  opacity: 0;
  visibility: hidden;
}

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

@media (max-width: 900px) {
  .page {
    width: min(100% - 24px, 1500px);
    padding: 14px 0 108px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    margin-bottom: 14px;
  }

  .brand strong {
    font-size: 25px;
  }

  .nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(15, 27, 25, 0.2);
  }

  .nav a,
  .nav button,
  .nav form {
    width: 100%;
  }

  .nav a,
  .nav button {
    min-height: 46px;
    padding: 8px 10px;
    border-radius: 16px;
    font-size: 14px;
  }

  .panel {
    padding: 18px;
    border-radius: 22px;
    margin-bottom: 16px;
  }

  .panel-header,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-header h1,
  .panel-header h2 {
    font-size: 24px;
  }

  .grid,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .toolbar form,
  .toolbar input {
    width: 100%;
  }

  .subtabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .subtab {
    text-align: center;
  }

  .table-wrap {
    max-height: 62vh;
    border-radius: 18px;
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 14px 12px;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card,
  .modal-card.narrow {
    width: 100%;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
    padding: 18px;
  }

  .modal-card .table-wrap {
    max-height: 46vh;
  }

  .actions .button,
  .actions button {
    flex: 1 1 auto;
  }

  .login-shell {
    align-items: start;
    place-items: start center;
    padding-top: 22vh;
  }

  .welcome-toast span {
    font-size: 19px;
  }
}

@media (max-width: 520px) {
  .page {
    width: calc(100% - 16px);
  }

  .panel,
  .topbar {
    border-radius: 18px;
  }

  .panel {
    padding: 14px;
  }

  .button,
  button {
    min-height: 42px;
    padding: 8px 13px;
  }

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