:root {
  --bg: #0f1220;
  --panel: #1a1f35;
  --panel-2: #232a48;
  --border: #2e3658;
  --text: #e8eaf6;
  --muted: #9aa3c7;
  --accent: #4f7cff;
  --accent-2: #3b5fd9;
  --green: #34d399;
  --red: #f87171;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: .3px; }

.container { max-width: 1120px; margin: 24px auto; padding: 0 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 26px;
}

h2 { margin: 0 0 16px; font-size: 20px; }
h2 .count { color: var(--muted); font-weight: 400; font-size: 15px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.field small { color: var(--muted); font-weight: 400; }
.field input[type="text"],
.field input[type="password"],
.field input[type="datetime-local"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}
.field input:focus { outline: none; border-color: var(--accent); }
.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #2c3557; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #5b3040; }
.btn.danger:hover { background: #3a1f2b; }
.btn.sm { padding: 6px 10px; font-size: 12px; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.flash-ok { background: #123326; color: var(--green); border: 1px solid #1f5c45; }
.flash-err { background: #3a1f24; color: var(--red); border: 1px solid #5c2b33; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
td.url { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td code { background: var(--panel-2); padding: 3px 7px; border-radius: 6px; font-size: 13px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form.inline { display: inline; margin: 0; }

.qr { background: #fff; display: inline-block; border-radius: 6px; padding: 4px; line-height: 0; }
.qr svg { display: block; }

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

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box .field { margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: min(380px, 100%); }
.login-card h1 { font-size: 22px; margin: 0 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 18px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; }
.error { color: var(--red); font-size: 13px; margin: 0 0 12px; }
