/* ============================================================
   Trang quản trị Sales Kit Gladia Heights
   ============================================================ */
:root {
  --teal: #2f9296;
  --teal-dark: #277c80;
  --orange: #e88a57;
  --ink: #1f3a3c;
  --line: #e3e8ea;
  --bg: #f3f6f7;
  --card: #ffffff;
  --muted: #77878a;
  --danger: #d9534f;
  --ok: #2f9296;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
a { color: var(--teal-dark); }

/* ---- Nút ---- */
.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: #eef2f3;
  color: var(--ink);
  transition: all .14s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--teal); color: #fff; }
.btn--primary:hover { background: var(--teal-dark); }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--ghost:hover { background: #fff; }
.btn--danger { background: #fff; color: var(--danger); border-color: #f0c9c8; }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { padding: 6px 11px; font-size: 13px; }
.btn--icon { padding: 6px 9px; line-height: 1; }

/* ---- Đăng nhập ---- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1000px 500px at 50% -10%, #d7ecec, var(--bg));
}
.login__card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  padding: 34px 30px;
  box-shadow: 0 20px 60px rgba(31, 58, 60, 0.15);
  text-align: center;
}
.login__logo {
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--teal-dark);
  font-size: 20px;
  margin-bottom: 18px;
}
.login__logo span { color: var(--orange); margin-left: 6px; }
.login__card h1 { font-size: 20px; }
.login__card input {
  width: 100%;
  margin: 18px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
}
.login__card input:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.login__err { color: var(--danger); font-size: 14px; min-height: 20px; margin-top: 10px; }
.login__back { display: inline-block; margin-top: 12px; font-size: 14px; text-decoration: none; }

/* ---- Thanh trên ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__brand { font-size: 15px; }
.topbar__brand .dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--teal); margin-right: 8px; vertical-align: middle;
}
.topbar__actions { display: flex; gap: 10px; }

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 4px;
  padding: 0 22px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.tab {
  border: none; background: none; font: inherit; font-weight: 600;
  padding: 12px 16px; cursor: pointer; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab.is-active { color: var(--teal-dark); border-bottom-color: var(--teal); }

/* ---- Bố cục ---- */
.wrap { max-width: 960px; margin: 0 auto; padding: 24px 22px 80px; }
.tabpane { display: none; }
.tabpane.is-active { display: block; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.section-head h2 { font-size: 19px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

/* ---- Form ---- */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px;
}
.form-grid label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; font-weight: 600; color: #3a5052;
}
.form-grid .col-2 { grid-column: 1 / -1; }
.form-grid input, .form-grid textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-weight: 500; color: var(--ink);
}
.form-grid input:focus { outline: 2px solid var(--teal); border-color: var(--teal); }

/* ---- Danh sách nhóm ---- */
.cat-list { display: flex; flex-direction: column; gap: 16px; }
.cat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cat__head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(0deg, #f7fbfb, #fff);
  border-bottom: 1px solid var(--line);
}
.cat__code {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--teal); color: #fff; border-radius: 8px; font-weight: 700;
}
.cat__title { font-weight: 700; font-size: 16px; flex: 1; min-width: 0; }
.cat__title small { display:block; font-weight:500; color: var(--muted); font-size:12px; margin-top:2px; word-break: break-all; }
.cat__tools { display: flex; gap: 6px; align-items: center; }

