/* ============================================================
   Khu vực quản trị
   ============================================================ */

:root {
  --red: #d81c23;
  --red-dark: #a31016;
  --red-ink: #b3151c;
  --gold: #a9822f;
  --ink: #22201f;
  --ink-soft: #6a6462;
  --line: #e6e0d8;
  --bg: #f7f4ef;
  --card: #ffffff;
  --ok: #1c7c4a;
  --warn: #b07807;
  --err: #b3151c;
  --radius: 12px;
  --sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red-ink); }

img { max-width: 100%; display: block; }

/* ---------- Đăng nhập ---------- */

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(160deg, #e01f27, #cc161d 45%, #8f0d13);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 34px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .6);
  text-align: center;
}

.auth-seal {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 24px;
  color: #fff;
  background: linear-gradient(140deg, var(--red), var(--red-dark));
}

.auth-card h1 { margin: 0 0 8px; font-size: 24px; font-weight: 600; }

.auth-lead { margin: 0 0 26px; font-size: 14px; color: var(--ink-soft); }

.auth-form { text-align: left; }

.auth-form .btn { width: 100%; margin-top: 8px; }

/* ---------- Khung ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  color: #fff;
  background: linear-gradient(120deg, var(--red-dark), var(--red));
}

.brand {
  font-weight: 600;
  font-size: 17px;
  color: #fff;
  text-decoration: none;
}

.brand span {
  display: block;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .28em;
  text-transform: uppercase;
  opacity: .7;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.topbar-right form { margin: 0; }

.who { opacity: .8; }

.link {
  padding: 0;
  border: 0;
  font: inherit;
  color: #fff;
  background: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  flex: none;
  padding: 13px 16px;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tabs a:hover { color: var(--ink); }

.tabs a.is-active { color: var(--red); border-bottom-color: var(--red); font-weight: 500; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 26px 20px 80px; }

.page-title { margin: 0 0 6px; font-size: 26px; font-weight: 600; }

.page-lead { margin: 0 0 24px; color: var(--ink-soft); font-size: 14px; }

/* ---------- Thẻ ---------- */

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

fieldset.panel { border: 1px solid var(--line); }

.panel > h2, .panel legend {
  margin: 0 0 16px;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--red-dark);
}

.panel legend { padding: 0 8px; }

.sub-head { margin: 24px 0 10px; font-size: 14px; font-weight: 600; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 { margin: 0; }

.panel-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

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

.stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.stat-label {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stat-value { margin: 0; font-size: 30px; font-weight: 600; color: var(--red); line-height: 1.1; }

.stat-sub { margin: 4px 0 0; font-size: 12px; color: var(--ink-soft); }

/* ---------- Form ---------- */

.field { display: block; margin-bottom: 14px; }

.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--ink-soft);
}

.field small { display: block; margin-top: 5px; font-size: 12px; color: var(--ink-soft); }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=url], input:not([type]), textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}

textarea { resize: vertical; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(216, 28, 35, .14);
}

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

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

.hint { margin: 8px 0 14px; font-size: 13px; color: var(--ink-soft); }

.switch { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 14px; }

.switch input { width: 18px; height: 18px; accent-color: var(--red); }

.inline-form { display: flex; gap: 6px; align-items: center; }

.inline-form input, .inline-form select { width: auto; min-width: 120px; }

/* ---------- Nút ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s ease;
}

.btn:hover { border-color: #cfc7bc; background: #faf8f5; }

.btn-primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(130deg, var(--red), var(--red-dark));
}

.btn-primary:hover { filter: brightness(1.07); background: linear-gradient(130deg, var(--red), var(--red-dark)); }

.btn-ghost { background: transparent; }

.btn-mini { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }

.btn-danger { color: var(--err); border-color: rgba(216, 28, 35, .32); }

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

/* ---------- Bảng ---------- */

.table-scroll { overflow-x: auto; margin: 0 -6px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }

.table th {
  padding: 10px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 12px 10px;
  border-bottom: 1px solid #f0ece6;
  vertical-align: top;
}

