/* Bin Bin Hotel — Admin. Same visual language as the guest site, tuned for data entry. */
:root {
  --bg: #F5F0E8; --bg-2: #EDE5D8; --surface: #FFFFFF; --surface-2: #FBF8F3;
  --ink: #0E1B2E; --ink-2: #39455A; --ink-3: #5B6474;
  --line: rgba(14, 27, 46, .12); --line-strong: rgba(14, 27, 46, .26);
  --blue: #23409A; --blue-soft: #E3E8F6; --red: #C42530; --red-soft: #FBE9EA;
  --green: #1F7A4D; --green-soft: #E3F3EA; --amber: #9A6200; --amber-soft: #FFF3D6;
  --brand: #ED3237;
  --f-display: "Newsreader", Georgia, serif;
  --f-body: "Hanken Grotesk", system-ui, sans-serif;
  --radius: 12px; --shadow: 0 20px 50px -24px rgba(14, 27, 46, .35);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--f-body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
code { font-size: 12.5px; background: var(--bg-2); padding: 1px 6px; border-radius: 5px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 500; border: 1px solid var(--line-strong); background: var(--surface); transition: background-color .15s, border-color .15s, color .15s, transform .15s; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--primary:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); }
.btn--danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn--danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; color: var(--ink-2); transition: background-color .15s, color .15s; }
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn--danger:hover { background: var(--red-soft); color: var(--red); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field small, .hint { font-size: 12.5px; color: var(--ink-3); }
input[type=text], input[type=password], input[type=number], input[type=tel], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); }
input.is-missing, textarea.is-missing { border-color: #E3B34B; background: var(--amber-soft); }
input.is-invalid { border-color: var(--red); background: var(--red-soft); }
.ref { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref b { font-weight: 600; letter-spacing: .06em; font-size: 10.5px; color: var(--ink-3); margin-right: 4px; }
.form-error { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 14px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(80% 60% at 80% 0%, #dfe6f5 0%, transparent 60%), var(--bg); }
.auth__card { width: min(420px, 100%); background: var(--surface); padding: 36px 32px 28px; border-radius: 24px; box-shadow: var(--shadow); text-align: left; }
.auth__logo { display: block; margin: 0 auto 18px; border-radius: 50%; }
.auth__title { font: 400 28px/1.2 var(--f-display); margin: 0 0 6px; text-align: center; }
.auth__sub { margin: 0 0 24px; text-align: center; color: var(--ink-3); font-size: 14px; }
.auth__back { display: block; text-align: center; margin-top: 18px; font-size: 13px; color: var(--ink-3); text-decoration: none; }
.auth__back:hover { color: var(--ink); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 20px 14px; background: var(--ink); color: #E9E4DA; }
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 8px; }
.sidebar__brand img { border-radius: 50%; }
.sidebar__brand b { display: block; font-weight: 500; letter-spacing: .3em; font-size: 15px; color: #fff; }
.sidebar__brand small { display: block; font-size: 11.5px; color: rgba(255,255,255,.55); margin-top: 3px; }
.sidebar__nav { display: grid; gap: 2px; overflow-y: auto; }
.sidebar__foot { margin-top: auto; display: grid; gap: 2px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.nav-link { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 0 12px; border-radius: 10px; text-decoration: none; font-size: 14px; color: rgba(255,255,255,.72); text-align: left; transition: background-color .15s, color .15s; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; }
.nav-link[aria-current="page"] .icon { color: #FF8A8E; }
.nav-link .count { margin-left: auto; font-size: 11.5px; color: rgba(255,255,255,.45); font-variant-numeric: tabular-nums; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 32px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar h1 { font: 400 28px/1.15 var(--f-display); margin: 2px 0 0; }
.topbar__actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.langswitch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.langswitch button { min-height: 32px; min-width: 44px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3); position: relative; }
.langswitch button[aria-checked="true"] { background: var(--ink); color: #fff; }
.langswitch button .dot { position: absolute; top: 4px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #E3A21A; }
.save-status { font-size: 13px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.save-status.is-dirty { color: var(--amber); }
.save-status.is-ok { color: var(--green); }
.content { padding: 28px 32px 80px; max-width: 1280px; width: 100%; }
.content:focus { outline: none; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; margin-bottom: 20px; }
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.panel__head h2 { font: 400 22px/1.2 var(--f-display); margin: 0; }
.panel__head p { margin: 4px 0 0; color: var(--ink-3); font-size: 13.5px; max-width: 70ch; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 220px; }
.empty { padding: 32px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-strong); border-radius: 14px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; transition: border-color .15s, transform .2s var(--ease); }
.stat:hover { border-color: var(--ink); transform: translateY(-2px); }
.stat b { display: block; font: 400 34px/1 var(--f-display); margin: 8px 0 4px; }
.stat span { font-size: 13px; color: var(--ink-3); }
.completeness { display: grid; gap: 10px; }
.completeness__row { display: grid; grid-template-columns: 110px 1fr 140px; align-items: center; gap: 14px; font-size: 14px; }
.bar { height: 8px; border-radius: 9px; background: var(--bg-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 9px; }

/* ---------- Data table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.data th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #FCFAF6; }
table.data input, table.data select { min-height: 36px; padding: 6px 10px; }
table.data .num { width: 130px; }
table.data .coord { width: 120px; }
table.data .actions { width: 1%; white-space: nowrap; text-align: right; }
table.data .idx { width: 34px; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 16px; }
.price-free { font-size: 11.5px; color: var(--green); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; display: block; margin-top: 4px; }

/* ---------- Rules editor ---------- */
.split { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.list { display: grid; gap: 4px; }
/* the rule list and its "Thêm mục" button stick together, so the list never slides over the button */
.split > div:first-child { position: sticky; top: 100px; }
.list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border-radius: 12px; text-align: left; font-size: 14px; border: 1px solid transparent; }
.list button:hover { background: var(--surface); }
.list button[aria-current="true"] { background: var(--surface); border-color: var(--line-strong); font-weight: 500; }
.list button i { font-style: italic; font-family: var(--f-display); color: var(--ink-3); width: 20px; }
.rte__bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--surface-2); }
.rte__bar button { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
.rte__bar button:hover { background: var(--bg-2); }
.rte__bar .sep { width: 1px; background: var(--line); margin: 4px 4px; }
.rte__bar .right { margin-left: auto; }
.rte { min-height: 260px; padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: 0 0 12px 12px; background: var(--surface); }
.rte:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); }
textarea.rte-html { min-height: 260px; border-radius: 0 0 12px 12px; font: 13px/1.5 ui-monospace, Consolas, monospace; }
/* mirrors the guest-site .prose styles so editors see the real result */
.prose { color: var(--ink-2); }
.prose > * + * { margin-top: 14px; }
.prose p { margin: 0; }
.prose b, .prose strong { color: var(--ink); }
.prose h4, .prose > h5 { font: 400 20px/1.3 var(--f-display); color: var(--ink); margin: 22px 0 0; }
.prose ul { padding-left: 22px; margin: 0; }
.prose li { padding: 4px 0; }
.prose .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.prose .card { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.prose .card h5 { margin: 0 0 6px; font: 500 13px/1.4 var(--f-body); letter-spacing: 0; color: var(--blue); }
.prose .card.note { border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); }
.prose .card.note h5 { color: var(--red); }

/* ---------- Texts ---------- */
.text-group { margin-bottom: 22px; }
.text-row { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.text-row:first-of-type { border-top: 0; }
.text-row .label { padding-top: 9px; }
.text-row .label small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: 2px; }

/* ---------- Images ---------- */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.img-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.img-card__preview { position: relative; background: var(--bg-2); display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; }
.img-card__preview img { width: 100%; height: 100%; object-fit: cover; }
.img-card__preview.is-logo img { width: 120px; height: 120px; object-fit: contain; }
.img-card__body { padding: 16px 18px 18px; display: grid; gap: 10px; flex: 1; }
.img-card__body h3 { margin: 0; font: 400 19px/1.25 var(--f-display); }
.img-card__body p { margin: 0; font-size: 13px; color: var(--ink-3); }
.crop-stage { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 12px 0 16px; }
.crop-stage figure { margin: 0; }
.crop-stage canvas { width: 100%; height: auto; display: block; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.crop-stage figcaption { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
input[type=range] { width: 100%; accent-color: var(--ink); }
.progress { height: 6px; border-radius: 9px; background: var(--bg-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s; }

/* ---------- Backups ---------- */
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.backup-row:first-child { border-top: 0; }
.backup-row small { color: var(--ink-3); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); margin-left: 6px; }

/* ---------- Modal + toast ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal__scrim { position: absolute; inset: 0; background: rgba(8, 13, 24, .5); }
.modal__card { position: relative; width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal__head h2 { font: 400 22px var(--f-display); margin: 0; }
.modal__body { padding: 20px; }
.qr-box { display: grid; place-items: center; gap: 12px; text-align: center; }
.qr-box svg, .qr-box img { width: 240px; height: 240px; }
.qr-box .url { font-size: 13px; word-break: break-all; color: var(--ink-2); background: var(--bg); padding: 8px 12px; border-radius: 10px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; display: inline-flex; gap: 10px; align-items: center; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); transition: opacity .2s, transform .3s var(--ease); max-width: calc(100vw - 32px); }
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 6px; overflow-x: auto; }
  .sidebar__brand { border: 0; padding: 0 8px 0 0; margin: 0; }
  .sidebar__brand span { display: none; }
  .sidebar__nav { display: flex; gap: 2px; overflow: visible; }
  .sidebar__foot { display: flex; margin: 0; padding: 0 0 0 6px; border: 0; border-left: 1px solid rgba(255,255,255,.12); }
  .nav-link { min-height: 40px; padding: 0 10px; white-space: nowrap; }
  .nav-link span, .nav-link .count { display: none; }
  .nav-link[aria-current="page"] span { display: inline; }
  .topbar { position: static; padding: 14px 16px; }
  .content { padding: 18px 16px 64px; }
  .split { grid-template-columns: 1fr; }
  .split > div:first-child { position: static; }
  .list { position: static; display: flex; overflow-x: auto; }
  .list button { white-space: nowrap; width: auto; }
  .text-row { grid-template-columns: 1fr; gap: 6px; }
  .text-row .label { padding-top: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .panel { padding: 18px 16px; }
  .completeness__row { grid-template-columns: 70px 1fr; }
  .completeness__row span:last-child { grid-column: 2; font-size: 12.5px; color: var(--ink-3); }
}

/* ---------- Auto-find nearby places ---------- */
.panel__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal__card--wide { width: min(760px, 100%); }
.ap-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.ap-controls .field { margin: 0; flex: 1 1 180px; }
.ap-controls .field span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.ap-controls .btn { min-height: 42px; }
#apStatus { margin: 14px 0 10px; font-size: 13.5px; }
.ap-list { max-height: 52vh; overflow: auto; display: grid; gap: 14px; }
.ap-list:empty { display: none; }
.ap-group h3 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 6px 2px; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--surface); }
.ap-group h3 span { color: var(--ink-3); font-weight: 500; }
.ap-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.ap-row:hover { background: var(--bg-2); }
.ap-row input { width: 18px; height: 18px; margin: 0; }
.ap-row__name { display: grid; font-size: 14px; font-weight: 500; min-width: 0; }
.ap-row__name small { font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.ap-row__dist { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ap-row a { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--ink-3); }
.ap-row a:hover { background: var(--surface-2, var(--bg-2)); color: var(--ink); }
.ap-row a .icon { width: 15px; height: 15px; }
.ap-row.is-have { opacity: .6; cursor: default; }
.ap-row .tag { margin: 0; }
.ap-credit { margin: 10px 0 0; font-size: 11.5px; color: var(--ink-3); text-align: right; }

/* Branch photo cell (WiFi & Chi nhánh table) */
.branch-photo { width: 96px; }
.branch-photo__pick { display: grid; place-items: center; width: 88px; height: 56px; border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 1px dashed var(--line-strong, var(--line)); background: var(--bg-2); color: var(--ink-3); font-size: 12px; }
.branch-photo__pick span { display: inline-flex; align-items: center; gap: 4px; }
.branch-photo__pick .icon { width: 14px; height: 14px; }
.branch-photo__pick img { width: 100%; height: 100%; object-fit: cover; }
.branch-photo__pick:hover, .branch-photo__pick:focus-within { border-color: var(--blue, currentColor); color: var(--ink); }
.link-btn { background: none; border: 0; padding: 4px 0 0; font: inherit; font-size: 12px; color: var(--ink-3); cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--ink); }
