/* Moulan Café — admin panel (builds on ../css/site.css tokens) */
body.admin { background: var(--bg); min-height: 100vh; }
.muted { color: var(--muted); }
small { font-weight: 500; color: var(--muted); }

/* auth */
.auth-wrap { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(circle at 15% 15%, var(--accent-200), transparent 40%),
  radial-gradient(circle at 85% 85%, var(--sage-200), transparent 40%), var(--bg); }
.auth-card { width: min(440px, 100%); background: var(--paper); border-radius: var(--radius-lg); padding: clamp(28px, 6vw, 44px); box-shadow: var(--shadow-lg); animation: cardIn .7s var(--ease) both; }
.auth-card h1 { font-size: 32px; margin: 18px 0 8px; }
.auth-brand { font-family: var(--font-heading); font-size: 26px; color: var(--ink); }
.auth-brand span { color: var(--accent-700); }
.auth-brand.small { font-size: 22px; }
.back-to-site { display: block; text-align: center; margin-top: 22px; font-size: 14px; font-weight: 600; }
.a-form { display: grid; gap: 16px; margin-top: 22px; }
.a-form label, .a-label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.a-label { margin-top: 14px; }
.form-error { color: #b0362b; font-size: 14px; font-weight: 600; margin: 0; min-height: 0; }
.form-error:empty { display: none; }
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; translate: 0 -50%; border: 0; background: none; font-size: 18px; cursor: pointer; opacity: .6; padding: 8px; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--surface); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* top bar */
.a-top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 20px; padding: 12px clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.a-tabs { display: flex; gap: 4px; margin-right: auto; }
.a-tabs button { border: 0; background: none; padding: 9px 16px; border-radius: 999px; font: 700 15px var(--font-body); color: var(--muted); cursor: pointer; transition: background .25s, color .25s; }
.a-tabs button:hover { color: var(--ink); }
.a-tabs button.is-active { background: var(--ink); color: #fff; }
.a-user { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; }

.a-main { max-width: 1200px; margin: 0 auto; padding: clamp(24px, 4vw, 44px) clamp(16px, 3vw, 32px) 80px; animation: fadeUp .5s var(--ease) both; opacity: 1; transform: none; }
.a-main.narrow { max-width: 760px; }
.a-main h1 { font-size: clamp(30px, 4vw, 42px); margin-bottom: 6px; }
.a-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.a-head p { margin: 0; }
.a-toolbar { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.search { max-width: 300px; min-height: 46px; background: var(--paper); }

.seg-tabs { display: inline-flex; padding: 4px; gap: 4px; background: var(--paper); border-radius: 999px; box-shadow: var(--shadow-sm); }
.seg-tabs button { border: 0; background: none; padding: 9px 16px; border-radius: 999px; font: 700 14px var(--font-body); color: var(--muted); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; transition: background .25s, color .25s; }
.seg-tabs button b { font-size: 12px; background: var(--surface); color: var(--ink-soft); padding: 1px 8px; border-radius: 999px; }
.seg-tabs button[aria-selected="true"] { background: var(--accent); color: #fff; }
.seg-tabs button[aria-selected="true"] b { background: rgb(255 255 255 / .25); color: #fff; }
.seg-tabs.small button { padding: 6px 12px; font-size: 13px; }

/* list */
.post-list { display: grid; gap: 12px; }
.p-row { display: grid; grid-template-columns: 96px 1fr auto; gap: 18px; align-items: center; padding: 12px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .35s var(--ease), box-shadow .35s var(--ease); animation: cardIn .5s var(--ease) both; border: 0; text-align: left; font: inherit; color: inherit; width: 100%; }
.p-row:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.p-row img { width: 96px; height: 72px; object-fit: cover; border-radius: 12px; background: var(--surface); }
.p-row h3 { font-family: var(--font-body); font-weight: 700; font-size: 17px; margin: 0 0 4px; }
.p-row .meta { font-size: 13px; }
.p-row .go { font-weight: 700; font-size: 14px; color: var(--accent-700); padding-right: 8px; }
.empty { text-align: center; padding: 60px 20px; background: var(--paper); border-radius: var(--radius); color: var(--muted); }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.ed-main { background: var(--paper); border-radius: var(--radius-lg); padding: clamp(18px, 3vw, 32px); box-shadow: var(--shadow-sm); }
.ed-title { width: 100%; border: 0; background: none; font: 400 clamp(28px, 3.6vw, 40px)/1.15 var(--font-heading); color: var(--ink); padding: 4px 0; outline: none; }
.ed-title::placeholder { color: #b9ae9c; }
.ed-slug { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13px; color: var(--muted); margin: 6px 0 4px; }
.ed-slug input { border: 0; border-bottom: 1px dashed var(--line); background: none; font: 600 13px var(--font-body); color: var(--accent-700); min-width: 200px; flex: 1; padding: 2px 0; outline: none; }
.ed-bodyhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; }
.md-bar { display: flex; flex-wrap: wrap; gap: 4px; }
.md-bar button { min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; font: 600 14px var(--font-body); color: var(--ink); transition: background .2s, border-color .2s; }
.md-bar button:hover { background: #fff; border-color: var(--ink); }
.ed-body { min-height: 420px; font-size: 17px; line-height: 1.7; border-radius: 16px; }
.ed-preview { min-height: 420px; padding: 8px 4px; max-width: none; }
.hint { font-size: 13px; color: var(--muted); margin: 12px 0 0; line-height: 1.8; }
.hint code { background: var(--surface); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

.ed-side { display: grid; gap: 18px; position: sticky; top: 84px; }
.side-card { background: var(--paper); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 0; }
.a-main > .side-card { margin-top: 22px; }
.side-card h3 { font-family: var(--font-body); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.side-actions { display: grid; gap: 10px; }
.view-link { display: block; text-align: center; margin-top: 14px; font-weight: 700; font-size: 14px; }
.danger-link, .link-btn { display: block; width: 100%; margin-top: 12px; border: 0; background: none; font: 600 14px var(--font-body); cursor: pointer; padding: 6px; }
.danger-link { color: #b0362b; }
.link-btn { color: var(--accent-700); }
.status-pill { font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 999px; background: var(--surface); }
.status-pill.pub { background: var(--sage-200); color: var(--sage-700); }
.status-pill.draft { background: var(--accent-100); color: var(--accent-700); }
.back-link { border: 0; background: none; cursor: pointer; color: var(--accent-700); font-family: var(--font-body); }

.dropzone { position: relative; aspect-ratio: 16 / 10; border-radius: 16px; border: 2px dashed var(--line); background: var(--bg); display: grid; place-items: center; text-align: center; cursor: pointer; overflow: hidden; transition: border-color .25s, background .25s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-100); }
.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dz-empty { display: grid; gap: 4px; font-size: 14px; color: var(--muted); padding: 12px; }
.dz-empty strong { color: var(--ink); }
.dropzone img:not([hidden]) + .dz-empty { display: none; }
.dz-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgb(0 0 0 / .1); }
.dz-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.library { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; max-height: 260px; overflow-y: auto; }
.library button { border: 2px solid transparent; padding: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; cursor: pointer; background: var(--surface); }
.library button:hover { border-color: var(--accent); }
.library img { width: 100%; height: 100%; object-fit: cover; }

.user-list { list-style: none; padding: 0; margin: 14px 0 22px; display: grid; gap: 8px; }
.user-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg); border-radius: 14px; }
.user-list small { display: block; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.span-2 { grid-column: 1 / -1; }

.toasts { position: fixed; z-index: 500; left: 50%; bottom: 24px; translate: -50% 0; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 15px; animation: toastIn .45s var(--ease) both; }
.toast.err { background: #a8322a; }
.toast.out { animation: toastOut .35s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; }
  .ed-side { position: static; }
}
@media (max-width: 640px) {
  .a-top { flex-wrap: wrap; gap: 10px; }
  .a-tabs { order: 3; width: 100%; }
  .a-tabs button { flex: 1; }
  .a-user span { display: none; }
  .a-user { margin-left: auto; }
  .p-row { grid-template-columns: 72px 1fr; gap: 12px; }
  .p-row img { width: 72px; height: 60px; }
  .p-row .go { display: none; }
  .search { max-width: none; width: 100%; }
  .seg-tabs { width: 100%; }
  .seg-tabs button { flex: 1; justify-content: center; }
  .ed-bodyhead .seg-tabs { width: auto; }
  .ed-body { min-height: 320px; font-size: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  #btn-new { width: 100%; }
}
