:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --panel: #ffffff;
  --panel-soft: #f9faf7;
  --line: #dfe5dd;
  --text: #17211b;
  --muted: #66736a;
  --primary: #116149;
  --primary-strong: #0a4d39;
  --primary-soft: #e5f2ec;
  --accent: #b65f21;
  --danger: #b83232;
  --shadow: 0 12px 30px rgba(23, 33, 27, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.boot {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--muted);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-title {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.25;
}

.login-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 243, 0.94);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 64px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 760;
}

.brand-meta {
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.main {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 44px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 9px 13px;
  color: var(--muted);
}

.tab.active {
  color: var(--primary);
  border-color: #8bc0aa;
  background: var(--primary-soft);
  font-weight: 700;
}

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

.grid.two {
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.4fr);
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(23, 33, 27, 0.04);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.panel-meta {
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 18px;
}

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

.form-row {
  display: grid;
  gap: 7px;
}

.form-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.55;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: #7fb9a0;
  box-shadow: 0 0 0 3px rgba(17, 97, 73, 0.12);
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hint-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.pay-preview {
  display: grid;
  gap: 5px;
  border: 1px solid #cfe2d7;
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 12px;
}

.pay-preview strong {
  font-size: 24px;
  color: var(--primary);
}

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

.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 13px;
  min-height: 40px;
  font-weight: 680;
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-strong);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: #efc0c0;
  color: var(--danger);
}

.btn.small {
  padding: 7px 10px;
  min-height: 32px;
  font-size: 13px;
}

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

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 750;
}

td.content-cell {
  min-width: 260px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.status.on {
  background: #e5f2ec;
  color: var(--primary);
}

.status.off {
  background: #f2e8e5;
  color: var(--accent);
}

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

.metric {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.metric strong {
  font-size: 22px;
}

.notice {
  border: 1px solid #ecd7b6;
  background: #fff8ed;
  color: #694015;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.5;
  font-size: 13px;
}

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--text);
  color: #fff;
  box-shadow: var(--shadow);
  line-height: 1.4;
}

.toast.error {
  background: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(23, 33, 27, 0.36);
  padding: 18px;
}

.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal .panel-head {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

@media (max-width: 860px) {
  .grid.two {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 560px) {
  .main,
  .topbar-inner {
    width: min(100% - 20px, 1180px);
  }

  .login-panel {
    padding: 22px;
  }

  .inline-fields,
  .summary {
    grid-template-columns: 1fr;
  }

  .user-pill {
    max-width: 58vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
