:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2430;
  --muted: #667085;
  --line: #d7dce3;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warn-bg: #fff7e6;
  --error-bg: #fff1f0;
  --success-bg: #ecfdf3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 0 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
}

nav {
  display: flex;
  flex: 1;
  gap: 18px;
}

.logout {
  margin-left: auto;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.headline,
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.headline {
  align-items: start;
  flex-direction: column;
  gap: 4px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

p {
  margin: 0;
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.metrics div,
.auth-panel,
.form,
table,
.messages {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics div {
  padding: 18px;
}

.metrics strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.metrics span {
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

pre,
code {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

pre {
  margin: 0;
}

.auth-panel {
  width: min(440px, 100%);
  margin: 56px auto;
  padding: 26px;
}

.auth-panel h1 {
  margin-bottom: 18px;
}

.form {
  padding: 22px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  font: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.email-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.email-field:focus-within {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.email-field input {
  border: 0;
}

.email-field input:focus {
  outline: 0;
}

.email-field span {
  padding: 0 11px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.check input {
  width: auto;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

.ghost {
  background: #fff;
  color: var(--accent);
}

.ghost:hover {
  background: #edf7f5;
}

.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.actions form {
  display: inline-flex;
}

.inline-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
}

.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.link-button:hover {
  background: transparent;
  text-decoration: underline;
}

.messages {
  display: grid;
  gap: 8px;
  padding: 10px;
  margin-bottom: 18px;
}

.message {
  border-radius: 6px;
  padding: 10px 12px;
}

.message.error {
  background: var(--error-bg);
  color: var(--danger);
}

.message.success {
  background: var(--success-bg);
  color: #027a48;
}

.message.secret {
  background: var(--warn-bg);
  color: #8a5600;
  overflow-wrap: anywhere;
}

.modal {
  width: min(680px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(28, 36, 48, 0.28);
}

.modal::backdrop {
  background: rgba(28, 36, 48, 0.42);
}

.modal[open] {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-head form {
  display: inline-flex;
}

.secret-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.secret-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.secret-list dd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fafb;
}

.secret-list code {
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  nav {
    flex-wrap: wrap;
  }

  .logout {
    margin-left: 0;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
