:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f9fbfe;
  --text: #111827;
  --text-soft: #475467;
  --muted: #667085;
  --soft: #f9fbfe;
  --line: #e5eaf3;
  --line-strong: #d5deeb;
  --blue: #2563eb;
  --blue-soft: #eef5ff;
  --green: #079455;
  --green-soft: #eaf8ef;
  --orange: #b54708;
  --orange-soft: #fff6e9;
  --red: #c4322b;
  --red-soft: #fff1f0;
  --black: #101828;
  --radius: 14px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --font: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(255,255,255,.84), rgba(255,255,255,.38)),
    linear-gradient(#edf1f7 1px, transparent 1px),
    linear-gradient(90deg, #edf1f7 1px, transparent 1px),
    var(--bg);
  background-size: auto, 42px 42px, 42px 42px, auto;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d6dde7;
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  color: var(--muted);
  background: #fbfcfd;
  font-weight: 850;
  white-space: nowrap;
}

td strong {
  font-weight: 850;
}

.hidden {
  display: none !important;
}

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

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 500px;
}

.login-copy {
  min-width: 0;
  padding: 74px clamp(36px, 6vw, 96px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 42px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--black);
  font-size: 18px;
  font-weight: 950;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.hero-kicker {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.login-copy h2 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(42px, 5.8vw, 76px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

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

.login-points div {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
}

.login-points strong {
  display: block;
  margin-bottom: 6px;
  font-weight: 850;
}

.login-points span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.login-panel-wrap {
  display: grid;
  place-items: center;
  padding: 42px;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

.login-panel,
.panel,
.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel {
  width: 100%;
  max-width: 430px;
  overflow: hidden;
}

.login-head {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcff;
}

.login-head h3 {
  margin: 0;
  font-size: 22px;
}

.login-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.form {
  display: grid;
  gap: 14px;
  padding: 22px 24px 24px;
}

.form label,
.form-grid label,
.inline-form-grid label,
.device-control-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.message {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  line-height: 1.7;
}

.login-submit,
.button,
.primary-button,
.mini-button,
.text-button,
.quick-action {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  font-weight: 850;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.login-submit,
.button.primary,
.primary-button {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.button.ghost {
  background: #fff;
}

.button.danger {
  color: var(--red);
  border-color: #ffd8d4;
  background: var(--red-soft);
}

.login-submit:hover,
.button:hover,
.primary-button:hover,
.mini-button:hover,
.quick-action:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.text-button {
  min-height: auto;
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
}

.mini-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: #fff;
  overflow-y: auto;
}

.sidebar .brand {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-item {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 11px;
  color: #2f3744;
  background: transparent;
  text-align: left;
}

.nav-item.active {
  color: var(--blue);
  border-color: #d7e6ff;
  background: var(--blue-soft);
}

.count {
  min-width: 28px;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 8px;
  color: inherit;
  background: rgba(15, 23, 42, 0.06);
  font-size: 11px;
}

.nav-item.active .count {
  background: rgba(37, 99, 235, 0.10);
}

.sidebar-note {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--soft);
  font-size: 12px;
  line-height: 1.7;
}

.workspace {
  min-width: 0;
  padding: 20px 28px 32px;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.title h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.title p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 16px;
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.1;
}

.stat-card small {
  margin-top: 8px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(390px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.stack {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.panel-head h3 {
  margin: 0;
  font-size: 17px;
}

.panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.quota-accounting-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  gap: 14px;
  margin-bottom: 14px;
}

.compact-form {
  padding: 18px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-grid label.check-row {
  display: flex;
  align-items: center;
  min-height: 38px;
  gap: 8px;
  color: var(--text);
}

.form-grid label.check-row input {
  width: 16px;
  height: 16px;
  min-height: 16px;
}

.inline-info {
  grid-column: 1 / -1;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.table-input {
  width: 100%;
  min-width: 120px;
  min-height: 34px;
}

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

.pagination-meta {
  color: var(--muted);
  font-size: 12px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pagination-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mini-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.usage-dashboard-panel {
  margin-bottom: 14px;
}

.usage-dashboard-toolbar {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) repeat(5, minmax(130px, 1fr));
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.segment {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}

.segment.active {
  color: #fff;
  background: var(--blue);
}

.usage-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.usage-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.usage-dashboard-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.usage-chart,
.usage-bars,
.usage-notes {
  padding: 18px;
}

.usage-chart {
  min-height: 230px;
  display: grid;
  align-items: end;
}

.chart-svg {
  width: 100%;
  min-height: 210px;
  display: block;
}

.chart-axis {
  stroke: #d7deea;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
}

.chart-area {
  fill: rgba(37, 99, 235, 0.08);
}

.chart-bar {
  fill: var(--blue);
  opacity: .9;
}

.chart-bar.secondary {
  fill: #9cbcf5;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.bar-row {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) 126px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.bar-row:last-child {
  border-bottom: 0;
}

.bar-row strong {
  font-size: 13px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: var(--blue);
}

.bar-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.usage-notes {
  color: var(--muted);
  line-height: 1.8;
}

.usage-notes ul {
  margin: 0;
  padding-left: 18px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table-wrap::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-wrap::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cdd5df;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.tag {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.tag.green {
  color: var(--green);
  background: var(--green-soft);
}

.tag.orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.tag.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.tag.red {
  color: var(--red);
  background: var(--red-soft);
}

.tag.gray {
  color: #475467;
  background: #eef2f6;
}

.env-dot {
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: currentColor;
}

.settings-list {
  margin: 0;
  padding: 8px 18px 18px;
}

.settings-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.settings-list div:last-child {
  border-bottom: 0;
}

.settings-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.settings-list dd {
  margin: 0;
  font-weight: 850;
  text-align: right;
}

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

.quick-action {
  min-height: 54px;
  text-align: left;
  background: var(--panel-soft);
}

.package-card {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.package-card strong {
  font-size: 19px;
}

.package-card span {
  color: var(--muted);
  font-size: 12px;
}

.package-card em {
  color: var(--text);
  font-size: 12px;
  font-style: normal;
  line-height: 1.5;
}

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

.form-grid.single {
  grid-template-columns: 1fr;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  grid-column: 1 / -1;
}

.expand-button {
  width: 30px;
  height: 30px;
  margin-right: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: #fff;
  font-weight: 900;
}

.account-row td:first-child {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.account-detail-row td {
  background: #fbfcfd;
}

.account-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
}

.subaccount-panel,
.inline-user-form {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.subaccount-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.subaccount-panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.subaccount-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

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

.subaccount-main,
.device-control-row,
.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subaccount-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.device-control-row {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.device-control-row label {
  width: 180px;
}

.session-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--panel-soft);
  font-size: 12px;
}

.inline-user-form {
  padding: 16px;
}

.inline-user-form > strong {
  display: block;
  margin-bottom: 12px;
}

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

.subaccount-empty {
  padding: 28px 14px;
}

.quota-input,
.inline-input {
  min-width: 110px;
}

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

.channel-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.channel-card strong {
  display: block;
  font-size: 16px;
}

.channel-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.model-group-row td {
  color: var(--text);
  background: #f2f5f9;
  font-weight: 900;
}

.dirty-hint {
  color: var(--orange);
  font-size: 12px;
  font-weight: 850;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 12px;
  color: #fff;
  background: rgba(17, 19, 24, 0.95);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
  font-size: 13px;
}

@media (max-width: 1280px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .usage-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .account-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .login-screen,
  .shell {
    grid-template-columns: 1fr;
  }

  .login-copy {
    padding: 28px 18px;
  }

  .login-panel-wrap {
    padding: 18px;
    border-left: 0;
    background: transparent;
  }

  .login-points,
  .stats,
  .usage-metric-grid,
  .usage-dashboard-grid,
  .usage-dashboard-grid.two,
  .usage-dashboard-toolbar,
  .toolbar,
  .form-grid,
  .quota-accounting-grid,
  .quick-actions,
  .package-grid,
  .channel-summary-grid,
  .inline-form-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-head,
  .pagination-bar,
  .subaccount-main,
  .device-control-row,
  .session-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .title h2 {
    font-size: 24px;
  }
}
