:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1b1f24;
  --muted: #687383;
  --line: #d8dde5;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --danger: #b42318;
  --warn: #a15c07;
  --ok: #137333;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
.topbar {
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.top-actions { display: flex; align-items: center; gap: 10px; }
h1, h2, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 16px; margin-bottom: 14px; }
main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.auth { max-width: 420px; margin: 56px auto; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, select {
  width: 100%;
  height: 38px;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}
button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
.row, .section-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.muted { color: var(--muted); font-size: 13px; }
.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.summary > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.summary span { display: block; color: var(--muted); font-size: 12px; }
.summary strong { display: block; font-size: 22px; margin-top: 4px; }
#user-id { font-size: 13px; word-break: break-all; }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}
.tariff-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tariff {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 176px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tariff .price { font-size: 24px; font-weight: 750; }
.tariff .meta { color: var(--muted); font-size: 13px; line-height: 1.35; }
.tariff button { margin-top: auto; }
.method {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  font-size: 14px;
}
.method code { display: block; margin-top: 6px; word-break: break-all; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
.keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.key-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.key-card code { display: block; word-break: break-all; margin: 8px 0; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #eef2f7; color: var(--muted); font-size: 12px; }
.badge.ok { background: #e7f5ec; color: var(--ok); }
.badge.warn { background: #fff4dc; color: var(--warn); }
.badge.bad { background: #fde7e7; color: var(--danger); }
#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #1f2937;
  color: white;
  opacity: 0;
  transform: translateY(8px);
  transition: .18s;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 36px));
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { background: var(--danger); }
#toast.ok { background: var(--ok); }
@media (max-width: 900px) {
  .layout, .summary, .tariff-grid, .keys { grid-template-columns: 1fr; }
  main { padding: 16px; }
  .topbar { padding: 14px 16px; }
}
