/* Flipper admin — by Reid & Wright */
:root {
  --ink: #121826; --ink-2: #2A3242; --dim: #5B6475; --faint: #8A92A2;
  --paper: #F7F4EE; --card: #FFFFFF; --line: #E6E1D8; --line-2: #EFEBE4;
  --accent: #E8452C; --accent-2: #C93A23; --accent-soft: #FDE9E4;
  --ok: #1E8E5A; --ok-soft: #E3F4EA; --warn: #B7791F; --warn-soft: #FBF0D9;
  --radius: 12px; --shadow: 0 1px 2px rgba(18,24,38,.05), 0 6px 20px rgba(18,24,38,.06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { letter-spacing: -.01em; }
.serif { font-family: Fraunces, Georgia, serif; }

/* top nav */
.topbar { position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; gap: 24px; padding: 0 22px; background: rgba(247,244,238,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 34px; height: 34px; }
.brand .wm { line-height: 1; }
.brand .wm b { display: block; font-family: Fraunces, Georgia, serif; font-weight: 800; font-size: 22px; letter-spacing: -.03em; }
.brand .wm small { display: block; font-size: 8.5px; letter-spacing: .26em; font-weight: 600; color: var(--dim); margin-top: 3px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--dim); text-decoration: none; font-weight: 550; }
.nav a:hover { background: var(--line-2); color: var(--ink); }
.nav a.on { background: var(--ink); color: #fff; }
.topbar .spacer { flex: 1; }

/* buttons & fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #CFC8BC; background: #FCFBF8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: var(--ink-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: #B42318; }
.btn.danger:hover { background: #FEECEB; border-color: #F5C2BE; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field > small { display: block; color: var(--faint); font-size: 12px; margin-top: 4px; }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 9px 11px; min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: flex; gap: 10px; align-items: center; }
.row > .field { flex: 1; }
.check { display: flex; align-items: center; gap: 9px; margin: 8px 0; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; cursor: pointer; font-size: 13.5px; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: #D7D1C6; position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; width: 100%; }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-weight: 550; color: var(--dim); font-size: 13px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.color-in { display: flex; gap: 8px; align-items: center; }
.color-in input[type=color] { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: #fff; cursor: pointer; }

/* layout */
.page { max-width: 1320px; margin: 0 auto; padding: 26px 22px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-family: Fraunces, Georgia, serif; font-weight: 750; font-size: 30px; }
.page-head p { margin: 2px 0 0; color: var(--dim); }
.library { display: grid; grid-template-columns: 240px 1fr; gap: 26px; }
@media (max-width: 860px) { .library { grid-template-columns: 1fr; } }
.side h4 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 4px 8px 8px; }
.publist button.pub { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; font-weight: 550; color: var(--ink-2); }
.publist button.pub:hover { background: var(--line-2); }
.publist button.pub.on { background: #fff; box-shadow: var(--shadow); color: var(--ink); }
.publist .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.publist .count { margin-left: auto; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.publist .edit { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--faint); padding: 2px; display: grid; }
.publist button.pub:hover .edit { opacity: 1; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.toolbar .search svg { position: absolute; left: 11px; top: 10px; color: var(--faint); }
.toolbar .search input { padding-left: 36px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(18,24,38,.06), 0 14px 30px rgba(18,24,38,.1); }
.card .cv { aspect-ratio: 4/3.6; background: linear-gradient(135deg, #EEE9E0, #E4DED3); display: flex; align-items: flex-start; justify-content: center; padding-top: 14px; overflow: hidden; position: relative; cursor: pointer; }
.card .cv img { width: 66%; box-shadow: 0 6px 18px rgba(0,0,0,.18); background: #fff; display: block; }
.card .cv .ph { width: 66%; aspect-ratio: 3/4; background: #fff; display: grid; place-items: center; color: var(--faint); font-size: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.card .body { padding: 12px 14px 10px; flex: 1; }
.card .pubtag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 650; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.card .pubtag i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.card h3 { margin: 4px 0 2px; font-size: 15px; line-height: 1.3; }
.card .meta { color: var(--faint); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; }
.card .foot { display: flex; gap: 4px; padding: 8px 10px 10px; border-top: 1px solid var(--line-2); align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.badge.pub { background: var(--ok-soft); color: var(--ok); }
.badge.draft { background: var(--warn-soft); color: var(--warn); }
.card .cv .badge { position: absolute; top: 10px; left: 10px; }
.empty-state { text-align: center; padding: 70px 20px; color: var(--dim); background: var(--card); border-radius: var(--radius); border: 2px dashed var(--line); }
.empty-state h3 { color: var(--ink); font-family: Fraunces, Georgia, serif; font-size: 22px; margin: 10px 0 6px; }

/* menus & dialogs */
.menu { position: fixed; z-index: 80; min-width: 200px; background: #fff; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.18); padding: 6px; border: 1px solid var(--line); }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; text-align: left; font-size: 13.5px; }
.menu button:hover { background: var(--line-2); }
.menu button.danger { color: #B42318; }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 0; }
.dialog-bg { position: fixed; inset: 0; background: rgba(18,24,38,.45); z-index: 70; display: grid; place-items: center; padding: 20px; animation: fade .15s; backdrop-filter: blur(2px); }
.dialog { background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.3); width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; animation: pop .2s ease-out; }
.dialog.wide { width: min(760px, 100%); }
.dialog header { padding: 20px 24px 6px; display: flex; justify-content: space-between; align-items: center; }
.dialog header h2 { margin: 0; font-size: 20px; font-family: Fraunces, Georgia, serif; }
.dialog .content { padding: 10px 24px 6px; }
.dialog footer { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 30px 20px; text-align: center; cursor: pointer; transition: .15s; background: #FCFBF8; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { display: block; font-size: 15px; margin: 6px 0 2px; }
.drop small { color: var(--dim); }
.progress { height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.progress-label { font-size: 13px; color: var(--dim); display: flex; justify-content: space-between; }
.code { font: 12px/1.45 ui-monospace, Menlo, monospace; background: #F4F1EB; border: 1px solid var(--line); border-radius: 9px; padding: 10px; width: 100%; resize: vertical; color: var(--ink-2); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 550; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; font-size: 13.5px; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.toast.err { background: #B42318; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; font-weight: 600; color: var(--dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(circle at 15% 20%, rgba(232,69,44,.12), transparent 40%), radial-gradient(circle at 85% 80%, rgba(18,24,38,.10), transparent 45%), var(--paper); }
.login { width: min(380px, 100%); background: #fff; border-radius: 18px; padding: 34px 30px 28px; box-shadow: 0 30px 80px rgba(18,24,38,.12); }
.login img { display: block; margin: 0 auto 22px; width: 210px; }
.login .err { color: #B42318; font-size: 13px; min-height: 18px; margin: 4px 0 8px; }
