:root {
  --bg: #fbfbfa;
  --panel: #ffffff;
  --panel-soft: #f4f4f1;
  --border: #d9d9d4;
  --text: #151712;
  --muted: #60665d;
  --dim: #8d9386;
  --accent: #0f7a5f;
  --accent-soft: #e2f2ea;
  --danger: #b42318;
  --danger-soft: #fff0ed;
}

* {
  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;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: none;
  height: 64px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(247, 247, 244, 0.92);
  padding: 0 24px;
  backdrop-filter: blur(16px);
}

body.signed-in .topbar {
  display: flex;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
}

.mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 45%, var(--panel) 45% 55%, transparent 55%),
    linear-gradient(var(--text), var(--text));
}

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

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 32px 20px 48px;
}

body:not(.signed-in) .shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 44px 20px;
}

.auth-card {
  width: min(960px, 100%);
  margin: 0 auto;
  text-align: center;
}

.avatar {
  width: clamp(118px, 11vw, 172px);
  aspect-ratio: 1;
  display: block;
  margin: 0 auto 42px;
  border-radius: 18px;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 22px 46px rgba(21, 23, 18, 0.14);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(52px, 6.3vw, 76px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
}

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

.slogan {
  width: min(980px, 100%);
  margin: 0 auto 48px;
  color: #050505;
  font-size: clamp(27px, 3.35vw, 50px);
  line-height: 1.18;
  letter-spacing: 0;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary,
.ghost,
.link-button {
  min-height: 38px;
  border-radius: 7px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--text);
  background: var(--text);
  color: var(--panel);
  font-weight: 700;
  padding: 0 14px;
}

.primary:hover {
  background: #000000;
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-weight: 650;
  padding: 0 12px;
}

.ghost:hover {
  border-color: var(--dim);
  color: var(--text);
}

.link-button {
  margin-top: 16px;
  border: 0;
  background: transparent;
  color: #525252;
  font-weight: 700;
  padding: 0;
}

.error {
  border: 1px solid #ffc7bd;
  border-radius: 7px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 12px;
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.auth-form {
  width: min(900px, 100%);
  margin: 0 auto;
}

.auth-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.55fr) auto;
  align-items: center;
  min-height: 96px;
  border: 4px solid #2b2b2b;
  border-radius: 999px;
  background: #ffffff;
  padding: 8px;
}

.auth-combo input {
  height: 72px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #050505;
  font-size: clamp(20px, 2.4vw, 38px);
  padding: 0 26px;
  appearance: none;
}

.auth-combo input::placeholder {
  color: #111111;
  opacity: 1;
}

.auth-combo input:focus {
  box-shadow: none;
}

.auth-combo input + .sr-only + input {
  border-left: 1px solid rgba(0, 0, 0, 0.14);
}

.auth-combo .primary {
  min-width: clamp(160px, 18vw, 260px);
  min-height: 76px;
  border-radius: 999px;
  border: 0;
  background: #000000;
  color: #ffffff;
  font-size: clamp(20px, 2.2vw, 34px);
  font-weight: 500;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat,
.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.stat {
  padding: 18px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.stat strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
  line-height: 1;
}

.panel-title {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
}

.pad {
  padding: 18px;
}

.payload-list,
.key-list {
  display: grid;
}

.payload {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  padding: 18px;
}

.payload:last-child,
.key-row:last-child {
  border-bottom: 0;
}

.meta {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.meta strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

pre {
  max-height: 420px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 14px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty {
  padding: 28px 18px;
  color: var(--muted);
}

.payload-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.visibility-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.visibility-badge.private {
  background: var(--danger-soft);
  color: var(--danger);
}

.tags-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(15, 122, 95, 0.35);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 4px 3px 10px;
  font-size: 12px;
  font-weight: 700;
}

.tag-chip-label {
  line-height: 1;
}

.tag-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.tag-chip-remove:hover {
  background: rgba(15, 122, 95, 0.18);
}

.tag-add-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 2px 4px 2px 10px;
  background: var(--panel);
}

.tag-add-form:focus-within {
  border-color: var(--accent);
  border-style: solid;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tag-add-input {
  width: 110px;
  height: 22px;
  border: 0;
  background: transparent;
  font-size: 12px;
  padding: 0;
}

.tag-add-input:focus {
  outline: none;
  box-shadow: none;
}

.tag-add-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.tag-add-submit:hover {
  color: var(--accent);
}

.tag-error {
  font-size: 12px;
  color: var(--danger);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.filter-bar-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.filter-bar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.filter-chip:hover {
  border-color: var(--dim);
  color: var(--text);
}

.filter-chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--panel);
}

#filter-clear {
  height: 28px;
  min-height: 28px;
  font-size: 12px;
  padding: 0 12px;
}

