:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d26;
  --muted: #5c6578;
  --border: #e2e5eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--primary);
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.main-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 2rem);
}

.main-padded {
  padding-top: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 420px;
}

.card-wide {
  max-width: 720px;
}

.card-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 650;
}

.h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 650;
}

.h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

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

.small {
  font-size: 0.875rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.25rem 0 0.75rem;
}

.label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0.75rem 0 0.35rem;
}

.input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}

.input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  border-color: var(--primary);
}

.input-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  font-size: 1.25rem;
  text-align: center;
}

.textarea {
  resize: vertical;
  min-height: 200px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.fieldset {
  border: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}

.btn-ghost:hover {
  background: var(--bg);
}

.btn-danger {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff;
}

.btn-danger:hover {
  background: #fef2f2;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
  margin-top: 1rem;
}

.alert {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.empty {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.url-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  word-break: break-all;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.inline-form {
  display: inline;
}

code {
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .table th:nth-child(3),
  .table td:nth-child(3) {
    display: none;
  }
}
