:root {
  color: #18201d;
  background: #f4f6f4;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-synthesis: none;
  --ink: #18201d;
  --muted: #6d7772;
  --line: #dfe5e1;
  --paper: #ffffff;
  --soft: #f4f6f4;
  --green: #167a54;
  --green-dark: #0d5c3e;
  --green-soft: #e8f4ee;
  --amber: #a96512;
  --amber-soft: #fff3dc;
  --red: #b5413a;
  --red-soft: #fcebea;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--soft);
}
button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 44%) 1fr;
  background: var(--paper);
}
.login-panel {
  width: min(430px, calc(100vw - 40px));
  margin: auto;
  padding: 44px 20px;
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  font-size: 15px;
  font-weight: 800;
}
.brand-mark.small {
  width: 34px;
  height: 34px;
  font-size: 11px;
}
.eyebrow {
  margin: 24px 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.login-panel h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.25;
  letter-spacing: 0;
}
.muted {
  color: var(--muted);
  line-height: 1.7;
}
.stack-form {
  display: grid;
  gap: 18px;
  margin-top: 32px;
}
label {
  display: grid;
  gap: 8px;
  color: #3f4944;
  font-size: 13px;
  font-weight: 700;
}
input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #cbd4cf;
  border-radius: 5px;
  outline: none;
  color: var(--ink);
  background: white;
}
textarea {
  min-height: 82px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 122, 84, 0.12);
}
button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 700;
}
.primary {
  color: white;
  background: var(--green);
}
.primary:hover {
  background: var(--green-dark);
}
.secondary {
  color: var(--ink);
  background: white;
  border-color: var(--line);
}
.secondary:hover {
  border-color: #aab6af;
  background: #fafbfa;
}
.quiet {
  min-height: 32px;
  padding: 4px 8px;
  color: var(--muted);
  background: transparent;
}
.danger {
  color: var(--red);
  background: white;
  border-color: #ecc6c3;
}
.wide {
  width: 100%;
  min-height: 46px;
}
.form-error {
  min-height: 18px;
  margin: -6px 0 0;
  color: var(--red);
  font-size: 13px;
}
.login-context {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: end;
  padding: 64px;
  color: white;
  background: #17342a;
}
.login-context::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.34;
  background-image:
    linear-gradient(90deg, transparent 49px, rgba(255, 255, 255, 0.14) 50px),
    linear-gradient(transparent 49px, rgba(255, 255, 255, 0.14) 50px);
  background-size: 50px 50px;
}
.login-context::after {
  content: "";
  position: absolute;
  width: 48%;
  aspect-ratio: 1;
  right: 8%;
  top: 12%;
  border: 36px solid rgba(255, 255, 255, 0.08);
  transform: rotate(12deg);
}
.context-copy {
  position: relative;
  z-index: 1;
}
.context-copy .eyebrow {
  color: #8ee1bc;
}
.context-copy h2 {
  margin: 0 0 34px;
  font-size: clamp(34px, 4vw, 64px);
  line-height: 1.12;
  letter-spacing: 0;
}
.context-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.context-grid span {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  font-size: 13px;
}
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: #17231f;
  color: white;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 24px;
}
.brand-row .brand-mark {
  background: #2c9a70;
}
nav {
  display: grid;
  gap: 4px;
}
nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 8px 11px;
  border: 0;
  color: #b9c7c1;
  background: transparent;
  text-align: left;
}
nav button span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid #485851;
  border-radius: 4px;
  font-size: 11px;
}
nav button:hover,
nav button.active {
  color: white;
  background: #273730;
}
nav button.active span {
  border-color: #56b28e;
  color: #8ee1bc;
}
.sidebar-foot {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid #31423b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-foot div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.sidebar-foot strong,
.sidebar-foot small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-foot small {
  color: #91a099;
}
.sidebar-foot .quiet {
  color: #b9c7c1;
}
.workspace {
  min-width: 0;
}
.topbar {
  min-height: 90px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(20px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}
.topbar .eyebrow {
  margin: 0 0 2px;
}
.topbar h1 {
  margin: 0;
  font-size: 23px;
  letter-spacing: 0;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}
.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border-color: var(--line);
  font-size: 20px;
}
#menu-button {
  display: none;
}
main {
  max-width: 1520px;
  margin: 0 auto;
  padding: 30px clamp(20px, 4vw, 52px) 60px;
}
.page-head {
  min-height: 44px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.page-head p {
  margin: 0;
  color: var(--muted);
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.metric {
  min-height: 122px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}
.metric header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}
.metric strong {
  display: block;
  margin-top: 22px;
  font-size: 28px;
  line-height: 1;
}
.metric .signal {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}
.metric.warn .signal {
  background: var(--amber);
}
.section {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.section-title h2 {
  margin: 0;
  font-size: 16px;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.quick-actions button {
  min-height: 74px;
  text-align: left;
  padding: 14px;
  background: var(--soft);
  border-color: var(--line);
}
.quick-actions small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 500;
}
.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px) auto;
  gap: 10px;
  margin-bottom: 16px;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}
