/* Kreatio prototype — Notion-inspired light design system.
   Paper-white canvas, warm-gray ink, hairline borders, pastel tags, flat controls.
   body.agency (internal) and body.portal (white-labeled, --brand injectable). */

:root {
  --bg: #ffffff;
  --sidebar: #f7f7f5;
  --surface: #ffffff;
  --hover: rgba(55, 53, 47, 0.06);
  --active: rgba(55, 53, 47, 0.08);
  --text: #37352f;
  --muted: #787774;
  --faint: #9b9a97;
  --line: #ededec;
  --line-strong: rgba(55, 53, 47, 0.16);
  --brand: #2383e2;          /* Notion blue; portal white-label overrides this */
  --brand-soft: rgba(35, 131, 226, 0.10);
  --ok-bg: #dbeddb;  --ok-ink: #1c3829;
  --warn-bg: #fdecc8; --warn-ink: #402c1b;
  --blue-bg: #d3e5ef; --blue-ink: #183347;
  --purple-bg: #e8deee; --purple-ink: #412454;
  --red-bg: #ffe2dd;  --red-ink: #5d1715;
  --gray-bg: #f1f1ef; --gray-ink: #50484b;
  --radius: 6px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5; color-scheme: light; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { letter-spacing: -.01em; margin: 0 0 .4em; font-weight: 600; }
p { margin: 0 0 1em; }
b { font-weight: 600; }

/* ---- App shell ---- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--line);
  padding: 14px 10px; display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 0; height: 100vh; font-size: 14px;
}
.sidebar .logo { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14.5px; padding: 4px 8px 14px; }
.logo-mark {
  width: 22px; height: 22px; border-radius: 5px; flex: none;
  background: var(--text); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); padding: 14px 8px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 4px;
  color: var(--muted); font-weight: 500; cursor: pointer;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); font-weight: 600; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex: none; }
.sidebar .spacer { flex: 1; }

/* Full-width main area */
.main { padding: 28px 48px 72px; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.topbar h1 { font-size: 26px; margin: 0; font-weight: 700; }
.topbar .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.crumbs { color: var(--faint); font-size: 13px; margin-bottom: 4px; }

/* ---- Cards, KPIs ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 32px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0; }
.kpi .delta { font-size: 12.5px; color: var(--muted); }
.kpi .delta.up { color: #2e7d4f; }
.kpi .delta.down { color: #b3261e; }

.section { margin-bottom: 36px; }
.section > h2 { font-size: 13px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }

/* ---- Table (Notion database look: hairlines only) ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12.5px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
tbody tr:hover { background: var(--hover); }
tr:last-child td { border-bottom: none; }
.table-card { padding: 2px 6px; }

/* ---- Tags (Notion pastel chips), avatars ---- */
.pill { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.brand { background: var(--blue-bg); color: var(--blue-ink); }
.pill.purple { background: var(--purple-bg); color: var(--purple-ink); }
.pill.red { background: var(--red-bg); color: var(--red-ink); }
.pill.muted { background: var(--gray-bg); color: var(--gray-ink); }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 600; vertical-align: middle;
  background: var(--gray-bg); color: var(--gray-ink);
}

/* ---- Buttons (flat, hairline, Notion blue primary) ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 14px; cursor: pointer; font-family: inherit;
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.04);
}
.btn:hover { background: var(--sidebar); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: none; }
.btn.primary:hover { filter: brightness(.96); background: var(--brand); }
.btn.primary:disabled { opacity: .7; cursor: default; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 5px; }

/* ---- Infinite Canvas plugin bar (Notion tab strip: ink underline) ---- */
.canvas-bar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
.canvas-tab {
  padding: 8px 12px; font-size: 14px; font-weight: 500; color: var(--muted);
  border: none; background: none; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 6px;
  border-radius: 4px 4px 0 0;
}
.canvas-tab:hover { color: var(--text); background: var(--hover); }
.canvas-tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.canvas-tab .plug { font-size: 10px; padding: 1px 5px; border-radius: 3px; background: var(--gray-bg); color: var(--gray-ink); font-weight: 600; letter-spacing: .03em; }
.canvas-add { margin-left: auto; position: relative; padding-bottom: 6px; }
.canvas-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; width: 270px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 34px rgba(15, 15, 15, 0.12), 0 2px 6px rgba(15, 15, 15, 0.06);
  padding: 6px; display: none;
}
.canvas-menu.open { display: block; }
.canvas-menu .item { padding: 7px 9px; border-radius: 5px; cursor: pointer; display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.canvas-menu .item:hover { background: var(--hover); }
.canvas-menu .item small { display: block; color: var(--muted); font-size: 12px; }
.panel { display: none; }
.panel.active { display: block; }

/* ---- Proofing / annotation pins ---- */
.proof-stage {
  position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  background: #fbfbfa;
  min-height: 340px;
}
.mock-ui { position: absolute; inset: 32px 14%; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 18px; box-shadow: 0 1px 3px rgba(15,15,15,.05); }
.mock-line { height: 9px; border-radius: 4px; background: var(--gray-bg); margin-bottom: 10px; }
.mock-line.brand { background: var(--brand); opacity: .85; width: 38%; height: 13px; }
.mock-line.w60 { width: 60%; }
.mock-line.w80 { width: 80%; }
.mock-block { height: 96px; border-radius: 5px; background: #f1f1ef; margin-top: 14px; }
.pin {
  position: absolute; width: 24px; height: 24px; border-radius: 50% 50% 50% 3px;
  background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 600;
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(15, 15, 15, 0.25);
}

/* ---- Threads ---- */
.msg { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: none; padding-bottom: 4px; }
.msg .meta { font-size: 12.5px; color: var(--faint); margin-bottom: 2px; }
.msg .meta b { color: var(--text); font-size: 13.5px; margin-right: 6px; }
.receipt { font-size: 12px; color: var(--faint); margin-top: 3px; }
.receipt .ok { color: #2e7d4f; }

/* ---- Misc ---- */
.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; align-items: start; }
.swatches { display: flex; gap: 7px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(15,15,15,.08); }
.swatch.active { border-color: var(--text); }
.note { font-size: 13px; color: var(--muted); }
.toggle { width: 32px; height: 18px; border-radius: 999px; background: var(--gray-bg); border: 1px solid var(--line-strong); position: relative; cursor: pointer; flex: none; }
.toggle::after { content: ""; position: absolute; top: 1.5px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15,15,15,.25); transition: .15s; }
.toggle.on { background: var(--brand); border-color: var(--brand); }
.toggle.on::after { left: 15px; }

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav-label, .sidebar .spacer { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 20px; }
}