#filter-count {
  font-size: 12px;
  margin-left: auto;
}

.view-tabs {
  display: inline-flex;
  align-self: start;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
  padding: 3px;
  gap: 2px;
}

.view-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
}

.view-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(21, 23, 18, 0.08);
}

.view-pane {
  min-width: 0;
}

.links-summary {
  margin-bottom: 4px;
}

.links-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.links-tag {
  display: inline-flex;
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}

.links-tag.muted {
  color: var(--muted);
  font-weight: 500;
}

.links-tag.warn {
  color: #8a4b00;
  background: #fff3df;
}

.image-view {
  display: flex;
  justify-content: center;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
}

.image-view-link {
  display: inline-flex;
  max-width: 100%;
  line-height: 0;
}

.image-view-img {
  max-width: 100%;
  max-height: 480px;
  height: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(21, 23, 18, 0.08);
}

.text-view {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.text-actions {
  display: flex;
  justify-content: flex-end;
}

.text-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.text-copy:hover {
  background: var(--panel-soft);
}

.text-copy.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.text-copy.error {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.meta-actions {
  margin-top: 4px;
}

.submission-delete {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--danger);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.submission-delete:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.submission-delete:disabled {
  opacity: 0.7;
  cursor: progress;
}

.text-body {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

.links-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px 16px;
}

.links-item.visited {
  background: var(--panel);
  border-style: dashed;
}

.links-item.visited .links-url {
  color: var(--muted);
}

.links-item.collapsed .links-text {
  display: none;
}

.links-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.links-url {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  word-break: break-all;
  text-decoration: none;
}

.links-url:hover {
  text-decoration: underline;
}

.links-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
}

.links-toggle:hover {
  border-color: var(--dim);
  color: var(--text);
}

.links-toggle .when-expanded {
  display: inline;
}

.links-toggle .when-collapsed {
  display: none;
}

.links-item.collapsed .links-toggle .when-expanded {
  display: none;
}

.links-item.collapsed .links-toggle .when-collapsed {
  display: inline;
}

.links-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.links-text a {
  color: var(--accent);
}

.links-text code {
  display: inline;
  margin: 0;
  padding: 1px 5px;
  background: var(--panel);
  font-size: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
}

.new-key {
  margin-top: 16px;
  border: 1px solid rgba(15, 122, 95, 0.25);
  border-radius: 8px;
  background: var(--accent-soft);
  padding: 12px;
}

.new-key span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

code {
  display: block;
  overflow-wrap: anywhere;
  margin: 8px 0 12px;
  border-radius: 7px;
  background: var(--panel);
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.key-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
}

.key-row .title {
  margin: 0 0 4px;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 3px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.revoked {
  background: var(--danger-soft);
  color: var(--danger);
  font-family: inherit;
  font-weight: 700;
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 14px;
  }

  .shell {
    padding: 24px 14px 40px;
  }

  body:not(.signed-in) .shell {
    align-items: start;
    padding-top: 64px;
  }

  .nav button span + text,
  .nav .ghost {
    min-width: 38px;
  }

  .page-head,
  .panel-title,
  .key-row {
    align-items: stretch;
    flex-direction: column;
  }

  .stats,
  .payload,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    margin-top: 0;
  }

  .avatar {
    margin-bottom: 28px;
    width: 112px;
    border-radius: 16px;
  }

  h1 {
    font-size: 44px;
  }

  .slogan {
    margin-bottom: 30px;
    font-size: 28px;
    line-height: 1.2;
  }

  .auth-combo {
    grid-template-columns: 1fr;
    gap: 2px;
    min-height: 0;
    border-width: 3px;
    border-radius: 30px;
    padding: 8px;
  }

  .auth-combo input {
    height: 54px;
    font-size: 20px;
    padding: 0 18px;
  }

  .auth-combo input + .sr-only + input {
    border-left: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.14);
  }

  .auth-combo .primary {
    width: 100%;
    min-height: 56px;
    font-size: 22px;
  }
}