.table tr:hover td { background: #fdfcfa; }

.table .num { text-align: center; }

.table small { color: var(--ink-soft); }

.msg { max-width: 320px; font-size: 13.5px; color: var(--ink-soft); }

.link-cell { min-width: 300px; }

.link-input {
  width: 210px;
  padding: 5px 8px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbf9f6;
}

.row-actions { display: flex; gap: 6px; align-items: flex-start; }

.row-actions form { margin: 0; }

.inline-edit summary { list-style: none; cursor: pointer; }

.inline-edit summary::-webkit-details-marker { display: none; }

.edit-form {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 10px;
  min-width: 200px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbf9f6;
}

.edit-form input, .edit-form select { font-size: 13px; padding: 7px 9px; }

/* ---------- Nhãn ---------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-yes { color: #0f5c34; background: #d9f2e4; }
.badge-no { color: #8c1017; background: #fbe0e1; }
.badge-maybe { color: #7a5405; background: #fdf0d3; }
.badge-none { color: var(--ink-soft); background: #eeeae4; }

/* ---------- Danh sách ---------- */

.feed { margin: 0; padding: 0; list-style: none; }

.feed li {
  padding: 12px 0;
  border-bottom: 1px solid #f0ece6;
  font-size: 14px;
}

.feed li:last-child { border-bottom: 0; }

.feed p { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-soft); font-style: italic; }

.feed time, .table time { font-size: 12px; color: var(--ink-soft); }

.steps { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.9; color: var(--ink-soft); }

.empty { margin: 0; padding: 26px 0; text-align: center; color: var(--ink-soft); font-size: 14px; }

/* ---------- Ảnh ---------- */

.uploader { padding: 20px; border: 2px dashed var(--line); border-radius: var(--radius); text-align: center; }

.uploader input[type=file] { width: auto; margin: 0 auto 8px; }

.upload-status { font-size: 13px; color: var(--ink-soft); min-height: 20px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }

.photo {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbf9f6;
}

.photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }

.photo-form { display: flex; gap: 5px; margin-bottom: 6px; }

.photo-form input { font-size: 12px; padding: 6px 8px; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.pick-label { margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--ink-soft); }

.pick img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }

.pick-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 4/3;
  margin-bottom: 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  background: #f0ece6;
}

.pick-grid .form-actions { grid-column: 1 / -1; }

/* ---------- Thông báo ---------- */

.flash {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 9px;
  font-size: 14px;
}

.flash-ok { color: #0f5c34; background: #d9f2e4; }
.flash-err { color: #8c1017; background: #fbe0e1; }
.flash-warn { color: #7a5405; background: #fdf0d3; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  transform: translate(-50%, 16px);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  color: #fff;
  background: var(--red-dark);
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .wrap { padding: 18px 14px 60px; }
  .topbar { flex-wrap: wrap; }
  .link-cell { min-width: 240px; }
  .link-input { width: 100%; margin-bottom: 6px; }
}


/* ---------- nhạc nền ---------- */

.music-now {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.music-now audio { width: 100%; max-width: 420px; }
.music-now code { font-size: 12px; word-break: break-all; }

/* ---------- Tách phần nhà trai / nhà gái ---------- */

.section-head {
  margin: 34px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
}

.side-tabs-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.side-tabs-nav button {
  flex: 1 1 0;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}

.side-tabs-nav button:hover { border-color: var(--gold); color: var(--ink); }

.side-tabs-nav button.is-active {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 6px 16px rgba(216,28,35,.18);
}

.side-tabs-nav button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Tab đang ẩn vẫn nằm trong biểu mẫu nên bấm Lưu là lưu cả hai bên. */
.side-tabs-panel { display: none; }
.side-tabs-panel.is-active { display: block; }

/* ---------- ảnh trong album ---------- */

.photo.is-hidden img { opacity: .38; filter: grayscale(1); }

.photo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 0;
}

.photo-tags .tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(169,130,47,.14);
  font-size: 11px;
  color: var(--gold);
}

.btn-off { color: var(--ink-soft); border-style: dashed; }
