/* PageTurner brand: white with a little blue and green. Edit these colours to re-skin the admin and landing page. */
:root { --blue: #2f6bff; --green: #12a05c; --ink: #14182b; --muted: #5d6680; --line: #e3e8f2; --bg: #f6f8fc; --white: #fff; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
[hidden] { display: none !important; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; }
button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; background: var(--blue); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { filter: brightness(1.1); }
button.secondary, .btn.secondary { background: #fff; color: var(--blue); border: 1px solid var(--line); }
button.green { background: var(--green); }
button.danger { background: #fff; color: #b3261e; border: 1px solid #f0c8c5; }
button.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
button:disabled { opacity: .55; cursor: default; }
input, textarea, select { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid #cdd5e6; border-radius: 8px; background: #fff; color: var(--ink); }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; height: 40px; width: 64px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); border-color: transparent; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.error { color: #b3261e; font-size: 14px; min-height: 18px; }
.ok { color: #1b7a3e; font-size: 14px; }

/* landing */
.hero { max-width: 760px; margin: 0 auto; padding: 96px 24px; text-align: center; }
.hero h1 { font-size: clamp(32px, 6vw, 52px); line-height: 1.1; }
.hero h1 span { color: var(--green); }
.hero p { color: var(--muted); font-size: 18px; margin: 20px 0 32px; }

/* admin */
.login { max-width: 400px; margin: 12vh auto; padding: 32px; background: #fff; border-radius: 16px; box-shadow: 0 10px 40px rgba(20,40,100,.10); display: flex; flex-direction: column; gap: 14px; }
.shell { display: flex; min-height: 100vh; }
#nav { width: 248px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px; gap: 14px; }
.nav-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 10px 8px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.01em; display: flex; align-items: center; }
.brand i { color: var(--green); font-style: normal; }
.navtoggle { display: none; background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 6px 10px; }
.nav-items { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-items .grp { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.nav-items button { background: transparent; color: var(--ink); justify-content: flex-start; width: 100%; padding: 10px 12px; font-weight: 600; font-size: 14px; border-radius: 10px; gap: 12px; position: relative; }
.nav-items button .ic { color: var(--muted); width: 20px; height: 20px; }
.nav-items button:hover { background: var(--bg); filter: none; }
.nav-items button.on { background: color-mix(in srgb, var(--blue) 10%, #fff); color: var(--blue); }
.nav-items button.on .ic { color: var(--blue); }
.nav-items button.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--green); }
.nav-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.nav-foot select { width: 100%; }
.nav-foot .hint { word-break: break-all; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.legal { text-align: center; font-size: 13px; margin: 8px 0 24px; }
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  #nav { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; gap: 8px; }
  .navtoggle { display: inline-flex; }
  .nav-items, .nav-foot { display: none; }
  #nav.open .nav-items, #nav.open .nav-foot { display: flex; }
}
main { max-width: 1180px; width: 100%; margin: 0 auto; padding: 28px 32px; }
@media (max-width: 860px) { main { padding: 18px 16px; } }
#view > .row > h2 { font-size: 26px; letter-spacing: -.01em; }
#view h3 { margin: 28px 0 10px; font-size: 16px; }
#view table { box-shadow: 0 1px 2px rgba(20,40,100,.04); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.pub { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.pub .thumb { aspect-ratio: 4 / 3; background: #e8eefb center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.pub .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pub h3 { font-size: 16px; }
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #e6f4ea; color: #1b7a3e; }
.badge.draft { background: #fdf0d5; color: #8a5a00; }
.badge.lock { background: #e8eefb; color: var(--blue); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: #f6f8fc; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.modal-bg { position: fixed; inset: 0; background: rgba(20,10,35,.55); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow: auto; z-index: 10; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: min(94vw, 560px); display: flex; flex-direction: column; gap: 14px; }
.modal pre { background: #eef2fa; padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; margin: 0; white-space: pre-wrap; word-break: break-all; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 1px 2px rgba(20,40,100,.04); }
.stat b { font-size: 24px; display: block; }
.stat span { font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 6px; }
.bars div { flex: 1; background: var(--blue); border-radius: 3px 3px 0 0; min-height: 2px; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--green); transition: width .2s; }

/* link editor */
.modal.wide { width: min(96vw, 1000px); }
.ed { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
@media (max-width: 760px) { .ed { grid-template-columns: minmax(0, 1fr); } }
.stagebox { position: relative; line-height: 0; background: #eee; border-radius: 8px; overflow: hidden; touch-action: none; max-width: 100%; }
.stagebox canvas { width: 100%; height: auto; display: block; }
.ov { position: absolute; inset: 0; cursor: crosshair; }
.box { position: absolute; border: 2px dashed var(--green); background: rgba(18,160,92,.12); cursor: pointer; }
.box.off { border: 2px dotted #888; background: rgba(120,120,120,.22); }
.box.man { border: 2px solid var(--blue); background: rgba(47,107,255,.2); }
.box.sel { outline: 3px solid var(--green); }
.box.draft { pointer-events: none; }
.side { display: flex; flex-direction: column; gap: 10px; }
.side .legend span { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 2px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

.ic { flex: none; vertical-align: -3px; }
.iconbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.iconbtns .small { padding: 7px 10px; font-size: 13px; }
.stats .stat { position: relative; }
.stats .stat .ic { color: var(--blue); width: 22px; height: 22px; margin-bottom: 4px; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin: 8px 0 24px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 1px 2px rgba(20,40,100,.05); }
.tile:hover { border-color: var(--blue); box-shadow: 0 6px 20px rgba(20,40,100,.1); }
.tile .ic { width: 28px; height: 28px; color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, #fff); padding: 8px; box-sizing: content-box; border-radius: 12px; margin-bottom: 8px; }
.tile b { font-size: 15px; }
.tile span { font-size: 13px; color: var(--muted); font-weight: 400; }
.tile.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.tile.primary .ic { color: #fff; background: rgba(255,255,255,.2); }
.tile.primary span { color: rgba(255,255,255,.85); }

.tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: transparent; color: var(--muted); border-radius: 0; padding: 12px 14px; border-bottom: 3px solid transparent; }
.tabs button.on { color: var(--blue); border-bottom-color: var(--green); }
