/* admin panel: clean lists (one row per item, main info left, buttons at the end) */
:root { --ink: #1c2a44; --text: #2c3039; --muted: #6c717c; --line: #e8e3d9; --gold: #a9834b; --soft: #faf8f4; --ok: #2f7a4d; --err: #b3402f; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.6 "Inter", system-ui, sans-serif; color: var(--text); background: var(--soft); }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 600; }
a { color: var(--ink); }

.b { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 6px 12px; font: 500 14px inherit; font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.b:hover { border-color: var(--gold); }
.b.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.b.dark:hover { background: #2a3d61; }
.b.red { color: var(--err); }
.b.sm { padding: 3px 9px; font-size: 13px; }
.b:disabled { opacity: .5; cursor: default; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 34px; width: min(380px, 100%); display: grid; gap: 14px; }
.login-box h1 { font-family: Georgia, serif; font-size: 26px; }
.login-box p { margin: -10px 0 4px; }
.note { margin: 0; min-height: 1.4em; font-size: 14px; }
.note.err { color: var(--err); }
.note.ok { color: var(--ok); }

/* layout */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 20px; }
.bar-r { display: flex; gap: 8px; }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 55px); }
.side { border-right: 1px solid var(--line); background: #fff; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.side a { text-decoration: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.side a:hover { background: var(--soft); color: var(--ink); }
.side a.on { background: var(--ink); color: #fff; }
.side .grp { margin: 16px 12px 4px; font-size: 12.5px; color: var(--gold); font-weight: 600; }
.side .badge { background: var(--err); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 7px; }
.main { padding: 24px 28px 80px; max-width: 980px; width: 100%; }
.main > h2 { font-size: 22px; margin-bottom: 4px; }
.main > .muted { margin: 0 0 20px; }

/* panels & forms */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.panel > h3 { font-size: 16px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
label.f { display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); }
label.f.full { grid-column: 1 / -1; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 15px inherit; font-family: inherit; color: var(--text); background: #fff; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
textarea { min-height: 90px; resize: vertical; }
textarea.tall { min-height: 200px; }
input[type=checkbox] { width: auto; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--soft) 30%); padding: 18px 0 10px; display: flex; gap: 12px; align-items: center; }

/* the list */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.off { opacity: .5; }
.row .mv { display: flex; flex-direction: column; gap: 2px; }
.row .mv button { border: 1px solid var(--line); background: #fff; border-radius: 5px; width: 26px; height: 18px; line-height: 1; font-size: 10px; cursor: pointer; color: var(--muted); padding: 0; }
.row .mv button:hover:not(:disabled) { border-color: var(--gold); color: var(--ink); }
.row .mv button:disabled { opacity: .3; cursor: default; }
.row .th { width: 54px; height: 42px; border-radius: 6px; object-fit: cover; background: var(--soft); flex: none; }
.row .th.cover { width: 34px; height: 46px; object-fit: contain; }
.row .main-t { flex: 1; min-width: 0; }
.row .main-t b { color: var(--ink); font-weight: 500; display: block; overflow-wrap: anywhere; }
.row .main-t span { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.row .fig { color: var(--gold); font-size: 14px; white-space: nowrap; }
.row .btns { display: flex; gap: 6px; flex: none; }
.row input { flex: 1; min-width: 0; }
.empty { color: var(--muted); padding: 14px 0; margin: 0; }
.tag { display: inline-block; font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; color: var(--muted); margin-left: 6px; }
.msg-text { white-space: pre-wrap; color: var(--text) !important; font-size: 14.5px !important; display: block; margin-top: 4px; }
.row.unread b::before { content: "● "; color: var(--err); }

/* photo picker */
.pic { display: flex; gap: 14px; align-items: center; }
.pic img { width: 84px; height: 104px; object-fit: cover; border-radius: 42px 42px 8px 8px; background: var(--soft); border: 1px solid var(--line); }
.pic.wide img { width: 160px; height: 90px; border-radius: 8px; }
.pic .pic-b { display: grid; gap: 8px; }

/* dialog */
.dlg { border: 0; border-radius: 14px; padding: 0; width: min(640px, 96vw); max-height: 92vh; }
.dlg::backdrop { background: rgba(20, 24, 33, .5); }
.dlg form { padding: 22px; display: grid; gap: 12px; }
.dlg h3 { font-size: 18px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 100; font-size: 14.5px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); }
.toast.err { background: var(--err); }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; position: sticky; top: 55px; z-index: 9; }
  .side a { white-space: nowrap; }
  .side .grp { display: none; }
  .main { padding: 18px 14px 80px; }
  .grid2 { grid-template-columns: 1fr; }
  .row { flex-wrap: wrap; }
  .row .main-t { flex-basis: calc(100% - 50px); }
  .row .btns { width: 100%; justify-content: flex-end; }
  .bar { padding: 10px 14px; }
}
