@import url("/assets/reader-typography.css");
@import url("/assets/workspace-patterns.css");

/* morenou.se CMS admin, adapted from design/admin-ui-kit.html. No em dashes. */
:root {
  --canvas:#f7f6f3; --panel:#fff; --card:#faf9f7;
  --line:rgba(26,25,22,.10); --line-strong:rgba(26,25,22,.16);
  --ink:var(--ds-ink); --text:var(--ds-text); --muted:var(--ds-muted); --soft:#969188;
  --accent:var(--ds-accent); --accent-weak:#eaf0ed;
  --ok:#3f7d5a; --ok-weak:#e7f1eb; --warn:#b7791f; --warn-weak:#f7efe0;
  --danger:#b4453a; --danger-weak:#f6e7e5;
  --radius:11px; --radius-sm:8px; --radius-lg:16px;
  --shadow-sm:0 1px 2px rgba(26,25,22,.05); --shadow:0 4px 16px rgba(26,25,22,.08);
  --sans:system-ui,-apple-system,"Segoe UI",sans-serif;
  --serif:"Anthropic Serif Display",serif;
  --mono:ui-monospace,"SF Mono",Menlo,monospace;
}
* { box-sizing:border-box; }
body.kit { margin:0; background:var(--canvas); color:var(--text); font-family:var(--sans); font-size:14px; line-height:1.5; -webkit-font-smoothing:antialiased; }
.kit :focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:4px; }
a { color:var(--accent); }

/* buttons */
.btn { font:550 13.5px var(--sans); border-radius:var(--radius-sm); padding:9px 15px; cursor:pointer; border:1px solid transparent; display:inline-flex; align-items:center; gap:7px; transition:background .15s,border-color .15s; white-space:nowrap; text-decoration:none; }
.btn-primary { background:var(--ink); color:#fff; } .btn-primary:hover { background:#000; }
.btn-primary[disabled] { opacity:.5; cursor:progress; }
.btn-secondary { background:var(--panel); color:var(--ink); border-color:var(--line-strong); box-shadow:var(--shadow-sm); }
.btn-secondary:hover { background:var(--card); }
.btn-ghost { background:transparent; color:var(--muted); } .btn-ghost:hover { background:var(--card); color:var(--ink); }
.btn-sm { font-size:12.5px; padding:6px 11px; }

/* pills / status */
.pill { display:inline-flex; align-items:center; gap:6px; font-size:11.5px; font-weight:600; padding:3px 10px; border-radius:999px; border:1px solid transparent; }
.pill .dot { width:6px; height:6px; border-radius:50%; background:currentColor; }
.pill-neutral { background:var(--card); color:var(--muted); border-color:var(--line); }
.pill-published { background:var(--ok-weak); color:var(--ok); }
.status { display:inline-flex; align-items:center; gap:7px; font-size:12.5px; font-weight:600; padding:5px 11px; border-radius:999px; }
.status .dot { width:7px; height:7px; border-radius:50%; }
.status.saved { background:var(--ok-weak); color:var(--ok); } .status.saved .dot { background:var(--ok); }
.status.saving { background:var(--warn-weak); color:var(--warn); } .status.saving .dot { background:var(--warn); }
.status.unsaved { background:var(--card); color:var(--muted); border:1px solid var(--line-strong); } .status.unsaved .dot { background:var(--soft); }
.status.err { background:var(--danger-weak); color:var(--danger); } .status.err .dot { background:var(--danger); }

/* inputs */
.field { display:flex; flex-direction:column; gap:6px; }
.field label { font-size:12.5px; font-weight:600; color:var(--ink); }
.field .hint, .hint { font-size:12px; color:var(--soft); }
.input, .textarea, .select { font:14px var(--sans); color:var(--text); background:var(--panel); border:1px solid var(--line-strong); border-radius:var(--radius-sm); padding:10px 12px; width:100%; }
.input:focus, .textarea:focus, .select:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-weak); }
.textarea { resize:vertical; min-height:80px; line-height:1.55; }
.banner { padding:11px 14px; border-radius:var(--radius-sm); font-size:13px; margin-bottom:14px; }
.banner-error { background:var(--danger-weak); color:var(--danger); }
.banner-success { background:var(--ok-weak); color:var(--ok); }
.admin-form-title { margin:0 0 5px; color:var(--ink); font-family:var(--serif); font-size:24px; font-weight:400; }
.access-admin-form .btn-primary { align-self:flex-start; }

