/* VESU CLINIC — admin / CMS */
:root {
  --w9: #3a060c; --w8: #5a0a12; --w7: #74101c; --w6: #8c1420; --w05: #fdf3f3;
  --g6: #a88220; --g5: #c9a227; --g4: #ddbb59; --g1: #f6ecd2;
  --ink: #1f1418; --ink2: #574449; --ink3: #8b787d;
  --line: #e9dfdb; --line2: #f4eeeb; --bg: #f7f3f1; --card: #fff;
  --ok: #17663a; --okbg: #edf9f0; --err: #97262b; --errbg: #fdf0f0;
  --r: 14px; --rs: 10px;
  --sh: 0 1px 2px rgba(58,6,12,.05), 0 6px 20px rgba(58,6,12,.06);
  --sh2: 0 20px 50px rgba(58,6,12,.16);
  --fb: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fh: 'Anuphan', 'IBM Plex Sans Thai', -apple-system, sans-serif;
  --side: 254px;
}
* { box-sizing: border-box; margin: 0; }
body { font-family: var(--fb); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--w7); text-decoration: none; }
ul { list-style: none; padding: 0; }
:focus-visible { outline: 2.5px solid var(--g5); outline-offset: 2px; border-radius: 6px; }
h1,h2,h3,h4 { font-family: var(--fh); line-height: 1.3; }
.ic { flex: none; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(135deg, var(--w9), var(--w7) 55%, var(--w6)); padding: 24px; }
.login { width: min(100%, 400px); background: #fff; border-radius: 22px; padding: 34px 30px; box-shadow: var(--sh2); display: grid; gap: 15px; }
.login__brand { text-align: center; margin-bottom: 6px; }
.login__mark { width: 56px; height: 56px; border-radius: 17px; display: grid; place-items: center; margin: 0 auto 14px; background: linear-gradient(135deg, var(--w8), var(--w6)); color: var(--g4); }
.login h1 { font-size: 1.4rem; }
.login p { color: var(--ink3); font-size: .88rem; }
.login__err { color: var(--err); font-size: .87rem; min-height: 20px; text-align: center; }
.login__back { text-align: center; font-size: .85rem; color: var(--ink3); margin-top: 4px; }
.fld { display: grid; gap: 6px; }
.fld > span { font-size: .84rem; font-weight: 600; color: var(--ink2); }
.fld input, .fld select, .fld textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--rs); background: #fff; transition: .16s; font-size: .93rem;
}
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--w6); outline: 0; box-shadow: 0 0 0 3.5px rgba(140,20,32,.1); }
.fld textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.fld small { color: var(--ink3); font-size: .78rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; border: 1.5px solid transparent; transition: .16s; white-space: nowrap; }
.btn .ic { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--w8), var(--w6)); color: #fff; box-shadow: 0 8px 20px rgba(140,20,32,.24); }
.btn-gold { background: linear-gradient(100deg, var(--g6), var(--g4)); color: #3a2704; }
.btn-ghost { border-color: var(--line); background: #fff; color: var(--ink2); }
.btn-ghost:hover { border-color: var(--w6); color: var(--w7); }
.btn-danger { background: #fff; border-color: #f0c2c2; color: var(--err); }
.btn-danger:hover { background: var(--errbg); }
.btn-sm { padding: 7px 13px; font-size: .82rem; }
.btn-icon { padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink2); }
.btn-icon:hover { border-color: var(--w6); color: var(--w7); }
.btn-icon.is-on { background: var(--w6); color: #fff; border-color: transparent; }
.mtile .rowline { display: grid; grid-template-columns: repeat(4, 1fr); }
.mtile .btn-icon { padding: 6px 0; display: grid; place-items: center; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
@media (min-width: 1000px) { .app { grid-template-columns: var(--side) 1fr; } }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--ink3); }

.side { background: linear-gradient(180deg, var(--w9), var(--w8)); color: rgba(255,255,255,.8); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.scrim { display: none; }
@media (max-width: 999px) {
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 60; transform: translateX(-100%); transition: transform .28s; height: 100vh; }
  .side.is-open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(31,20,24,.5); z-index: 55; }
  .scrim.is-on { display: block; }
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.side__brand b { color: #fff; font-family: var(--fh); letter-spacing: .06em; font-size: 1.02rem; display: block; }
.side__brand small { font-size: .7rem; color: rgba(255,255,255,.5); }
.side__mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: rgba(233,208,137,.16); color: var(--g4); }
.side__sec { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.38); padding: 16px 12px 6px; }
.side a, .side button.navi { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: rgba(255,255,255,.78); font-size: .9rem; width: 100%; text-align: left; transition: .16s; }
.side a:hover, .side button.navi:hover { background: rgba(255,255,255,.09); color: #fff; }
.side .is-active { background: linear-gradient(100deg, rgba(233,208,137,.22), rgba(233,208,137,.06)); color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 var(--g4); }
.side__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); }
.side .pill { margin-left: auto; background: var(--g4); color: #3a2704; font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 40; background: rgba(247,243,241,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: 12px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top h1 { font-size: 1.15rem; }
.top__right { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.dirty { font-size: .8rem; color: var(--g6); display: none; align-items: center; gap: 6px; }
.dirty.is-on { display: inline-flex; }
.menu-btn { display: inline-flex; }
@media (min-width: 1000px) { .menu-btn { display: none; } }

.body { padding: 20px 18px 80px; }
@media (min-width: 700px) { .body { padding: 26px 26px 90px; } }

/* ---------- cards / panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); margin-bottom: 18px; overflow: hidden; }
.panel__h { padding: 15px 18px; border-bottom: 1px solid var(--line2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel__h h2 { font-size: 1.02rem; }
.panel__h .btn { margin-left: auto; }
.panel__b { padding: 18px; }
.hint { font-size: .82rem; color: var(--ink3); }
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .g4 { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh); }
.stat b { display: block; font-family: var(--fh); font-size: 1.7rem; color: var(--w7); }
.stat span { font-size: .82rem; color: var(--ink3); }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--rs); font-size: .87rem; align-items: flex-start; }
.note--warn { background: var(--g1); border: 1px solid var(--g4); color: #6d5410; }
.note--ok { background: var(--okbg); border: 1px solid #b7e3c3; color: var(--ok); }
.note--info { background: #eef4fb; border: 1px solid #c5daf1; color: #1c4b7d; }

/* ---------- item list ---------- */
.items { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: var(--r); background: #fff; overflow: hidden; }
.item__h { display: flex; align-items: center; gap: 11px; padding: 10px 12px; cursor: pointer; }
.item__h:hover { background: var(--w05); }
.item__thumb { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; background: var(--line2); flex: none; }
.item__t { font-weight: 600; font-size: .93rem; }
.item__s { font-size: .78rem; color: var(--ink3); }
.item__acts { margin-left: auto; display: flex; gap: 5px; align-items: center; }
.item__b { padding: 16px; border-top: 1px solid var(--line2); background: #fdfbfa; display: none; }
.item.is-open .item__b { display: block; }
.tag { font-size: .7rem; padding: 2px 8px; border-radius: 99px; background: var(--line2); color: var(--ink2); }
.tag--on { background: #e6f6ec; color: var(--ok); }
.tag--off { background: #f3f0ef; color: var(--ink3); }
.tag--gold { background: var(--g1); color: var(--g6); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .86rem; color: var(--ink2); }
.tab.is-on { background: linear-gradient(135deg, var(--w8), var(--w6)); color: #fff; border-color: transparent; }

/* ---------- media ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
.mtile { border: 2px solid var(--line); border-radius: var(--rs); overflow: hidden; background: #fff; text-align: left; transition: .16s; position: relative; }
.mtile:hover { border-color: var(--g4); transform: translateY(-2px); }
.mtile.is-sel { border-color: var(--w6); box-shadow: 0 0 0 3px rgba(140,20,32,.14); }
.mtile__img { aspect-ratio: 1; background: var(--line2); }
.mtile__img img { width: 100%; height: 100%; object-fit: contain; }
.mtile__n { padding: 7px 9px; font-size: .74rem; color: var(--ink2); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.mtile__b { position: absolute; top: 5px; right: 5px; background: rgba(31,20,24,.7); color: #fff; font-size: .64rem; padding: 1px 6px; border-radius: 99px; }
.pickrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pickimg { width: 74px; height: 74px; border-radius: var(--rs); border: 1px solid var(--line); object-fit: cover; background: var(--line2); }
.pickempty { width: 74px; height: 74px; border-radius: var(--rs); border: 1.5px dashed var(--line); display: grid; place-items: center; color: var(--ink3); background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chipimg { position: relative; width: 76px; }
.chipimg img { width: 76px; height: 76px; border-radius: var(--rs); border: 1px solid var(--line); object-fit: cover; background: var(--line2); }
.chipimg button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--w6); color: #fff; display: grid; place-items: center; box-shadow: var(--sh); }
.chipimg .ord { position: absolute; bottom: 2px; left: 2px; background: rgba(31,20,24,.72); color: #fff; font-size: .64rem; padding: 0 5px; border-radius: 99px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; padding: 18px; background: rgba(31,20,24,.55); backdrop-filter: blur(3px); }
.modal.is-open { display: grid; }
.modal__box { background: #fff; border-radius: 18px; width: min(100%, 940px); max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--sh2); overflow: hidden; }
.modal__h { padding: 15px 18px; border-bottom: 1px solid var(--line2); display: flex; align-items: center; gap: 12px; }
.modal__h h3 { font-size: 1.02rem; }
.modal__h .btn-icon { margin-left: auto; }
.modal__b { padding: 18px; overflow: auto; }
.modal__f { padding: 14px 18px; border-top: 1px solid var(--line2); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- cropper ---------- */
.crop-stage { position: relative; width: 100%; max-width: 100%; aspect-ratio: 4/3; background: #241418; border-radius: var(--rs); overflow: hidden; touch-action: none; cursor: grab; margin-inline: auto; }
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.crop-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.crop-tools input[type=range] { flex: 1; min-width: 160px; accent-color: var(--w6); }
.ratio { display: flex; gap: 6px; flex-wrap: wrap; }
.ratio button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .8rem; background: #fff; }
.ratio button.is-on { background: var(--w6); color: #fff; border-color: transparent; }

/* ---------- preview (site simulator) ---------- */
.prev-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.prev-frame { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; box-shadow: var(--sh); margin-inline: auto; transition: width .25s; }
.prev-frame iframe { width: 100%; height: min(76vh, 900px); border: 0; display: block; }

/* ---------- table ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 720px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line2); vertical-align: top; }
th { font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink3); font-weight: 600; }
tbody tr:hover { background: var(--w05); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--w8); color: #fff; padding: 12px 20px; border-radius: 999px; box-shadow: var(--sh2); z-index: 95; opacity: 0; pointer-events: none; transition: .25s; font-size: .9rem; display: flex; gap: 9px; align-items: center; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); }

.rowline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }
.mt { margin-top: 14px; }
.muted { color: var(--ink3); }
.list-str { display: grid; gap: 8px; }
.list-str .rowline input { flex: 1; }
.sub { border: 1px dashed var(--line); border-radius: var(--rs); padding: 12px; background: #fff; display: grid; gap: 10px; }
.checkline { display: flex; gap: 9px; align-items: center; font-size: .89rem; }
.checkline input { width: 17px; height: 17px; accent-color: var(--w6); }
.days { display: grid; gap: 8px; }
.day { display: grid; grid-template-columns: 82px 1fr 1fr auto; gap: 8px; align-items: center; }
@media (max-width: 620px) { .day { grid-template-columns: 1fr 1fr; } .day > span { grid-column: 1 / -1; font-weight: 600; } }
