/* ============ PATPAT admin (หลังบ้าน) ============ */
body.admin { background: #eef1f8; }
.adm-top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 40; }
.adm-top .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.adm-top .brand img { width: 38px; height: 38px; background: #fff; border-radius: 9px; padding: 3px; }
.adm-top .brand .bt { color: #fff; font-size: .98rem; }
.adm-top .brand small { color: #9fb0d8; }
.adm-top .right { display: flex; gap: 10px; align-items: center; }
.adm-top .btn { padding: .5em 1.1em; font-size: .9rem; }
.btn-light { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.btn-light:hover { background: rgba(255,255,255,.24); }

.wrap { max-width: 1080px; margin: 26px auto; padding: 0 18px; }

/* login */
.login-box { max-width: 400px; margin: 8vh auto; background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 40px 34px; text-align: center; }
.login-box img { width: 72px; margin: 0 auto 14px; }
.login-box h1 { font-size: 1.4rem; }
.login-box p { color: var(--muted); font-size: .9rem; margin-top: 0; }
.field { text-align: left; margin: 14px 0; }
.field label { display: block; font-family: var(--head); font-size: .9rem; color: var(--navy); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: .75em .9em; border: 1.5px solid var(--line); border-radius: 10px;
  font-family: var(--body); font-size: .98rem; background: #fff; color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--blue); }
.field textarea { resize: vertical; min-height: 90px; }
.hint { color: var(--muted); font-size: .82rem; }
.err { color: #c0392b; font-size: .88rem; min-height: 1.2em; margin: 6px 0; }
.btn-block { width: 100%; justify-content: center; }

/* tabs */
.tabs { display: flex; gap: 6px; background: #fff; padding: 6px; border-radius: 14px; box-shadow: var(--shadow-sm); margin-bottom: 22px; flex-wrap: wrap; }
.tab { flex: 1; min-width: 130px; text-align: center; font-family: var(--head); padding: .7em 1em; border-radius: 10px; cursor: pointer; color: var(--muted); border: 0; background: transparent; font-size: .96rem; }
.tab.active { background: var(--navy); color: #fff; }
.panel { display: none; }
.panel.active { display: block; }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 1.3rem; }

/* list rows */
.rows { display: flex; flex-direction: column; gap: 12px; }
.row-item { background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm); padding: 12px; display: flex; align-items: center; gap: 14px; }
.row-item .rt { width: 74px; height: 60px; border-radius: 10px; object-fit: cover; background: #e9edf6; flex: 0 0 auto; }
.row-item .ri { flex: 1; min-width: 0; }
.row-item .ri h3 { margin: 0; font-size: 1rem; color: var(--ink); font-weight: 500; }
.row-item .ri .meta { color: var(--muted); font-size: .84rem; }
.tagpill { display: inline-block; background: #eef2fb; color: var(--blue); font-size: .74rem; padding: .15em .7em; border-radius: 999px; font-family: var(--head); }
.row-item .ra { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.iconbtn { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--muted); font-size: .95rem; }
.iconbtn:hover { border-color: var(--blue); color: var(--blue); }
.iconbtn.danger:hover { border-color: #c0392b; color: #c0392b; }
.iconbtn.on { background: #eafaf0; border-color: #38b56a; color: #38b56a; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(9,14,33,.55); z-index: 60; display: none; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 30px 14px; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 18px; width: 100%; max-width: 640px; box-shadow: var(--shadow); }
.modal-box .mh { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-box .mh h3 { margin: 0; }
.modal-box .mb { padding: 22px 24px; }
.modal-box .mf { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.close-x { background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--muted); line-height: 1; }

/* image manager */
.imgman { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-top: 8px; }
.imgman .im { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); }
.imgman .im.cover { border-color: var(--gold); }
.imgman .im img { width: 100%; height: 100%; object-fit: cover; }
.imgman .im .del { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.6); color: #fff; border: 0; width: 22px; height: 22px; border-radius: 6px; cursor: pointer; font-size: .8rem; }
.imgman .im .mk { position: absolute; bottom: 3px; left: 3px; right: 3px; background: rgba(0,0,0,.55); color: #fff; border: 0; font-size: .66rem; border-radius: 6px; padding: 2px; cursor: pointer; }
.imgman .im.cover .mk { background: var(--gold); color: #3a2c00; }
.dropzone { border: 2px dashed var(--blue-light); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; background: #f7f9ff; margin-top: 12px; }
.dropzone.drag { background: #eef4ff; border-color: var(--blue); }
.uploading { color: var(--blue); font-size: .85rem; margin-top: 6px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: .8em 1.4em; border-radius: 999px; box-shadow: var(--shadow); z-index: 90; opacity: 0; transition: opacity .25s, transform .25s; font-family: var(--head); font-size: .92rem; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.ok { background: #1f8a4c; }
.toast.bad { background: #c0392b; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } .row-item { flex-wrap: wrap; } }