/* segmented */
.segmented { display:inline-flex; background:var(--card); border:1px solid var(--line); border-radius:var(--radius-sm); padding:3px; gap:3px; }
.segmented button { font:550 13px var(--sans); color:var(--muted); background:transparent; border:0; padding:6px 12px; border-radius:6px; cursor:pointer; }
.segmented button[aria-selected="true"] { background:var(--panel); color:var(--ink); box-shadow:var(--shadow-sm); }

/* login */
.auth-wrap { min-height:100vh; display:grid; place-items:center; padding:24px; }
.rail-mark { width:38px; height:38px; border-radius:9px; background:var(--ink); color:#fff; display:grid; place-items:center; font-family:var(--serif); font-size:20px; margin:0 auto 14px; }
.login-card { width:100%; max-width:360px; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-lg); box-shadow:var(--shadow); padding:30px; }
.login-card h3 { font-family:var(--serif); font-weight:400; text-align:center; font-size:22px; margin:0 0 4px; color:var(--ink); }
.login-card .sub { text-align:center; color:var(--soft); font-size:13px; margin:0 0 22px; }
.login-card .field { margin-bottom:14px; }
.login-card .btn { width:100%; justify-content:center; }

/* shell */
.shell { min-height:100vh; display:flex; flex-direction:column; }
.topbar { display:flex; align-items:center; gap:12px; padding:12px 20px; border-bottom:1px solid var(--line); background:var(--panel); flex-wrap:wrap; }
.crumbs { font-size:13px; color:var(--muted); } .crumbs a { color:var(--muted); text-decoration:none; } .crumbs b { color:var(--ink); } .crumbs .sep { color:var(--soft); margin:0 4px; }
.topbar .spacer, .ed-foot .spacer { flex:1; }
.shell-content { padding:22px; }

/* post list */
.list { width:100%; max-width:820px; margin:0 auto; display:flex; flex-direction:column; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; background:var(--panel); }
.post-row { display:grid; grid-template-columns:1fr auto auto; gap:14px; align-items:center; padding:15px 18px; text-decoration:none; color:inherit; border-bottom:1px solid var(--line); }
.post-row:last-child { border-bottom:0; }
.post-row:hover { background:var(--card); }
.post-row h4 { margin:0 0 3px; font-size:15px; color:var(--ink); }
.post-row .sub { font-size:12.5px; color:var(--soft); }
.post-row .arrow { color:var(--soft); }

/* editor */
/* Sticky so the formatting tools never scroll out of reach on a long article. Sits at the top
   of the viewport; the breadcrumb/tabs above it scroll away, the save dock stays pinned below. */
.ed-bar { position:sticky; top:0; z-index:30; display:flex; align-items:center; gap:5px; padding:8px 16px; border-bottom:1px solid var(--line); background:var(--card); flex-wrap:wrap; }
.ed-tool { position:relative; min-width:32px; height:32px; padding:0 8px; border-radius:7px; border:1px solid transparent; background:transparent; color:var(--muted); cursor:pointer; display:grid; place-items:center; font-size:14px; }

/* Own tooltip (the native title= is stripped in JS so this is the only one). Reads the label
   from aria-label, appears just below the button on hover after a short beat. */
.ed-tool::after {
  content: attr(aria-label);
  position:absolute; top:calc(100% + 6px); left:50%; transform:translateX(-50%) translateY(-2px);
  white-space:nowrap; background:var(--ink); color:#fff; font-size:11.5px; font-weight:500;
  padding:4px 8px; border-radius:6px; pointer-events:none; opacity:0; z-index:50;
  transition:opacity 120ms ease 250ms, transform 120ms ease 250ms;
}
.ed-tool:hover::after { opacity:1; transform:translateX(-50%) translateY(0); }
.ed-tool svg { width:16px; height:16px; flex:none; }
.ed-tool:hover { background:var(--panel); color:var(--ink); box-shadow:var(--shadow-sm); }
.ed-tool.on, .ed-tool:active { background:var(--panel); color:var(--ink); box-shadow:var(--shadow-sm); }
.ed-tool.txt { font-family:var(--serif); font-weight:600; }
.ed-div { width:1px; height:20px; background:var(--line-strong); margin:0 4px; flex:none; }
.ed-body { flex:1; }
.ed-pane { max-width:820px; margin:0 auto; }
.ed-canvas { padding:34px clamp(18px,5vw,50px); min-height:50vh; outline:none; }
.ed-canvas:focus { outline:none; }
.meta-form { max-width:620px; margin:0 auto; padding:28px 18px; display:flex; flex-direction:column; gap:18px; }
.ed-source { width:100%; min-height:56vh; margin-top:20px; font-family:var(--mono); font-size:12.5px; line-height:1.65; color:var(--text); background:var(--card); border:1px solid var(--line); border-radius:var(--radius-sm); padding:16px; }
#pane-source { padding:0 18px 18px; }
.versions { max-width:620px; margin:0 auto; padding:24px 18px; display:flex; flex-direction:column; gap:8px; }
.version-row { display:flex; align-items:center; justify-content:space-between; padding:11px 14px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--panel); }
.v-id { font-size:13px; color:var(--ink); font-variant-numeric:tabular-nums; }
.ed-foot { display:flex; align-items:center; gap:14px; padding:11px 20px; border-top:1px solid var(--line); background:var(--card); }
.ed-foot .metric { font-size:12.5px; color:var(--soft); text-decoration:none; }

