@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --paper: #F6F5F1;
  --panel: #FFFFFF;
  --ink: #17211D;
  --accent: #2F6F4E;
  --accent-soft: #E4EFE8;
  --muted: #767E78;
  --border: #E1DFD6;
  --danger: #B3452C;
  --danger-soft: #F6E7E2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.brand .glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-size: 16px;
  transform: translateY(-1px);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.topbar-right a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

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

.page-head h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.btn.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

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

thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 14px;
}

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

.slug {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--accent);
}

.slug::before {
  content: '/';
  color: var(--muted);
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.dest {
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

.count {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.row-actions {
  display: flex;
  gap: 14px;
  font-size: 13px;
}

.row-actions a, .row-actions button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}

.row-actions a:hover, .row-actions button:hover, .row-actions .danger-link:hover {
  color: var(--ink);
}

.row-actions .danger-link:hover { color: var(--danger); }

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state .glyph-big {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  color: var(--border);
  margin-bottom: 8px;
}

form.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 480px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type=text], input[type=url] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  background: var(--paper);
  color: var(--ink);
}

input[type=text]:focus, input[type=url]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.flash {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
}

.flash.success {
  background: var(--accent-soft);
  color: var(--accent);
}

.flash.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover { color: var(--ink); }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  width: 320px;
}

.login-card .glyph {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.login-card h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  margin: 0 0 8px;
}

.login-card p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.error-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.error-screen .code {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 56px;
  font-weight: 700;
  color: var(--border);
}

.error-screen .message {
  color: var(--muted);
  font-size: 15px;
}
