:root {
  --brand: #A71374;
  --accent: #D61393;
  --cream: #FFEADE;
  --ink: #2C2C2A;
  --muted: #5F5E5A;
  --faint: #B4B2A9;
  --panel: #F3EFEC;
  --line: #D3D1C7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #faf8f6;
  color: var(--ink);
  font-family: 'RF Dewi', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px; }

/* ---- masthead ---- */
.masthead {
  background: var(--brand);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.masthead__blob {
  position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: var(--accent); opacity: 0.5;
}
.masthead__row {
  position: relative; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.masthead__eyebrow {
  font-size: 13px; color: var(--cream); letter-spacing: 0.04em;
  text-transform: uppercase; margin-bottom: 6px;
}
.masthead h1 { font-size: 26px; font-weight: 700; color: #fff; margin: 0; }
.masthead__sub {
  font-style: italic; font-family: Georgia, serif; font-size: 14px;
  color: var(--cream); margin-top: 4px;
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip__ava {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
  object-fit: cover; flex-shrink: 0;
}
.user-chip__name { color: #fff; font-size: 13px; }
.user-chip__action {
  color: var(--cream); font-size: 12px; text-decoration: none;
  border: 0.5px solid rgba(255, 255, 255, 0.4); border-radius: 12px;
  padding: 3px 10px; margin-left: 4px;
}
.user-chip__action:hover { background: rgba(255, 255, 255, 0.12); }
.login-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: var(--brand); text-decoration: none;
  font-size: 13px; font-weight: 500; padding: 8px 16px; border-radius: 20px;
}
.login-btn:hover { filter: brightness(0.96); }
.login-btn i { font-size: 15px; }

/* ---- message page ---- */
.message-card {
  background: #fff; border: 0.5px solid var(--line); border-radius: 16px;
  padding: 32px; max-width: 520px; margin: 40px auto; text-align: center;
}
.message-card h1 { font-size: 20px; margin: 0 0 12px; color: var(--ink); }
.message-card p { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 0 0 20px; }
.message-card__home { color: var(--accent); text-decoration: none; font-size: 14px; }

/* ---- admin ---- */
.admin-nav {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 0 18px; border-bottom: 0.5px solid var(--line); margin-bottom: 22px;
  font-size: 14px;
}
.admin-nav__brand { font-weight: 700; color: var(--brand); }
.admin-nav a { color: var(--muted); text-decoration: none; }
.admin-nav a:hover { color: var(--accent); }
.admin-nav__back { margin-left: auto; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-head h1, .wrap h1 { font-size: 22px; }
.wrap h2 { font-size: 17px; margin-top: 28px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.92em; }
.muted { color: var(--faint); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 0.5px solid var(--line); }
.admin-table td { padding: 10px; border-bottom: 0.5px solid #ECEAE3; vertical-align: middle; }
.admin-table__actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.admin-table .empty { text-align: center; color: var(--muted); }

.tag { font-size: 11px; padding: 3px 9px; border-radius: 10px; background: var(--panel); color: var(--muted); }
.tag--ext { background: #E7ECFF; color: #1B2C6B; }
.tag--admin { background: #FFE8EC; color: #993556; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: #fff; color: var(--ink); border: 0.5px solid var(--line);
  border-radius: 8px; padding: 9px 14px; font-size: 14px; font-family: inherit;
  text-decoration: none;
}
.btn:hover { border-color: var(--faint); }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { filter: brightness(1.05); }
.btn--danger { color: #c0143c; }
.btn--danger:hover { background: #FFF0F3; }
.btn--sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.form input, .form select, .form textarea, .form--inline input {
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: #fff; border: 0.5px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid__wide { grid-column: 1 / -1; }
.kind-toggle { border: 0.5px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.kind-toggle legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.kind-toggle .radio { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.form-error { background: #FFF0F3; color: #c0143c; border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.form-ok { background: #E7F8EC; color: #1E6B33; border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.hint { font-size: 12px; color: var(--faint); line-height: 1.5; }

.form--inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; border: 0.5px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.cat-row .ti { color: var(--accent); }

@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* ---- chips ---- */
.chips { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chip {
  background: var(--panel); color: var(--muted); font-size: 13px;
  padding: 6px 14px; border-radius: 20px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit; line-height: 1.4;
}
.chip:hover { filter: brightness(0.97); }
.chip.is-active { background: var(--brand); color: #fff; font-weight: 500; }
.chip i { font-size: 14px; }

/* ---- search ---- */
.search { margin-bottom: 22px; }
.search input {
  width: 100%; max-width: 320px; background: #fff;
  border: 0.5px solid var(--line); border-radius: 20px;
  padding: 9px 16px; font-size: 14px; font-family: inherit;
}
.search input:focus { outline: none; border-color: var(--accent); }

/* ---- grid + cards ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}
.card {
  background: #fff; border: 0.5px solid var(--line); border-radius: 16px;
  overflow: hidden; display: flex; flex-direction: column;
}
.card__head {
  height: 110px; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.card__head i { font-size: 44px; color: rgba(255, 255, 255, 0.85); }
.badge {
  position: absolute; top: 12px; right: 12px; font-size: 11px;
  padding: 4px 10px; border-radius: 12px; background: #fff; font-weight: 500;
}
.card__body { padding: 18px; display: flex; flex-direction: column; flex: 1; }
.card__title { font-weight: 500; font-size: 17px; margin-bottom: 6px; }
.card__desc {
  font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.6;
}
.author { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.author__ava {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.author__name { font-size: 13px; color: var(--ink); }
.card__btn {
  width: 100%; border: none; font-weight: 500; padding: 10px; font-size: 14px;
  border-radius: 8px; cursor: pointer; margin-top: auto; text-align: center;
  text-decoration: none; display: block; font-family: inherit;
}
.card__btn--go { background: var(--accent); color: #fff; }
.card__btn--go:hover { filter: brightness(1.05); }
.card__btn--off { background: #F1EFE8; color: #888780; cursor: not-allowed; }
.card__url { text-align: center; font-size: 11px; color: var(--faint); margin-top: 8px; }
.empty { color: var(--muted); padding: 24px 4px; font-size: 14px; }

/* ---- gate ---- */
.gate {
  min-height: 100vh; background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px; position: relative; overflow: hidden;
}
.gate__blob { position: absolute; border-radius: 50%; background: var(--accent); }
.gate__card {
  position: relative; background: #fff; border-radius: 16px;
  padding: 40px 36px; max-width: 340px; width: 100%; text-align: center;
}
.gate__lock {
  width: 52px; height: 52px; border-radius: 14px; background: #FFE8EC;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
}
.gate__lock i { font-size: 24px; color: var(--accent); }
.gate h1 { font-size: 24px; font-weight: 700; color: var(--ink); margin: 0 0 8px; }
.gate__sub {
  font-style: italic; font-family: Georgia, serif; font-size: 14px;
  color: #993556; margin-bottom: 28px;
}
.gate input {
  width: 100%; text-align: center; background: var(--panel);
  border: 0.5px solid var(--line); padding: 12px; font-size: 14px;
  margin-bottom: 14px; border-radius: 8px; font-family: inherit;
}
.gate input:focus { outline: none; border-color: var(--accent); }
.gate button {
  width: 100%; background: var(--accent); color: #fff; border: none;
  font-weight: 500; padding: 12px; font-size: 15px; border-radius: 8px; cursor: pointer;
}
.gate button:hover { filter: brightness(1.05); }
.gate__error { color: #c0143c; font-size: 13px; margin-bottom: 12px; }
