:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #eef4f1;
  --text: #1f2933;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #0f8f7a;
  --accent-dark: #086858;
  --amber: #a15c05;
  --danger: #c03232;
  --shadow: 0 18px 50px rgba(31, 41, 51, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: 3px solid rgba(15, 143, 122, 0.16);
  border-color: var(--accent);
}
label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}
code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef1f5;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(15, 143, 122, 0.12), rgba(161, 92, 5, 0.08)),
    var(--bg);
}
.login-shell { width: min(440px, calc(100vw - 28px)); }
.login-panel, .panel, .content, .sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.login-panel { padding: 28px; }
.brand-block, .brand-line, .top-actions, .section-head, .action-row, .suffix-input, .switch-line {
  display: flex;
  align-items: center;
}
.brand-block, .brand-line { gap: 14px; }
.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}
.brand-mark.small {
  width: 42px;
  height: 42px;
  font-size: 13px;
}
h1, h2, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 20px; }
p { color: var(--muted); margin-top: 4px; }
.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}
.notice {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--accent-dark);
}
.notice.danger { color: var(--danger); background: #fff1f1; }

.primary-btn, .secondary-btn, .ghost-link, .side-tab {
  min-height: 38px;
  border-radius: 8px;
  padding: 9px 14px;
  text-decoration: none;
}
.primary-btn {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.primary-btn:hover { background: var(--accent-dark); }
.secondary-btn {
  background: #eef1f5;
  color: var(--text);
  border: 1px solid var(--line);
}
.secondary-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.small-btn { min-height: 32px; padding: 6px 10px; }
.ghost-link {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  border: 1px solid var(--line);
  background: #fff;
}

.topbar {
  min-height: 72px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
}
.top-actions { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.balance-pill, .price-tag {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--muted);
}
.balance-pill strong { color: var(--amber); font-size: 18px; }

.workspace {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  padding: 22px;
}
.sidebar {
  padding: 10px;
  align-self: start;
  display: grid;
  gap: 8px;
}
.side-tab {
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--text);
}
.side-tab.active {
  background: var(--panel-soft);
  color: var(--accent-dark);
  font-weight: 700;
}
.content { padding: 22px; min-height: calc(100vh - 120px); }
.tool-view { display: none; }
.tool-view.active { display: block; }
.section-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.section-head.simple { justify-content: flex-start; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}
.tool-grid.compact { grid-template-columns: repeat(2, minmax(160px, 240px)); }
.full-width { display: block; margin-top: 16px; }
.suffix-input { gap: 8px; }
.suffix-input input { min-width: 0; }
.suffix-input b {
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
}
.action-row { gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.status-text { color: var(--muted); }
.status-text.bad { color: var(--danger); }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 700; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
.muted-cell { color: var(--muted); text-align: center; }

.admin-workspace {
  display: grid;
  gap: 18px;
  padding: 22px;
}
.panel { padding: 20px; }
.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 22px;
}
.inline-input { max-width: 140px; }
.switch-line { gap: 8px; color: var(--muted); }
.switch-line input { width: auto; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.bad { background: var(--danger); }

@media (max-width: 820px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 14px 16px; }
  .workspace { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { grid-template-columns: repeat(3, 1fr); }
  .side-tab { text-align: center; }
  .content { padding: 16px; }
  .tool-grid, .tool-grid.compact, .two-col { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
}
