:root {
  --paper: #f3efe6;
  --ink: #1f1a17;
  --muted: #5e564e;
  --line: #ddd4c6;
  --card: #fffdf8;
  --teal: #0e5c56;
  --teal-deep: #083f3b;
  --warn: #8a5a12;
  --warn-bg: #f8ecd4;
  --danger: #8d2b2b;
  --danger-bg: #f8e4e0;
  --ok-bg: #e5f2ea;
  --ok: #1d6b3a;
  --shadow: 0 1px 0 rgba(31, 26, 23, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.45 "Segoe UI", "Helvetica Neue", sans-serif;
}

a { color: var(--teal-deep); }

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #faf7f1;
}

.mark {
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 28px;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}

nav a, button.text {
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  padding: 6px 0;
  cursor: pointer;
}

nav a:hover, button.text:hover { color: var(--teal); }

main {
  width: min(880px, calc(100% - 32px));
  margin: 28px auto 64px;
}

h1, h2 {
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

h1 { font-size: 36px; }
h2 { font-size: 22px; margin-top: 28px; }

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

.card, .item, .stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.card { padding: 20px; }

.stack { display: grid; gap: 14px; }

label { display: block; font-size: 14px; margin-bottom: 4px; }

input[type="text"], input[type="password"], input[type="url"], input[type="number"] {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #cfc4b4;
  background: white;
  color: var(--ink);
}

input:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid #c7e4e1;
  outline-offset: 2px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

button, .button {
  font: inherit;
  background: var(--teal);
  color: #f6fffe;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button.secondary, .button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid #cfc4b4;
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid #e3c2bc;
}

.check { display: flex; gap: 8px; align-items: center; }
.check input { width: auto; }

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin: 0 0 16px;
}

.flash.info { background: var(--ok-bg); color: var(--ok); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash.error { background: var(--danger-bg); color: var(--danger); }

.list { display: grid; gap: 10px; margin-top: 16px; }

.item {
  display: grid;
  grid-template-columns: 128px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
}

.item img, .thumb {
  width: 128px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #efe8dc;
}

.item h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.badge {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 8px;
  background: #efe8dc;
  color: var(--muted);
}
.badge.warn { background: var(--warn-bg); color: var(--warn); }

.profiles { display: grid; gap: 12px; }
.profile-link {
  display: block;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
}
.profile-link strong { font-size: 20px; }

.qr { width: min(240px, 100%); height: auto; background: white; padding: 8px; }
.token {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
  background: #f7f3ec;
  padding: 10px 12px;
  border-radius: 8px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }

main:has(.login) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  width: min(420px, calc(100% - 32px));
  margin: 0 auto;
}

.login {
  width: 100%;
  margin: 0;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 680px) {
  h1 { font-size: 30px; }
  .top { padding: 14px 12px; }
  nav { gap: 4px 14px; }
  .item { grid-template-columns: 1fr; }
  .item img, .thumb { width: 100%; height: 160px; }
  main { width: min(880px, calc(100% - 20px)); }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin: 0 0 10px;
    padding: 8px 4px;
  }
  td { border: 0; padding: 6px 10px; }
  td::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: var(--muted);
  }
}
