:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --text: #1f2329;
  --muted: #86909c;
  --line: #e5e6eb;
  --line-dark: #dcdfe6;
  --primary: #1e9fff;
  --primary-soft: #ecf5ff;
  --success-bg: #f0f9eb;
  --success-text: #529b2e;
  --error-bg: #fef0f0;
  --error-text: #c45656;
  --warn-bg: #fff8e8;
  --warn-text: #b88230;
  --shadow: 0 2px 10px rgba(31, 35, 41, 0.04);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", "PingFang SC", sans-serif;
}

.container {
  width: 100%;
  min-height: 100vh;
}

.hidden { display: none !important; }

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

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

.login-card h2,
.panel-title,
.content-title,
.stat-value,
.brand-title {
  margin: 0;
}

.login-card p,
.muted,
.brand-subtitle,
.side-note {
  color: var(--muted);
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
button {
  min-height: 38px;
  width: 100%;
  padding: 0 12px;
  border-radius: 4px;
  border: 1px solid var(--line-dark);
  background: #fff;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

button {
  width: auto;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--text);
}

button.warning {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: #f3d19e;
}

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

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

.message.success {
  background: var(--success-bg);
  border-color: #d9ecb4;
  color: var(--success-text);
}

.message.error {
  background: var(--error-bg);
  border-color: #fbc4c4;
  color: var(--error-text);
}

.frame-layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 60px 1fr;
}

.frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.frame-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 12px;
}

.frame-header-right,
.toolbar,
.inline-actions,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
}

.frame-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 0;
}

.frame-side {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 16px 0;
}

.side-group {
  padding: 0 16px 16px;
}

.side-title {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.side-menu {
  display: grid;
  gap: 6px;
}

.side-item {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  cursor: pointer;
}

.side-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #c6e2ff;
}

.frame-main {
  padding: 20px;
}

.page-stack {
  display: grid;
  gap: 16px;
}

.view-panel { display: none; }
.view-panel.active { display: grid; gap: 16px; }

.content-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.content-title {
  font-size: 16px;
  font-weight: 600;
}

.content-body {
  padding: 18px;
}

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

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

.stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
}

.two-col,
.three-col {
  display: grid;
  gap: 16px;
}

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

.token-box {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 4px;
  word-break: break-all;
  font-family: Consolas, monospace;
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--line);
}

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

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

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

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

.filters input,
.filters select {
  width: auto;
  min-width: 140px;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.pagination-info {
  color: var(--muted);
  font-size: 13px;
  margin-right: auto;
}

.pagination button {
  min-height: 34px;
}

@media (max-width: 1080px) {
  .frame-body {
    grid-template-columns: 1fr;
  }

  .frame-side {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 760px) {
  .frame-header,
  .content-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters input,
  .filters select,
  .frame-header-right button,
  .toolbar button,
  .inline-actions button,
  button {
    width: 100%;
  }
}
