/* Hasacon Portal — brand: Berlin Sans FB Demi only for the HASACON wordmark,
   H+S in Hasacon Blue #2973B8, other letters #7A7D80. Body: Be Vietnam Pro. */
@font-face {
  font-family: "Berlin Sans FB Demi";
  src: url("/assets/fonts/BerlinSansFBDemi.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/assets/fonts/BeVietnamPro-400-vietnamese.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/assets/fonts/BeVietnamPro-600-vietnamese.woff2") format("woff2");
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/assets/fonts/BeVietnamPro-800-vietnamese.woff2") format("woff2");
  font-weight: 800; font-display: swap;
}

:root {
  --blue: #2973B8;
  --grey: #7A7D80;
  --navy: #0E2A44;
  --ink: #16232f;
  --line: #dde3e9;
  --bg: #f4f6f8;
  --ok: #1c7d43;
  --err: #b3261e;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Be Vietnam Pro", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}
.wordmark, .side-brand, .login-card h1 {
  font-family: "Berlin Sans FB Demi", sans-serif; letter-spacing: .02em;
  color: var(--grey); font-weight: 400;
}
.side-brand b, .login-card h1 b { color: var(--blue); font-weight: 400; }

/* login */
.login-screen { min-height: 100vh; display: grid; place-items: center; background: var(--navy); }
.login-card {
  background: #fff; padding: 40px 36px; border-radius: 14px; width: min(360px, 92vw);
  display: flex; flex-direction: column; gap: 8px; text-align: center;
}
.login-card h1 { font-size: 26px; margin: 8px 0 18px; }
.login-card h1 span { font-family: "Be Vietnam Pro", system-ui, sans-serif; font-size: 13px; color: var(--blue); font-weight: 600; margin-left: 6px; }
.login-card label { text-align: left; font-weight: 600; font-size: 12px; margin-top: 8px; }
.login-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.login-err { color: var(--err); font-size: 12px; min-height: 1em; margin: 6px 0 0; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: var(--navy); color: #cdd7e1; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh;
}
.side-brand { font-size: 19px; color: #9BA1A6; }
.side-brand b { color: #4E9BDD; }
.side-brand span { font-family: "Be Vietnam Pro", system-ui, sans-serif; font-size: 11px; color: #7FB4E0; font-weight: 600; margin-left: 5px; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a {
  color: #cdd7e1; text-decoration: none; padding: 9px 12px; border-radius: 8px; font-weight: 600;
}
.side nav a:hover { background: rgba(255,255,255,.07); }
.side nav a.on { background: var(--blue); color: #fff; }
.side-foot { display: flex; gap: 10px; align-items: center; }
.lang-toggle, .linkish {
  background: none; border: 1px solid rgba(255,255,255,.25); color: #cdd7e1;
  border-radius: 7px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: 12px;
}
.linkish { border: none; text-decoration: underline; }

/* main */
.main { padding: 26px 32px 80px; max-width: 1060px; }
.main h2 { font-size: 21px; font-weight: 800; margin: 0 0 4px; }
.main .sub { color: var(--grey); margin: 0 0 20px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; }
.field { margin-bottom: 12px; }
.field > label { display: block; font-weight: 600; font-size: 12px; margin-bottom: 4px; color: #33414e; }
.field input[type=text], .field textarea, .field select, .field input[type=password], .field input[type=email] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff;
}
.field textarea { min-height: 74px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--grey); margin-top: 2px; }
.dirty-bar {
  position: fixed; bottom: 0; left: 220px; right: 0; background: #fff;
  border-top: 1px solid var(--line); padding: 12px 32px; display: flex; gap: 12px; align-items: center;
  box-shadow: 0 -4px 14px rgba(14,42,68,.08); z-index: 5;
}
.btn {
  background: var(--blue); color: #fff; border: 0; padding: 10px 18px; border-radius: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.btn.danger { background: var(--err); }
.btn.sm { padding: 6px 12px; font-size: 12px; }

/* tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button {
  border: 1px solid var(--line); background: #fff; padding: 7px 16px; border-radius: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tabs .miss { color: var(--err); margin-left: 5px; }

/* lists */
.rowlist { display: flex; flex-direction: column; gap: 8px; }
.rowitem {
  display: flex; align-items: center; gap: 12px; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; background: #fff;
}
.rowitem .grow { flex: 1; min-width: 0; }
.rowitem .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowitem .meta { color: var(--grey); font-size: 12px; }
.arr-item { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px 4px; margin-bottom: 10px; position: relative; }
.arr-tools { position: absolute; top: 8px; right: 10px; display: flex; gap: 4px; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 26px; height: 26px;
  cursor: pointer; font-size: 13px; line-height: 1;
}

/* images */
.img-field { display: flex; align-items: center; gap: 12px; }
.img-field img { width: 84px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #eee; }
.img-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.img-grid .imgcell { position: relative; }
.img-grid img { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.img-grid .rm { position: absolute; top: -6px; right: -6px; }

/* rich editor */
.rt-toolbar { display: flex; gap: 4px; flex-wrap: wrap; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 6px; background: #fafbfc; }
.rt-toolbar button { border: 1px solid transparent; background: none; border-radius: 6px; padding: 5px 9px; cursor: pointer; font: inherit; font-weight: 600; }
.rt-toolbar button:hover { border-color: var(--line); background: #fff; }
.rt-body {
  border: 1px solid var(--line); border-radius: 0 0 8px 8px; padding: 14px 16px;
  min-height: 260px; background: #fff; max-width: 100%; overflow-wrap: break-word;
}
.rt-body:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.rt-body img { max-width: 100%; height: auto; }

/* sections (level 2) */
.sec-row { display: flex; align-items: center; gap: 12px; }
.sec-row .name { flex: 1; font-weight: 600; }
.switch { appearance: none; width: 38px; height: 22px; border-radius: 11px; background: #c8cfd6; position: relative; cursor: pointer; transition: background .15s; }
.switch:checked { background: var(--ok); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch:checked::after { left: 18px; }

/* publish */
.pubbar { display: flex; align-items: center; gap: 14px; }
.progress { flex: 1; height: 8px; border-radius: 4px; background: #e4e9ee; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.pv-frame { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

.toast {
  position: fixed; bottom: 22px; right: 22px; background: var(--navy); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 20; max-width: 340px;
}
.toast.err { background: var(--err); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .dirty-bar { left: 0; }
  .main { padding: 18px 14px 90px; }
}

/* visual editor */
.ed-frame { height: 74vh; }
.ed-panel {
  position: fixed; top: 0; right: 0; width: 380px; max-width: 92vw; height: 100vh;
  background: #fff; box-shadow: -8px 0 28px rgba(14,42,68,.18); z-index: 40;
  padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px;
}
.ed-panel-head { display: flex; justify-content: space-between; align-items: center; }
.ed-panel textarea, .ed-panel input[type=text] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit;
}

/* full-bleed visual editor */
.main.ed-full { max-width: none; padding: 0; display: flex; flex-direction: column; height: 100vh; }
.ed-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--line);
}
.ed-hint { font-size: 11px; color: var(--grey); flex: 1; min-width: 180px; }
.ed-sel { max-width: 300px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.ed-stage { flex: 1; background: #dfe5ea; display: flex; justify-content: center; overflow: hidden; }
.ed-frame-full { border: 0; width: 100%; height: 100%; background: #fff; transition: width .25s; }
.ed-frame-full.mobile { width: 400px; box-shadow: 0 0 26px rgba(14,42,68,.22); }

/* editor language selector */
.ed-langs { display: flex; gap: 4px; margin-left: 4px; }
.ed-langs .btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* per-tab publish status */
.pub-status { font-size: 12px; font-weight: 600; }
.pub-status.warn { color: #b45309; }
.pub-status.ok { color: var(--ok); }

/* review dashboard */
.rev-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.roleb { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 6px;
  background: #e8eef4; color: var(--navy); text-transform: uppercase; white-space: nowrap; }
.roleb.ok { background: #e2f3e8; color: var(--ok); }
.roleb.bad { background: #fdecec; color: var(--err); }
.pub-status.wait { color: var(--blue); }
.diff-doc { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.diff-dochead { display: flex; gap: 10px; align-items: center; padding: 10px 14px;
  background: #f6f8fa; border-bottom: 1px solid var(--line); }
.diff-row { padding: 10px 14px; border-bottom: 1px solid #eef2f5; }
.diff-row:last-child { border-bottom: 0; }
.diff-path { font-size: 11px; font-weight: 700; color: #33414e; margin-bottom: 6px; }
.diff-vals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dvw { min-width: 0; }
.dtag { font-size: 10px; font-weight: 800; }
.dtag.old { color: var(--err); }
.dtag.new { color: var(--ok); }
.dv { border-radius: 8px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; overflow-wrap: break-word; margin-top: 3px; }
.dv.old { background: #fdecec; }
.dv.new { background: #e2f3e8; }
.dv img { max-width: 160px; border-radius: 6px; display: block; }
@media (max-width: 700px) { .diff-vals { grid-template-columns: 1fr; } }
