:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #647086;
  --line: #dce2ec;
  --brand: #1769e0;
  --brand-strong: #0f55ba;
  --good: #14835f;
  --bad: #bf3f3f;
  --warn: #9a6a11;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  align-items: center;
  background: #111827;
  color: #fff;
  display: flex;
  justify-content: space-between;
  padding: 22px clamp(18px, 4vw, 46px);
}

.topbar h1,
.topbar p,
h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 28px;
  font-weight: 800;
}

.topbar p {
  color: #b9c2d3;
  margin-top: 3px;
}

.docs-link {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  color: #fff;
  padding: 8px 12px;
  text-decoration: none;
}

.top-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-name {
  color: #d8deea;
  font-size: 13px;
}

.ghost-btn {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.ghost-btn:hover {
  border-color: rgba(255, 255, 255, 0.55);
}

.layout {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1280px;
  padding: 22px clamp(14px, 3vw, 34px) 42px;
}

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

.panel {
  padding: 18px;
}

.panel-head,
.toolbar,
.dialog-head,
.actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.hint,
.message {
  color: var(--muted);
  font-size: 13px;
}

.message.error {
  color: var(--bad);
}

.message.success {
  color: var(--good);
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.form-grid.compact {
  margin-top: 0;
}

.span-2 {
  grid-column: span 2;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 6px;
}

input {
  background: #fff;
  border: 1px solid #cbd4e1;
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 40px;
  padding: 9px 11px;
  width: 100%;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.14);
  outline: none;
}

button {
  background: #fff;
  border: 1px solid #c5cede;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  min-height: 38px;
  padding: 8px 12px;
}

button:hover {
  border-color: #97a6bc;
}

button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
}

button.primary:hover {
  background: var(--brand-strong);
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
  padding: 16px;
}

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

.stat strong {
  display: block;
  font-size: 30px;
  margin-top: 6px;
}

.search {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: min(100%, 460px);
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 980px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.short-code {
  color: var(--brand);
  display: block;
  font-weight: 800;
  text-decoration: none;
}

.url,
.meta {
  color: var(--muted);
  font-size: 12px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title {
  font-weight: 700;
  margin-bottom: 4px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.tag,
.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  padding: 4px 8px;
}

.tag {
  background: #eef2f7;
  color: #445166;
}

.status.active {
  background: #e8f6f0;
  color: var(--good);
}

.status.inactive {
  background: #faecec;
  color: var(--bad);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 220px;
}

.row-actions button {
  min-height: 32px;
  padding: 5px 8px;
}

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

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
  max-width: 720px;
  padding: 0;
  width: calc(100% - 28px);
}

dialog::backdrop {
  background: rgba(17, 24, 39, 0.56);
}

#editForm {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.icon-btn {
  border: 0;
  font-size: 24px;
  min-height: 32px;
  padding: 0 8px;
}

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

.check-row input {
  min-height: 0;
  width: auto;
}

.login-body {
  background: #eef2f7;
  min-height: 100vh;
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.login-brand {
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  padding-bottom: 18px;
}

.login-brand h1 {
  font-size: 30px;
  margin: 0;
}

.login-brand p {
  color: var(--muted);
  margin: 4px 0 0;
}

.login-form {
  display: grid;
  gap: 14px;
}

@media (max-width: 760px) {
  .topbar,
  .toolbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .search {
    width: 100%;
  }
}
