/* admin.css - admin panel and login. Separate look from the public site. */
:root {
  --side: #3A0C15; --side-2: #4E0E19; --accent: #E28A1B; --bg: #F4F1EC; --card: #fff; --ink: #241816; --muted: #6E625C;
  --line: #E3DCD2; --maroon: #6E1423; --ok: #1E7A4A; --warn: #B7791F; --bad: #A32020;
  --sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --serif: 'Cormorant Garamond', Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 14.5px; line-height: 1.55; color: var(--ink); background: var(--bg); padding-bottom: 64px; overflow-x: hidden; }
body.modal-open { overflow: hidden; }
a { color: var(--maroon); }
h1, h2, h3 { margin: 0; font-weight: 600; }
:focus-visible { outline: 3px solid #0F5C6E; outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .5rem 1.1rem; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font: 500 .9rem var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { background: #f8f5f0; }
.btn-primary { background: var(--maroon); border-color: var(--maroon); color: #fff; }
.btn-primary:hover { background: #4E0E19; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #241816; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #831818; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 36px; padding: .25rem .75rem; font-size: .82rem; }
.block { width: 100%; }
.ibtn { width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.2rem; border-radius: 8px; cursor: pointer; color: var(--ink); }
.f { margin-bottom: 16px; }
.f > label, .f > .lbl { display: block; font-weight: 500; margin-bottom: 5px; font-size: .86rem; }
.f .help { color: var(--muted); font-size: .78rem; margin-top: 4px; }
.f .req { color: var(--bad); }
input[type=text], input[type=url], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .75rem; border: 1.5px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
input.bad, textarea.bad, select.bad, .rte.bad { border-color: var(--bad); }
.ferr { color: var(--bad); font-size: .8rem; margin-top: 4px; }
.colorf { display: flex; gap: 8px; align-items: center; }
.colorf input[type=color] { width: 54px; min-height: 44px; padding: 3px; flex: none; cursor: pointer; }
.colorf input[type=text] { flex: 1; text-transform: lowercase; }
.presets { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 4px; }
.preset { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 6px; background: #fff; cursor: pointer; font: 500 .84rem var(--sans); }
.preset .sw { display: flex; }
.preset .sw i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); margin-left: -6px; }
.preset .sw i:first-child { margin-left: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; }
.check label { margin: 0; font-weight: 500; }

/* login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 18px; background: linear-gradient(160deg, #3A0C15, #14243F); }
.login-card { width: min(100%, 400px); background: #fff; border-radius: 16px; padding: 30px 26px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); text-align: center; }
.login-card h1 { font-family: var(--serif); font-size: 2rem; color: var(--maroon); }
.login-card form { text-align: left; margin-top: 18px; }
.login-mark { width: 62px; height: 62px; margin: 0 auto 10px; border-radius: 50%; background: var(--maroon); color: var(--accent); overflow: hidden; display: grid; place-items: center; }
.login-mark img { width: 100%; height: 100%; object-fit: cover; }
.login-mark .mono { font: 700 1.7rem var(--serif); }
.sub { color: var(--muted); margin: 0; }
.err { color: var(--bad); margin: 0 0 12px; font-size: .86rem; }
.hint { font-size: .8rem; color: var(--muted); margin: 16px 0 6px; }
.back { font-size: .85rem; }

/* shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; z-index: 90; top: 0; bottom: 0; left: 0; width: 264px; background: var(--side); color: #F1E4C8; overflow-y: auto; transform: translateX(-100%); transition: transform .25s; padding-bottom: 20px; }
.sidebar.open { transform: none; }
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .5); display: none; }
.scrim.on { display: block; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); font-family: var(--serif); font-size: 1.2rem; line-height: 1.15; color: #FFF1CF; }
.side-brand .lm { width: 38px; height: 38px; flex: none; background: var(--accent); color: var(--side); border-radius: 50%; overflow: hidden; display: grid; place-items: center; }
.side-brand .lm img { width: 100%; height: 100%; object-fit: cover; }
.side-brand .lm .mono { font: 700 1.05rem var(--serif); }
.side-brand small { display: block; font: 400 .7rem var(--sans); color: #CDB98F; }
.sidebar nav { padding: 10px 8px; }
.sidebar a, .sidebar button.lo { display: flex; align-items: center; gap: 12px; width: 100%; padding: .65rem .8rem; border-radius: 8px; color: #F1E4C8; text-decoration: none; font: 500 .9rem var(--sans); background: none; border: 0; cursor: pointer; min-height: 44px; text-align: left; }
.sidebar a i, .sidebar button.lo i { width: 20px; text-align: center; color: #E9B863; }
.sidebar a:hover, .sidebar button.lo:hover { background: var(--side-2); }
.sidebar a.active { background: var(--accent); color: #241816; }
.sidebar a.active i { color: #241816; }
.main { flex: 1; min-width: 0; width: 100%; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1.15rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions span { display: none; }
#view { padding: 16px 14px 30px; max-width: 1180px; margin: 0 auto; }
.bnav { position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0); }
.bnav a, .bnav button { flex: 1; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 500 .68rem var(--sans); color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; }
.bnav i { font-size: 1.1rem; }
.bnav .active { color: var(--maroon); }

/* cards */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.stat i { width: 44px; height: 44px; border-radius: 10px; background: #F6E9CF; color: var(--maroon); display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { font-size: .78rem; color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.act { list-style: none; margin: 0; padding: 0; }
.act li { display: flex; gap: 10px; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.act li:last-child { border: 0; }
.act time { color: var(--muted); font-size: .76rem; margin-left: auto; white-space: nowrap; }
.dash-grid { display: grid; gap: 16px; }

/* list header + table */
.list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.list-head h2 { font-size: 1.2rem; flex: 1; min-width: 140px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead { display: none; }
.tbl tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.tbl td { display: flex; justify-content: space-between; gap: 12px; padding: .3rem 0; border: 0; }
.tbl td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; flex: none; }
.tbl td.acts { flex-wrap: wrap; justify-content: flex-start; gap: 6px; padding-top: .6rem; }
.tbl td.acts::before { display: none; }
.thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #eee; }
.badge { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 500; }
.badge.published { background: #DDF3E7; color: var(--ok); }
.badge.draft { background: #FBEBC8; color: var(--warn); }
.badge.archived { background: #E7E4E0; color: #555; }
.badge.unread { background: #FBE0E0; color: var(--bad); }
.badge.read { background: #E7E4E0; color: #555; }
.tt { font-weight: 500; text-align: right; }

/* form */
.form-grid { display: grid; gap: 0 18px; }
.form-bar { position: sticky; bottom: 62px; z-index: 30; display: flex; flex-wrap: wrap; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; box-shadow: 0 -4px 16px rgba(0, 0, 0, .08); }
.form-bar .sp { flex: 1; }
.imgf { border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px; background: #FBFAF7; }
.imgf img { width: 100%; max-width: 260px; aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; background: #eee; display: block; margin-bottom: 8px; }
.imgf .row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.imgf input[type=file] { display: none; }
.filef { border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px; background: #FBFAF7; }
.filef .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filef .fname { font-size: .84rem; color: var(--muted); word-break: break-all; }
.rte-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.rte-tools button { min-width: 40px; min-height: 40px; border: 1.5px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font: 600 .85rem var(--sans); }
.rte { min-height: 200px; padding: .8rem; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; line-height: 1.6; }
.rte h2 { font-size: 1.35rem; } .rte h3 { font-size: 1.15rem; }
.note { background: #FFF3D6; border: 1px solid #EBCB85; border-radius: 10px; padding: .7rem 1rem; font-size: .84rem; margin-bottom: 14px; }
.meter { height: 10px; border-radius: 6px; background: #EEE7DA; overflow: hidden; margin: 6px 0; }
.meter i { display: block; height: 100%; background: var(--accent); }
.empty { text-align: center; padding: 36px 12px; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: 12px; }
.empty-icon { font-size: 2rem; color: var(--accent); }
.msg-body { white-space: pre-wrap; background: #FBFAF7; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-top: 10px; }

/* modal, toast */
.gm-modal { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, .55); display: grid; place-items: center; padding: 14px; }
.gm-modal-box { background: #fff; border-radius: 12px; padding: 20px; width: min(100%, 480px); max-height: 90vh; overflow-y: auto; }
.gm-modal-box h3 { margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
#toasts { position: fixed; z-index: 200; left: 50%; bottom: 76px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 380px); }
.toast { background: #241816; color: #fff; padding: .7rem 1rem; border-radius: 10px; font-size: .88rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); transition: opacity .3s; }
.toast.error { background: var(--bad); }
.toast.out { opacity: 0; }

@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .form-grid .full { grid-column: 1 / -1; }
}
@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .sidebar { transform: none; }
  .main { margin-left: 264px; width: calc(100% - 264px); }
  #menuToggle, .scrim, .bnav { display: none !important; }
  .top-actions span { display: inline; }
  #view { padding: 24px 28px 40px; }
  .dash-grid { grid-template-columns: 1.3fr 1fr; }
  .form-bar { bottom: 12px; }
  #toasts { bottom: 24px; }
  .tbl thead { display: table-header-group; }
  .tbl th { text-align: left; font-size: .76rem; color: var(--muted); font-weight: 500; padding: .5rem .8rem; }
  .tbl { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .tbl tr { display: table-row; border: 0; border-radius: 0; margin: 0; padding: 0; border-top: 1px solid var(--line); }
  .tbl thead tr { border-top: 0; background: #FBFAF7; }
  .tbl td { display: table-cell; padding: .65rem .8rem; vertical-align: middle; }
  .tbl td::before { display: none; }
  .tbl td.acts { white-space: nowrap; }
  .tt { text-align: left; }
}
