:root {
  --bg: #0c1222;
  --bg-soft: #111a2d;
  --panel: #1c283a;
  --panel-soft: #121a2b;
  --line: #25415a;
  --line-soft: rgba(63, 95, 129, 0.35);
  --text: #f6fbff;
  --muted: #8ea5c7;
  --green: #14c58d;
  --green-2: #0fb07d;
  --blue: #4985ff;
  --blue-2: #3c72db;
  --yellow: #ffb328;
  --yellow-2: #f09605;
  --red: #ff5656;
  --red-2: #e64242;
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top, rgba(20, 197, 141, 0.08), transparent 24%),
    linear-gradient(180deg, #10192b 0%, #0c1222 100%);
}

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

.hero-banner {
  background: linear-gradient(180deg, #118860 0%, #0e8f67 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 16px;
}

.hero-center {
  text-align: center;
}

.hero-center h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero-center p {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(237, 255, 248, 0.84);
}

.dashboard-shell {
  width: min(1260px, calc(100vw - 24px));
  margin: 16px auto 36px;
}

.auth-card,
.panel,
.modal-card,
.inner-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.auth-card {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 28px;
  text-align: center;
}

.auth-card h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.auth-copy {
  max-width: 680px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

.auth-card input {
  max-width: 460px;
  margin: 0 auto 16px;
}

.auth-actions {
  justify-content: center;
}

.content-shell {
  display: grid;
  gap: 14px;
}

.content-shell.is-hidden,
.auth-shell.is-hidden {
  display: none;
}

.dashboard-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 2px;
}

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-button {
  min-width: 118px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: 1px solid #27425c;
  background: #172235;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tab-button.active {
  background: linear-gradient(180deg, var(--green) 0%, var(--green-2) 100%);
  border-color: transparent;
  color: #fff;
}

.tab-button:hover {
  border-color: #3a6587;
  color: #dfeeff;
}

.tab-panel {
  display: none;
  padding: 22px;
}

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

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.section-head h2,
.inner-panel h3 {
  margin: 0;
  font-size: 18px;
  color: #dff8ff;
}

.subtle,
.empty-state {
  color: var(--muted);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

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

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 36px;
  line-height: 1;
  color: var(--green);
}

.metric-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.12em;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}

.filter-field,
.stack-row {
  display: grid;
  gap: 8px;
}

.filter-field span,
.stack-row span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.filter-field {
  min-width: 260px;
}

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

.stack-row--wide {
  grid-column: 1 / -1;
}

.info-box {
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-soft);
  background: var(--panel-soft);
}

.info-box p {
  margin: 0 0 10px;
  line-height: 1.7;
}

.info-box p:last-child {
  margin-bottom: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid #334f6a;
  background: #101828;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #7088aa;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(20, 197, 141, 0.72);
  box-shadow: 0 0 0 3px rgba(20, 197, 141, 0.12);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(180deg, var(--green) 0%, var(--green-2) 100%);
}

.btn-secondary {
  background: #233048;
  border-color: #33516e;
  color: var(--muted);
}

.btn-warning {
  background: linear-gradient(180deg, var(--yellow) 0%, var(--yellow-2) 100%);
  color: #2b1900;
}

.btn-danger {
  background: linear-gradient(180deg, var(--red) 0%, var(--red-2) 100%);
}

.btn-blue {
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-2) 100%);
}

.btn-ghost-danger {
  background: transparent;
  border-color: rgba(255, 86, 86, 0.3);
  color: #ffb8b8;
}

.btn-top-logout {
  min-height: 38px;
  padding: 0 16px;
}

.table-shell {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  font-size: 13px;
}

th {
  color: #77efd0;
  font-size: 12px;
  letter-spacing: 0.08em;
}

td code {
  color: #8beecf;
  font-family: Consolas, monospace;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
}

.status-badge.active {
  background: rgba(20, 197, 141, 0.16);
  color: #89f1cf;
}

.status-badge.inactive,
.status-badge.expired,
.status-badge.suspended,
.status-badge.revoked {
  background: rgba(255, 86, 86, 0.16);
  color: #ffb0b0;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-actions .btn {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.history-stack {
  display: grid;
  gap: 10px;
}

.history-item {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-soft);
  background: var(--panel-soft);
}

.history-item strong {
  display: block;
  margin-bottom: 4px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 16, 0.74);
  z-index: 50;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-card {
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 22px;
}

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

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

.inner-panel {
  padding: 18px;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .dashboard-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-row,
  .form-grid,
  .modal-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .dashboard-shell {
    width: min(100vw - 12px, 100%);
    margin: 12px auto 24px;
  }

  .auth-card,
  .panel,
  .modal-card,
  .inner-panel {
    padding: 16px;
  }

  .dashboard-topbar {
    gap: 12px;
  }

  .stats-row,
  .form-grid,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .btn-top-logout {
    width: 100%;
  }

  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-field {
    min-width: 0;
  }

  table {
    min-width: 780px;
  }
}
