:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #687385;
  --line: #dfe4ea;
  --accent: #2563eb;
  --accent-2: #059669;
  --danger: #dc2626;
  --warn: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

a {
  color: inherit;
}

.landing,
.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.admin-shell {
  width: calc(100% - 32px);
  max-width: none;
}

.landing {
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.landing section {
  max-width: 620px;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 40px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0;
}

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

.brand strong {
  font-size: 20px;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

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

.tabs {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 12px 8px;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  color: var(--accent);
  border-color: var(--accent);
}

.button,
button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.button.secondary,
button.secondary {
  background: white;
  color: var(--accent);
}

button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

button.icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

button.danger-text {
  color: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.list-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px;
  gap: 12px;
  margin-top: 14px;
  align-items: end;
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.secret-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.secret-card span,
.secret-card strong {
  grid-column: 1;
}

.secret-card button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.masked-value {
  color: var(--text);
  letter-spacing: 2px;
}

.form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 8px 10px;
}

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

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

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

.admin-shell table {
  min-width: 1040px;
}

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

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

.status {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
}

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

.status.ok {
  color: var(--accent-2);
}

.login-box {
  width: min(420px, calc(100% - 32px));
  margin: 12vh auto 0;
}

.hidden {
  display: none !important;
}

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

.code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  word-break: break-all;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
}

.badge.off {
  background: #f1f5f9;
  color: #64748b;
}

.settings-wrap {
  position: relative;
}

.action-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12;
  width: 180px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16);
}

.action-menu button {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
}

.action-menu button:hover {
  background: #f1f5f9;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 56px rgba(15, 23, 42, 0.2);
}

.confirm-modal {
  width: min(440px, 100%);
}

.confirm-message {
  margin: 0;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.modal-section:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.modal-wide {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.inline-actions {
  align-items: center;
}

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

.table-actions {
  gap: 8px;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 32px;
  }

  .panel {
    padding: 14px;
  }

  .list-controls {
    grid-template-columns: 1fr;
  }
}
