:root {
  --bg: #0b0f14;
  --bg-2: #111820;
  --surface: #151d27;
  --surface-2: #1b2531;
  --line: rgba(212, 180, 90, 0.16);
  --line-strong: rgba(232, 238, 246, 0.1);
  --text: #e8eef6;
  --muted: #8d9aab;
  --gold: #d4b45a;
  --gold-2: #f0d48a;
  --green: #4ec99a;
  --red: #e06a6a;
  --blue: #6aa4d8;
  --orange: #e0a15a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --sidebar: 248px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}
body {
  background-image:
    radial-gradient(1200px 500px at 10% -10%, rgba(212, 180, 90, 0.08), transparent 50%),
    radial-gradient(900px 400px at 100% 0%, rgba(106, 164, 216, 0.08), transparent 45%);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
.hidden,
[hidden] {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.kicker {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
  margin: 0 0 8px;
}
code,
.mono {
  font-family: var(--mono);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.login-mark,
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #0b0f14;
  border: 1px solid var(--gold);
  color: var(--gold-2);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}
.login-card form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}
.field {
  display: grid;
  gap: 6px;
}
.field input,
.field textarea,
.card label > input,
.card label > select,
.card label > textarea {
  width: 100%;
}
.field label,
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
input,
select,
textarea {
  background: #0b0f14;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  min-height: 44px;
}
input::placeholder {
  color: #6b7787;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e8eef6;
  caret-color: #e8eef6;
  box-shadow: 0 0 0 1000px #0b0f14 inset;
  transition: background-color 9999s ease-out;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
}
.form-error {
  color: var(--red);
  font-size: 13px;
  margin: 0;
}

.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 500;
}
.btn:hover {
  border-color: var(--gold);
}
.btn.primary {
  background: var(--gold);
  color: #16120a;
  border-color: var(--gold);
  font-weight: 600;
}
.btn.danger {
  background: rgba(224, 106, 106, 0.12);
  border-color: rgba(224, 106, 106, 0.4);
  color: #ffc4c4;
}
.btn.ghost {
  background: transparent;
}
.btn.block {
  width: 100%;
}
.btn.sm {
  padding: 6px 10px;
  font-size: 13px;
}
.icon-btn {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(11, 15, 20, 0.88);
  backdrop-filter: blur(12px);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.sidebar nav {
  display: grid;
  gap: 4px;
}
.sidebar nav a {
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--surface);
  color: var(--text);
}
.sidebar nav a.active {
  box-shadow: inset 2px 0 0 var(--gold);
}
.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}
.who small {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.main {
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 28px 8px;
}
.topbar h2 {
  margin: 0;
  font-size: 22px;
}
.topbar p {
  margin: 4px 0 0;
  font-size: 13px;
}
.top-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}
.view {
  padding: 16px 28px 40px;
}

.grid {
  display: grid;
  gap: 14px;
}
.kpis {
  grid-template-columns: repeat(4, 1fr);
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.kpi .value {
  font-size: 28px;
  font-weight: 700;
}
.kpi .hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}
.pill.idle {
  background: var(--surface-2);
  color: var(--muted);
}
.pill.trial {
  background: rgba(224, 161, 90, 0.12);
  color: var(--orange);
}
.pill.allowed {
  background: rgba(78, 201, 154, 0.12);
  color: var(--green);
}
.pill.blocked,
.pill.expired {
  background: rgba(224, 106, 106, 0.12);
  color: var(--red);
}
.pill.running {
  background: rgba(106, 164, 216, 0.14);
  color: var(--blue);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar input,
.toolbar select {
  width: auto;
  min-width: 180px;
  flex: 1 1 180px;
  max-width: 280px;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  accent-color: var(--gold);
}
.spark {
  width: 100%;
  height: 148px;
  display: block;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  background: var(--bg-2);
  position: sticky;
  top: 0;
}
tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.row-click {
  cursor: pointer;
}

.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.split {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 14px;
}
.list {
  display: grid;
  gap: 10px;
}
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-strong);
}
.progress {
  height: 8px;
  background: #0b0f14;
  border-radius: 99px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
}

.drawer,
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.62);
  z-index: 30;
}
.drawer:not([hidden]) {
  display: flex;
  justify-content: flex-end;
}
.modal:not([hidden]) {
  display: grid;
  place-items: center;
  padding: 20px;
}
.drawer-panel,
.modal-panel {
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  width: min(460px, 100%);
  height: 100%;
  overflow: auto;
  padding: 22px;
}
.modal-panel {
  width: min(480px, 100%);
  height: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 50;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 240px;
  box-shadow: var(--shadow);
}
.toast.bad {
  border-color: rgba(224, 106, 106, 0.5);
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .kpis,
  .split {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 820px) {
  .icon-btn {
    display: inline-grid;
    place-items: center;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    z-index: 20;
    transform: translateX(-105%);
    transition: 0.2s transform;
  }
  .sidebar.open {
    transform: none;
  }
  .kpis,
  .split {
    grid-template-columns: 1fr;
  }
  .view,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}
