:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b768a;
  --line: #e5e9f2;
  --blue: #2f6df6;
  --blue-soft: #e9efff;
  --green: #14a46c;
  --red: #e84b4b;
  --orange: #d97a17;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  color: var(--text);
  background: var(--bg);
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f7fbff 0%, #eef3fb 100%);
}

.login-card {
  width: 420px;
  padding: 34px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(23, 32, 51, 0.12);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-card p {
  margin: 0 0 28px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  font-size: 14px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #ccd3df;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

.primary-button,
.secondary-button,
.danger-button {
  height: 38px;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 600;
}

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

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

.danger-button {
  background: #fff1f1;
  color: var(--red);
}

.error {
  min-height: 20px;
  color: var(--red);
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

.sidebar {
  background: #111827;
  color: #d6dbea;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #2f6df6;
  color: #fff;
  font-weight: 800;
}

.brand strong {
  display: block;
  color: #fff;
}

.brand small {
  color: #98a2b8;
}

.nav-button {
  width: 100%;
  height: 42px;
  margin-bottom: 6px;
  padding: 0 12px;
  border-radius: 6px;
  background: transparent;
  color: #c4ccdc;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.main {
  padding: 22px 26px 40px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar input,
.toolbar select {
  height: 38px;
  border: 1px solid #ccd3df;
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

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

.stat-card {
  padding: 18px;
}

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

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 17px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  background: #fafbfe;
}

.table tr:last-child td {
  border-bottom: 0;
}

.muted {
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #edf1f7;
  color: #4f5b70;
}

.tag.active {
  background: #e8f7f0;
  color: var(--green);
}

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

.tag.paused,
.tag.expired {
  background: #fff4e8;
  color: var(--orange);
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.42);
  z-index: 10;
}

.modal {
  width: 760px;
  max-height: 88vh;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
  gap: 10px;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-body {
  padding: 20px 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 16px;
}

.full {
  grid-column: 1 / -1;
}

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