/* section heading in the content list */
.list-heading { max-width:820px; margin:28px auto 10px; font-family:var(--serif); font-weight:400; font-size:18px; color:var(--ink); }

/* ── Sticky action dock ────────────────────────────────────────────────────
   Save must never scroll out of reach. Fixed to the viewport bottom on every
   editor; body.has-dock reserves the space so the last field is never hidden. */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(14px, 3vw, 22px);
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 22px rgba(26, 25, 22, .07);
}
.dock .spacer { flex: 1; }
.dock .metric { font-size: 12.5px; color: var(--soft); text-decoration: none; white-space: nowrap; }
.dock .metric:hover { color: var(--ink); }
.dock .btn-primary { padding: 10px 20px; font-size: 14px; }
body.kit.has-dock { padding-bottom: 78px; }

@media (max-width: 640px) {
  .dock { gap: 10px; padding: 10px 12px; }
  .dock-hide-sm { display: none; }
  .dock .btn-primary { flex: 1; justify-content: center; }
}


/* ── Components ported from design/admin-ui-kit.html ──────────────────────
   admin.css is now the SINGLE source. /admin/library.html renders from this
   file, so the guide cannot drift from the app again. */
.btn:active { transform: translateY(0.5px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary:hover { background: #000; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #445f55; }
.btn-ghost:hover { background: var(--card); color: var(--ink); }
.btn-danger { background: var(--panel); color: var(--danger); border-color: var(--danger-weak); box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: var(--danger-weak); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; padding: 0; justify-content: center; background: var(--panel); border: 1px solid var(--line-strong); color: var(--muted); border-radius: var(--radius-sm); cursor: pointer; box-shadow: var(--shadow-sm); transition: background .15s, color .15s, border-color .15s; }
.icon-btn:hover { background: var(--card); color: var(--ink); border-color: var(--soft); }
/* In-app prompt modal, replacing the browser's prompt() for links, media, bookmarks. */
.cms-modal-overlay {
  position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center;
  padding:20px; background:rgba(26,25,22,.42); opacity:0; transition:opacity 140ms ease;
}
.cms-modal-overlay.in { opacity:1; }
.cms-modal {
  width:100%; max-width:460px; background:var(--panel); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:0 24px 60px rgba(26,25,22,.28); overflow:hidden;
  transform:translateY(8px) scale(.985); transition:transform 160ms cubic-bezier(.2,.7,.2,1);
}
.cms-modal-overlay.in .cms-modal { transform:none; }
.cms-modal h3 { margin:0; padding:18px 22px 4px; font-family:var(--serif); font-size:19px; color:var(--ink); }
.cms-modal .cms-modal-body { padding:8px 22px 4px; display:flex; flex-direction:column; gap:14px; }
.cms-modal .field { display:flex; flex-direction:column; gap:5px; }
.cms-modal label { font-size:12.5px; font-weight:600; color:var(--muted); }
.cms-modal .hint { font-weight:400; color:var(--soft); }
.cms-modal .cms-modal-foot { display:flex; justify-content:flex-end; gap:10px; padding:16px 22px 20px; }

/* Audio replace control, in the Details panel. */
.audio-field .audio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.audio-field .audio-state {
  font-size: 13px;
  color: var(--muted);
}

.pill-draft { background: var(--card); color: var(--soft); border-color: var(--line-strong); }
.pill-unsaved { background: var(--warn-weak); color: var(--warn); }
.pill-error { background: var(--danger-weak); color: var(--danger); }
.pill-accent { background: var(--accent-weak); color: var(--accent); }
.tag { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--line); padding: 4px 9px; border-radius: 6px; }
.input::placeholder, .textarea::placeholder { color: var(--soft); }
.field.is-error .input { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-weak); }
.field.is-error .hint { color: var(--danger); }
.select-wrap { position: relative; }
.select { appearance: none; padding-right: 34px; cursor: pointer; }
.select-wrap svg { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--soft); pointer-events: none; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--soft); }
.search .input { padding-left: 36px; }
.track { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.segmented button svg { width: 14px; height: 14px; }
.choice input { width: 17px; height: 17px; accent-color: var(--accent); }
.rail { background: var(--card); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; min-height: 340px; }
.nav-group-label { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); font-weight: 600; padding: 12px 9px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: var(--radius-sm); color: var(--muted); font-size: 13.5px; font-weight: 500; text-decoration: none; cursor: pointer; transition: background .15s, color .15s; }
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item:hover { background: var(--panel); color: var(--ink); }
.nav-item.active { background: var(--accent-weak); color: var(--ink); font-weight: 600; }
.nav-item .count { margin-left: auto; font-size: 11px; color: var(--soft); font-variant-numeric: tabular-nums; }
.shell-main { display: flex; flex-direction: column; min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: var(--soft); }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat .v { font-family: var(--serif); font-size: 30px; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; }
.stat .d { font-size: 12px; color: var(--soft); }
.post { display: grid; grid-template-columns: 62px 1fr auto; gap: 16px; align-items: center; padding: 14px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); transition: background .15s; }
.post:last-child { border-bottom: 0; }
.post:hover { background: var(--card); }
.post-main { min-width: 0; }
.post-main h4 { margin: 0 0 3px; font-size: 15px; color: var(--ink); font-weight: 600; }
.post-main .sub { font-size: 12.5px; color: var(--soft); display: flex; gap: 10px; flex-wrap: wrap; }
.post-actions { display: flex; align-items: center; gap: 8px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 460px; background: var(--panel); }
.tbl th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { font-variant-numeric: tabular-nums; color: var(--muted); }
.empty .em-ic { width: 42px; height: 42px; margin: 0 auto 12px; color: var(--soft); }
.empty h4 { margin: 0 0 5px; font-size: 15px; color: var(--ink); }
.empty p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.ed-bar .spacer { flex: 1; }
.widget-lock { position: relative; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); padding: 20px; margin: 22px 0; }
.widget-lock .lock-tag { position: absolute; top: -10px; left: 14px; background: var(--panel); border: 1px solid var(--line-strong); color: var(--muted); font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.widget-lock .lock-tag svg { width: 12px; height: 12px; }
.widget-lock .demo-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.widget-lock .demo-btns span { font-size: 12.5px; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--muted); }
.widget-lock .demo-out { margin-top: 14px; font-family: var(--serif); font-size: 16px; color: var(--ink); font-style: italic; }
.ed-source pre { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: var(--muted); white-space: pre-wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; overflow-x: auto; }
.ed-source .tk { color: var(--accent); }
.ed-source .at { color: var(--warn); }
.editor.show-source .ed-canvas { display: none; }
.editor.show-source .ed-source { display: block; }
.ed-foot .spacer { flex: 1; }
.status.saved .dot { background: var(--ok); }
.status.saving .dot { background: var(--warn); animation: pulse 1s infinite; }
.status.unsaved .dot { background: var(--soft); }
.status.err .dot { background: var(--danger); }
0%,100% { opacity: 1; }
50% { opacity: 0.3; }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner .bt { font-weight: 600; font-size: 13.5px; }
.banner p { margin: 2px 0 0; font-size: 13px; }
.banner-info { background: var(--accent-weak); border-color: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--ink); }
.banner-info svg { color: var(--accent); }
.banner-warn { background: var(--warn-weak); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: #6e4d13; }
.banner-warn svg { color: var(--warn); }
.toast { display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 11px 15px; border-radius: var(--radius); box-shadow: var(--shadow-pop); font-size: 13.5px; font-weight: 500; }
.toast svg { width: 17px; height: 17px; }
.toast.ok svg { color: #7ddba3; }
.toast.bad { background: var(--danger); }
.modal-demo h4 { font-family: var(--serif); font-weight: 400; font-size: 20px; margin: 0 0 8px; color: var(--ink); }
.modal-demo p { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }
.modal-demo .actions { display: flex; gap: 10px; justify-content: flex-end; }

/* stragglers the port filter missed */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.track { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty { text-align: center; padding: 40px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--card); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-sm); }
