/* Magic and Flow client portal. Palette and type follow magicandflowmedia.com (PROJECT-BRIEF.md). */
:root {
  --paper: #FCFBFD; --paper-2: #F4F1F8; --paper-3: #EFEBF6;
  --ink: #191630; --ink-soft: #3D3757; --muted: #736D8A; --line: #E5E0EE;
  --violet: #5C3E9C; --lilac: #B79BDD; --teal: #2C7C8E; --gold: #C08A2A;
  --open: #B45309; --done: #2C7C8E;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink-soft);
  font: 17px/1.55 'Newsreader', Georgia, serif;
}
h1, h2, h3, .ui, button, input, select, textarea, label, .tab, .chip, .stat, table {
  font-family: 'Outfit', system-ui, sans-serif;
}
h1, h2, h3 { color: var(--ink); font-weight: 300; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 30px; font-weight: 200; }
h2 { font-size: 22px; }
h3 { font-size: 17px; font-weight: 500; }
a { color: var(--violet); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* header */
header.top { border-bottom: 1px solid var(--line); background: #fff; }
header.top .wrap { display: flex; align-items: center; gap: 20px; padding-top: 18px; padding-bottom: 18px; flex-wrap: wrap; }
.client-logos { display: flex; align-items: center; gap: 18px; flex: 1; min-width: 0; flex-wrap: wrap; }
.client-logos img { height: 52px; max-width: 100%; object-fit: contain; }
.managed { display: flex; align-items: center; gap: 10px; color: var(--muted); font: 12px 'Outfit', sans-serif; text-transform: uppercase; letter-spacing: .12em; }
.managed img { height: 40px; }
@media (max-width: 600px) { .client-logos img { height: 38px; } .managed img { height: 30px; } }

.admin-bar { background: var(--ink); color: #fff; font: 14px 'Outfit', sans-serif; }
.admin-bar .wrap { display: flex; gap: 14px; align-items: center; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.admin-bar select { width: auto; background: #2a2545; color: #fff; border: 1px solid #4a4466; border-radius: 6px; padding: 4px 8px; }
.admin-bar a { color: var(--lilac); }

.hello { padding: 30px 0 8px; }
.hello p { margin: 6px 0 0; color: var(--muted); }

/* tabs */
nav.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 26px; overflow-x: auto; scrollbar-width: none; }
.tab { background: none; border: 0; padding: 12px 16px; font-size: 15px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--violet); border-bottom-color: var(--violet); font-weight: 500; }
.tab .count { background: var(--paper-3); color: var(--violet); border-radius: 99px; padding: 1px 8px; font-size: 12px; margin-left: 6px; }

/* posts */
.week { margin-bottom: 34px; }
.week h3 { color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: .1em; font-size: 13px; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
@media (max-width: 460px) { .grid { grid-template-columns: 1fr 1fr; gap: 12px; } }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer;
  text-align: left; padding: 0; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.card:hover, .card:focus-visible { box-shadow: 0 6px 20px rgba(25, 22, 48, .08); transform: translateY(-2px); outline: none; }
.thumb { position: relative; aspect-ratio: 4 / 5; background: var(--paper-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play { position: absolute; inset: auto 10px 10px auto; background: rgba(25, 22, 48, .75); color: #fff;
  font: 12px 'Outfit', sans-serif; padding: 3px 9px; border-radius: 99px; }
.card .meta { padding: 10px 12px 12px; font-family: 'Outfit', sans-serif; }
.card .when { font-size: 13px; color: var(--muted); }
.card .title { font-size: 15px; color: var(--ink); font-weight: 500; margin: 2px 0 8px; line-height: 1.3; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 9px; border-radius: 99px;
  background: var(--paper-3); color: var(--violet); }
.chip.open { background: #FEF3E2; color: var(--open); }
.chip.updated, .chip.done { background: #E3F1F3; color: var(--done); }
.chip.posted { background: var(--paper-2); color: var(--muted); }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.empty { background: var(--paper-2); border-radius: var(--radius); padding: 34px; text-align: center; color: var(--muted); }

/* post detail */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  box-shadow: 0 20px 60px rgba(25, 22, 48, .25); color: var(--ink-soft); }
dialog::backdrop { background: rgba(25, 22, 48, .55); }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } }
.detail .media { background: #111; display: flex; align-items: center; justify-content: center; }
.detail .media img, .detail .media video { width: 100%; max-height: 80vh; object-fit: contain; display: block; }
.detail .body { padding: 22px 24px 26px; overflow-y: auto; max-height: calc(100vh - 24px); }
@media (max-width: 760px) { .detail .body { max-height: none; } dialog { overflow-y: auto; } }
.close { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.92); border: 0; border-radius: 99px;
  width: 36px; height: 36px; font-size: 20px; cursor: pointer; color: var(--ink); z-index: 2; }
.facts { font: 14px 'Outfit', sans-serif; color: var(--muted); margin: 6px 0 16px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.caption { white-space: pre-wrap; background: var(--paper-2); border-radius: 8px; padding: 14px 16px; font-size: 16px; }
.label { font: 12px 'Outfit', sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 18px 0 6px; }

form.change { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
textarea, input, select { width: 100%; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; font-family: 'Newsreader', Georgia, serif; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--lilac); border-color: var(--lilac); }
form label { display: block; font-size: 14px; color: var(--ink-soft); margin: 12px 0 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
button.primary, button.ghost { font-size: 15px; border-radius: 99px; padding: 10px 20px; cursor: pointer; border: 1px solid var(--violet); }
button.primary { background: var(--violet); color: #fff; }
button.primary:disabled { opacity: .5; cursor: default; }
button.ghost { background: #fff; color: var(--violet); }
button.link { background: none; border: 0; color: var(--violet); cursor: pointer; padding: 0; font-size: 14px; text-decoration: underline; }
.history { margin-top: 18px; }
.req { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 10px 0; font-size: 15px; }
.req.open { border-color: var(--open); }
.req.done { border-color: var(--done); }
.req .who { font: 12px 'Outfit', sans-serif; color: var(--muted); }
.req .reply { margin-top: 6px; color: var(--ink); }
.req .sugg { white-space: pre-wrap; background: var(--paper-2); padding: 8px 10px; border-radius: 6px; margin-top: 4px; font-size: 14px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  font: 15px 'Outfit', sans-serif; padding: 12px 20px; border-radius: 99px; z-index: 10; }

/* numbers */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 30px; font-weight: 200; color: var(--ink); line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 13px; margin-top: 2px; color: var(--muted); }
.stat .d.up { color: var(--done); }
.stat .d.down { color: var(--open); }
.section { margin-bottom: 40px; }
.section > h2 { margin-bottom: 4px; }
.section > p.sub { margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.platform-head { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 12px; }

.chart { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 8px; margin-bottom: 18px; position: relative; }
.chart .ttl { font: 14px 'Outfit', sans-serif; color: var(--ink); margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px 'Outfit', sans-serif; fill: var(--muted); }
.chart .bar { fill: var(--violet); }
.chart .bar:hover, .chart .hit:hover + .bar { fill: #4A2F85; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font: 13px 'Outfit', sans-serif;
  padding: 6px 10px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); }

table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 400; background: var(--paper-2); }
.table-scroll { overflow-x: auto; }

.ad { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.ad .stats { margin: 12px 0 0; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.ad .stat { border: 0; background: var(--paper-2); padding: 10px 12px; }
.ad .stat .v { font-size: 22px; }
.ad .notes { margin-top: 10px; font-size: 15px; }
.highlights { white-space: pre-wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }

footer { border-top: 1px solid var(--line); margin-top: 50px; padding: 26px 0 40px; color: var(--muted); font: 14px 'Outfit', sans-serif; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.error { background: #FEF3E2; color: var(--open); border-radius: var(--radius); padding: 20px; margin-top: 30px; font-family: 'Outfit', sans-serif; }
@media (max-width: 460px) {
  h1 { font-size: 24px; }
  .tab { padding: 12px 10px; font-size: 14px; }
}