th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #e9edea;
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}
th {
  color: var(--muted);
  background: #f8faf8;
  font-size: 12px;
  font-weight: 700;
}
tr:last-child td {
  border-bottom: 0;
}
td.actions {
  text-align: right;
}
.table-button {
  min-height: 30px;
  padding: 3px 8px;
  border: 0;
  color: var(--green);
  background: transparent;
}
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 700;
}
.status.warn {
  color: var(--amber);
  background: var(--amber-soft);
}
.status.off {
  color: #69736e;
  background: #edf0ee;
}
.status.danger {
  color: var(--red);
  background: var(--red-soft);
}
.empty {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}
.loading {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.loading::before {
  content: "";
  width: 24px;
  height: 24px;
  margin-right: 10px;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full {
  grid-column: 1 / -1;
}
.inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
}
.inline-check input {
  width: 18px;
  min-height: 18px;
}
.settings-list {
  display: grid;
  gap: 0;
}
.setting-row {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child {
  border-bottom: 0;
}
.setting-row strong,
.setting-row small {
  display: block;
}
.setting-row small {
  margin-top: 5px;
  color: var(--muted);
}
dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 7px;
  box-shadow: 0 18px 70px rgba(16, 32, 24, 0.22);
}
dialog::backdrop {
  background: rgba(17, 28, 23, 0.54);
}
dialog form > header {
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
dialog header .eyebrow {
  margin: 0 0 3px;
}
dialog h2 {
  margin: 0;
  font-size: 20px;
}
.modal-body {
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 22px;
}
dialog .form-error {
  padding: 0 22px;
}
dialog footer {
  padding: 16px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  border-top: 1px solid var(--line);
}
.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100vw - 48px));
  padding: 13px 16px;
  border-radius: 5px;
  color: white;
  background: #20332b;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.error {
  background: #8f312d;
}
.sidebar-backdrop {
  display: none;
}
@media (max-width: 900px) {
  .login-view {
    grid-template-columns: 1fr;
  }
  .login-context {
    display: none;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: 240px;
    transition: transform 0.2s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop.open {
    position: fixed;
    z-index: 9;
    inset: 0;
    display: block;
    background: rgba(0, 0, 0, 0.35);
  }
  #menu-button {
    display: grid;
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 620px) {
  .topbar {
    min-height: 76px;
    padding: 12px 16px;
  }
  .topbar-actions #today {
    display: none;
  }
  main {
    padding: 20px 14px 46px;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
  .metric {
    min-height: 100px;
  }
  .metric strong {
    margin-top: 15px;
  }
  .quick-actions {
    grid-template-columns: 1fr;
  }
  .filters {
    grid-template-columns: 1fr;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .full {
    grid-column: auto;
  }
  .setting-row {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 0;
  }
}
