/* ---------------------------------------------------------------------------
   Creator dashboard (creator.matrixmgmt.xyz). Mobile first: creators use it on
   their phones. Same palette as the workspace (mm-nav dark bar, workspace
   blue accent, Notion option colours), far less of it.
--------------------------------------------------------------------------- */
:root {
  --text: #1f2328;
  --muted: #656d76;
  --faint: #8c959f;
  --line: #e4e7eb;
  --bg: #f4f5f7;
  --card: #fff;
  --accent: #2383e2;
  --accent-hover: #0f72d0;
  --accent-soft: rgba(35, 131, 226, .1);
  --danger: #d1242f;
  --danger-soft: #fff1f0;
  --good: #1a7f37;
  --good-soft: #e9f7ee;
  --bar: #161b22;
  --radius: 14px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}
.c-default { --opt-bg: rgba(227, 226, 224, .6); --opt-fg: #32302c; }
.c-gray    { --opt-bg: #e3e2e0; --opt-fg: #32302c; }
.c-brown   { --opt-bg: #eee0da; --opt-fg: #442a1e; }
.c-orange  { --opt-bg: #fadec9; --opt-fg: #49290e; }
.c-yellow  { --opt-bg: #fdecc8; --opt-fg: #402c1b; }
.c-green   { --opt-bg: #dbeddb; --opt-fg: #1c3829; }
.c-blue    { --opt-bg: #d3e5ef; --opt-fg: #183347; }
.c-purple  { --opt-bg: #e8deee; --opt-fg: #412454; }
.c-pink    { --opt-bg: #f5e0e9; --opt-fg: #4c2337; }
.c-red     { --opt-bg: #ffe2dd; --opt-fg: #5d1715; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--sans); }
a { color: var(--accent); }
img, video { max-width: 100%; }
button { font: inherit; }
.hidden { display: none !important; }

/* ---- top bar ---- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bar); color: #e6edf3;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
}
.brand { color: #e6edf3; text-decoration: none; font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand span { color: #58a6ff; font-weight: 500; }
.bar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-name { color: #8b949e; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.bar-btn { background: none; border: 1px solid #30363d; color: #c9d1d9; border-radius: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; }

.banner { background: #fff8c5; color: #4d2d00; padding: 10px 16px; font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.banner button { background: none; border: 1px solid rgba(0,0,0,.2); border-radius: 8px; padding: 4px 10px; cursor: pointer; }

.app { max-width: 680px; margin: 0 auto; padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
.loading { color: var(--muted); text-align: center; padding: 48px 0; }

/* ---- sign in / invite ---- */
.auth { max-width: 380px; margin: 8vh auto 0; background: var(--card); border-radius: var(--radius); padding: 28px 22px; box-shadow: 0 1px 3px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 14px; }
.auth h1 { margin: 0; font-size: 22px; text-align: center; }
.auth p { margin: 0; color: var(--muted); font-size: 15px; text-align: center; }
.auth label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.auth input { font: inherit; font-size: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; color: var(--text); }
.auth input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.err { color: var(--danger); font-size: 14px; text-align: center; margin: 0; min-height: 1em; }
.err:empty { display: none; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 10px; padding: 10px 14px; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-hover); }
.btn.big { width: 100%; padding: 16px; font-size: 17px; border-radius: 14px; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---- dashboard ---- */
.hello { margin: 4px 2px 14px; }
.hello h1 { margin: 0; font-size: 24px; }
.hello p { margin: 2px 0 0; color: var(--muted); }
.stats { display: flex; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.stat { background: var(--card); border-radius: 12px; padding: 8px 12px; font-size: 14px; color: var(--muted); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.stat b { color: var(--text); font-size: 17px; margin-right: 4px; }
.stat.bad b { color: var(--danger); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -14px 14px; padding: 0 14px 2px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; color: var(--text); }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }

.note { background: var(--accent-soft); color: #0b4a8b; border-radius: 12px; padding: 12px 14px; font-size: 15px; margin: 0 0 14px; }
.note.soon { background: #fff8e6; color: #5c3b00; }
.note b { display: block; margin-bottom: 2px; }

.sec { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.sec h2 { margin: 0; font-size: 18px; }
.sec .n { color: var(--faint); font-size: 15px; }
details.more { margin: 14px 0; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 15px; font-weight: 600; padding: 8px 2px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸ "; }
details.more[open] > summary::before { content: "▾ "; }
.empty { background: var(--card); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); }

.cards { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 14px; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(0,0,0,.06); border-left: 4px solid transparent; }
.card:active { background: #fafbfc; }
.card.overdue { border-left-color: var(--danger); }
.card.today { border-left-color: var(--accent); }
.card.muted { opacity: .8; }
.cdate { flex: none; width: 48px; text-align: center; line-height: 1.1; padding-top: 2px; }
.cdate .wd { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .03em; }
.cdate .dd { font-size: 24px; font-weight: 700; }
.cdate .mm { font-size: 12px; color: var(--muted); }
.card.overdue .cdate .dd { color: var(--danger); }
.cmain { flex: 1; min-width: 0; }
.ctitle { font-weight: 650; font-size: 16px; overflow-wrap: anywhere; }
.cmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; font-size: 13px; color: var(--muted); align-items: center; }
.due { font-weight: 600; }
.due.bad { color: var(--danger); }
.due.now { color: var(--accent); }
.csum { margin: 6px 0 0; color: #3d444d; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumbs { display: flex; gap: 6px; margin-top: 8px; }
.thumbs .th { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #e9ecef; flex: none; }
.thumbs .more-n { width: 56px; height: 56px; border-radius: 8px; background: #eef0f3; color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.cfoot { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; font-size: 13px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 13px; background: var(--opt-bg, #eee); color: var(--opt-fg, #333); white-space: nowrap; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: #eef0f3; color: var(--muted); }
.got { color: var(--good); font-weight: 600; }

/* ---- detail ---- */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 15px; padding: 4px 0 10px; }
.dhead h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.25; overflow-wrap: anywhere; }
.dmeta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; }
.panel { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 14px 0; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.panel h2 { margin: 0 0 10px; font-size: 17px; }
.panel.upl { border: 2px solid var(--accent-soft); }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

.queue { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.qrow { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.qtop { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.qname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; min-width: 0; }
.qsize { color: var(--faint); flex: none; }
.qbar { height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.qbar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .25s; }
.qrow.ok .qbar i { background: var(--good); }
.qrow.bad .qbar i { background: var(--danger); }
.qmsg { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qrow.bad .qmsg { color: var(--danger); }
.qrow.ok .qmsg { color: var(--good); }
.qmsg button { border: 1px solid currentColor; background: none; color: inherit; border-radius: 8px; padding: 3px 10px; font-size: 13px; cursor: pointer; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tile { position: relative; border-radius: 10px; overflow: hidden; background: #eef0f3; aspect-ratio: 1; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile video { object-fit: contain; background: #000; }
.tile .fname { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.tile.file { display: flex; align-items: center; justify-content: center; padding: 10px; text-align: center; font-size: 13px; color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }

/* body blocks */
.body { font-size: 16px; overflow-wrap: anywhere; }
.body p { margin: 0 0 8px; }
.body h3, .body h4 { margin: 14px 0 6px; font-size: 16px; }
.body ul, .body ol { margin: 0 0 8px; padding-left: 22px; }
.body blockquote { margin: 0 0 8px; padding-left: 12px; border-left: 3px solid var(--line); color: #3d444d; }
.body .callout { display: flex; gap: 8px; background: #f6f7f9; border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; }
.body pre { background: #f6f8fa; padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.body hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.body figure { margin: 0 0 10px; }
.body figure img { border-radius: 10px; display: block; cursor: zoom-in; }
.body figure video { width: 100%; border-radius: 10px; background: #000; display: block; max-height: 70vh; }
.body figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.body table { border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; margin-bottom: 8px; }
.body td, .body th { border: 1px solid var(--line); padding: 6px 8px; }
.body .todo { display: flex; gap: 8px; margin-bottom: 6px; }
.linkcard { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; text-decoration: none; color: var(--accent); font-size: 14px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }

.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(244,245,247,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 15; }
.sticky-cta .inner { max-width: 680px; margin: 0 auto; }

/* lightbox */
.lb { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 50; display: flex; align-items: center; justify-content: center; }
.lb img, .lb video { max-width: 100vw; max-height: 100vh; }
.lb button { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 999px; width: 40px; height: 40px; font-size: 20px; cursor: pointer; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #24292f; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.picker { display: flex; flex-direction: column; gap: 8px; }
.picker button { text-align: left; }

@media (min-width: 700px) {
  .app { padding-top: 24px; }
  .hello h1 { font-size: 28px; }
}