.items { list-style: none; margin: 0; padding: 6px; }
.item {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
}
.item:hover { background: #f6f9f9; }
.item__stt { color: var(--muted); font-weight: 600; text-align: center; }
.item__main { min-width: 0; }
.item__title { font-weight: 600; }
.item__url {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.item__url a { color: var(--muted); text-decoration: none; }
.item__url a:hover { color: var(--teal-dark); text-decoration: underline; }
.item__tools { display: flex; gap: 5px; }
.item__none { padding: 14px 10px; color: var(--muted); font-style: italic; font-size: 14px; }
.cat__foot { padding: 8px 12px 14px; }

.arrows { display: inline-flex; flex-direction: column; gap: 2px; }
.arrows button {
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  width: 26px; height: 20px; cursor: pointer; line-height: 1; font-size: 11px; color: #567;
}
.arrows button:hover:not(:disabled) { background: var(--teal); color: #fff; border-color: var(--teal); }
.arrows button:disabled { opacity: .35; cursor: default; }

/* ---- Quản lý ảnh ---- */
.img-cards { display: grid; grid-template-columns: 1fr; gap: 18px; }
.img-card__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.img-card__head h3 { font-size: 16px; }
.img-preview {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f2f5f6 repeating-conic-gradient(#eceff0 0% 25%, #f7f9fa 0% 50%) 50% / 22px 22px;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 120px;
}
.img-preview img { width: 100%; height: auto; display: block; max-height: 260px; object-fit: cover; }
.img-preview img[src=""], .img-preview img:not([src]) { display: none; }
.img-card__actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px;
}
.img-card__actions .spacer { flex: 1; }
.file-btn { position: relative; }
.file-name { font-size: 13px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Tùy chỉnh màu ---- */
.color-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.color-controls { display: flex; flex-direction: column; gap: 6px; }
.color-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--line);
}
.color-row > span:first-child { font-size: 14px; font-weight: 600; color: #3a5052; }
.color-row small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 2px; }
.color-input { display: inline-flex; align-items: center; gap: 8px; }
.color-input input[type="color"] {
  width: 42px; height: 34px; padding: 2px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; cursor: pointer;
}
.color-input .hex {
  width: 92px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-weight: 600; text-transform: uppercase; color: var(--ink);
}
.color-input .hex:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.color-actions { display: flex; gap: 10px; margin-top: 16px; }

/* Khung xem trước bảng màu */
.color-preview { position: sticky; top: 90px; }
.cp-sheet {
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line);
  background: var(--cp-bg, #fcf8dc);
}
.cp-title {
  text-align: center; padding: 16px 10px 14px; font-size: 18px;
  color: var(--cp-accent, #e88a57); font-weight: 600;
}
.cp-title b { color: var(--cp-text, #2a7a80); }
.cp-table { padding: 0 10px 14px; }
.cp-row { display: grid; grid-template-columns: 15% 55% 30%; align-items: center; }
.cp-row > span, .cp-row > a { padding: 9px 8px; font-size: 12.5px; text-align: center; }
.cp-head > span {
  background: var(--cp-accent, #e88a57); color: #fff; font-weight: 700;
  text-transform: uppercase; font-size: 11px;
}
.cp-cat > span {
  background: var(--cp-primary, #2f9296); color: #fff; font-weight: 700;
  border-top: 2px solid var(--cp-bg, #fcf8dc); font-size: 12px;
}
.cp-cat > span:nth-child(2) { text-align: left; }
.cp-item { border-top: 1px solid var(--cp-line, #efe6b8); }
.cp-item > span { color: var(--cp-text, #2a7a80); font-weight: 500; }
.cp-item > a { color: var(--cp-link, #de7a3f); text-decoration: underline; font-weight: 600; cursor: default; }

@media (max-width: 720px) {
  .color-layout { grid-template-columns: 1fr; }
  .color-preview { position: static; }
}

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(20, 40, 42, 0.5); }
.modal__card {
  position: relative; background: #fff; border-radius: 14px;
  padding: 22px; width: 100%; max-width: 520px;
  box-shadow: 0 30px 80px rgba(0,0,0,.3);
}
.modal__card h3 { margin-bottom: 16px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500; z-index: 80;
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
  animation: toastIn .2s ease;
}
.toast.is-error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .col-2 { grid-column: auto; }
  .item { grid-template-columns: 34px 1fr auto; }
  .topbar__brand b { display: none; }
}
