:root {
  --bg: #111214;
  --bg-elevated: #17191d;
  --bg-soft: #1d2025;
  --line: #2a2e36;
  --line-strong: #343945;
  --text: #eef1f5;
  --muted: #99a2b2;
  --accent: #d18b47;
  --accent-strong: #e4a468;
  --danger: #d36a6a;
  --success: #7ec27a;
  --panel-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  font-family: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

body[data-mode="guest"] {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    var(--bg);
}

.login-screen {
  width: min(100%, 420px);
}

.login-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: var(--panel-shadow);
  padding: 24px;
}

.identity-row,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #20232a;
  color: var(--accent-strong);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
}

.title-line {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.copy-line,
.muted,
.sidebar-label {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.form-stack {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-size: 0.93rem;
}

input,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #121419;
  color: var(--text);
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(209, 139, 71, 0.16);
  border-color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button-primary {
  background: var(--accent);
  color: #17120d;
}

.button-primary:hover {
  background: var(--accent-strong);
}

.button-secondary {
  background: #1a1d22;
  border-color: var(--line-strong);
  color: var(--text);
}

.button-secondary:hover {
  background: #20242b;
}

.button-danger {
  background: transparent;
  border-color: rgba(211, 106, 106, 0.35);
  color: #f1b1b1;
}

.button-danger:hover {
  background: rgba(211, 106, 106, 0.1);
}

.notice {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
}

.notice-error {
  color: #f1b1b1;
  border-color: rgba(211, 106, 106, 0.35);
  background: rgba(211, 106, 106, 0.08);
}

.notice-warn {
  background: rgba(209, 139, 71, 0.08);
  border-color: rgba(209, 139, 71, 0.28);
}

.notice code,
code,
.code-block {
  font-family: "JetBrains Mono", monospace;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 22px;
  background: #121418;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: #1d2026;
}

.sidebar-block {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17191d;
}

.sidebar-label,
.sidebar-value {
  margin: 0;
}

.sidebar-value {
  margin-top: 6px;
  color: var(--text);
}

.main {
  padding: 28px;
}

.toolbar,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.toolbar {
  margin-bottom: 24px;
}

.toolbar h1,
.panel h2 {
  margin: 0;
  font-weight: 700;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-badge {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #17191d;
  color: var(--muted);
}

.view-section {
  display: grid;
  gap: 20px;
}

.overview-grid,
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: var(--panel-shadow);
}

.key-value-list {
  display: grid;
  gap: 16px;
  margin: 18px 0 0;
}

.key-value-list div {
  display: grid;
  gap: 4px;
}

.key-value-list dt {
  color: var(--muted);
}

.key-value-list dd {
  margin: 0;
}

.code-block {
  margin: 18px 0 0;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #111318;
  color: #d7dde7;
  overflow-x: auto;
  line-height: 1.6;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #242830;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid currentColor;
  font-size: 0.88rem;
}

.status-active {
  color: var(--success);
}

.status-revoked {
  color: var(--danger);
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-button {
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.steps {
  margin: 18px 0 0;
  padding-left: 18px;
  line-height: 1.7;
  color: var(--text);
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .overview-grid,
  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body[data-mode="guest"] {
    padding: 16px;
  }

  .main {
    padding: 18px;
  }

  .toolbar,
  .section-head {
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }
}
