:root {
  --bg: #0b1220;
  --panel: #111a2b;
  --panel-2: #16233a;
  --line: #23324b;
  --text: #e6edf7;
  --muted: #90a1bb;
  --accent: #2f7cf6;
  --danger: #d94a4a;
  --ok: #2fbf71;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

code {
  background: rgba(255, 255, 255, .07);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 600; letter-spacing: .2px; }

.tabs { display: flex; gap: 4px; margin-left: auto; }

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.tab:hover { color: var(--text); background: var(--panel-2); }

.tab.is-active {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line);
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 22px 18px 60px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel-narrow { max-width: 460px; margin: 0 auto; }

.panel-title { margin: 0 0 14px; font-size: 18px; font-weight: 600; }

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

.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

.login-box { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

.login-status { min-height: 20px; color: var(--muted); }
.login-status.is-error { color: var(--danger); }
.login-status.is-ok { color: var(--ok); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; margin-top: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

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

.card-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.card-value { font-size: 20px; font-weight: 600; margin-top: 4px; }

.card-value.is-ok { color: var(--ok); }
.card-value.is-warn { color: #e0a33c; }

.pre {
  background: #0a1322;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #c6d4e8;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 16px;
  max-height: 340px;
  overflow: auto;
}

.pre:empty { display: none; }

.input {
  background: #0a1322;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  min-width: 0;
}

.input:focus { outline: 2px solid rgba(47, 124, 246, .45); outline-offset: 1px; }

.btn {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}

.btn:hover:not(:disabled) { border-color: #35507a; }

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #2a6fdd; border-color: #2a6fdd; }

.btn-danger { background: transparent; border-color: var(--danger); color: #ff8686; }
.btn-danger:hover:not(:disabled) { background: rgba(217, 74, 74, .14); }

.btn-ghost { background: transparent; }

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

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

.table th, .table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table th {
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

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

.table tbody tr:hover { background: rgba(255, 255, 255, .03); }

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

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.badge.active { border-color: rgba(47, 191, 113, .5); color: #7ee2a8; }
.badge.expired { border-color: rgba(217, 74, 74, .5); color: #ff9a9a; }
.badge.grace { border-color: rgba(224, 163, 60, .5); color: #f0c274; }
.badge.revoked { border-color: rgba(217, 74, 74, .5); color: #ff9a9a; }
.badge.hidden-plan { border-color: var(--line); color: var(--muted); }

.op-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.op {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.op-danger { border-color: rgba(217, 74, 74, .35); }

.op-title { margin: 0; font-size: 14px; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }

.op-result { margin-top: 14px; min-height: 20px; }
.op-result.is-error { color: var(--danger); }
.op-result.is-ok { color: var(--ok); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  z-index: 50;
}

.toast.is-error { border-color: rgba(217, 74, 74, .55); color: #ff9a9a; }
.toast.is-ok { border-color: rgba(47, 191, 113, .5); color: #7ee2a8; }

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; margin-left: 0; }
  .wrap { padding: 14px 12px 50px; }
}
