/* =====================================================================
   PORTAL STYLES
   Change the brand variables below to restyle the whole portal.
   Each portal can also have its own accent colour (set in Settings).
   ===================================================================== */
:root {
  --bg: #eeede9;
  --paper: #f8f7f4;
  --ink: #303030;
  --muted: #7d7a76;
  --line: #dedbd4;
  --soft: #e6e4de;
  --brand: #510e13;        /* studio colour */
  --accent: #510e13;       /* overridden per portal */
  --tint: #c8d1d9;         /* light blue highlight */
  --tint-soft: #e2e7eb;
  --good: #5f7f5a;
  --warn: #b5683f;
  --info: #6a7f99;
  --radius: 16px;
  --font-head: "ivypresto-display", "Cormorant Garamond", Georgia, serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 2px rgba(43, 38, 34, .04), 0 8px 24px rgba(43, 38, 34, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.55; }
a { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 300; margin: 0; letter-spacing: .01em; }
h1 { font-size: clamp(34px, 4.4vw, 52px); line-height: 1.08; }
h2 { font-size: 30px; }
h3 { font-size: 24px; }
/* copy sub headings: upper case, spaced, semi bold */
.eyebrow, .subhead, label.field > span, .day, .gantt-today::after { font-family: var(--font-body); font-weight: 600; text-transform: uppercase; letter-spacing: .16em; }
.eyebrow, .subhead { font-size: 11.5px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(238, 237, 233, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 16px; }
.logo { font-family: var(--font-head); font-weight: 300; font-size: 24px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.logo { display: inline-flex; align-items: center; line-height: 0; }
.logo img { height: 22px; width: auto; display: block; }
.logo-lg { justify-content: center; }
.logo-lg img { height: 30px; max-width: 100%; }
@media (max-width: 700px) { .logo img { height: 16px; } }
.topbar .spacer { flex: 1; }
.rolepick { display: flex; background: var(--soft); border-radius: 999px; padding: 3px; font-size: 13px; }
.rolepick button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); font: inherit; }
.rolepick button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.demo-flag { font-size: 12px; color: var(--warn); border: 1px solid #ecc9b4; background: #fbf0e8; padding: 3px 10px; border-radius: 999px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }

/* buttons and inputs */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; transition: .15s; }
.btn:hover { opacity: .88; }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.link { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.btn.danger { background: transparent; color: var(--warn); border-color: #ecc9b4; }
.btn[disabled] { opacity: .45; cursor: default; }
input[type=text], input[type=email], input[type=url], input[type=date], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; transition: border .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 96px; resize: vertical; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 11px; margin-bottom: 7px; color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 140px; }
.row > .btn, .row > .shrink { flex: 0 0 auto; min-width: 0; }

/* cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card h3 { margin-bottom: 12px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: 1.6fr 1fr; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 860px) { .grid.two { grid-template-columns: 1fr; } }

.pill { display: inline-block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.in_progress { background: var(--tint-soft); color: var(--brand); }
.pill.awaiting_feedback { background: #fbeee3; color: var(--warn); }
.pill.complete { background: #e8efe5; color: var(--good); }
.pill.overdue { background: #fbe9e1; color: var(--warn); }
.pill.type { background: transparent; border: 1px solid var(--line); }

/* admin home */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.pcard { cursor: pointer; transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(43, 38, 34, .08); }
.pcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c, var(--brand)); }
.pcard h3 { margin: 8px 0 2px; }
.bar { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 16px 0 8px; }
.bar > i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 99px; }
.stats { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.stats b { color: var(--ink); font-weight: 500; }
.stats .alert b { color: var(--warn); }

/* portal hero and tabs */
.hero { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 34px; position: relative; overflow: hidden; margin-bottom: 18px; }
.hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: var(--tint); opacity: .55; }
.hero p { max-width: 720px; margin: 12px 0 0; color: #555350; }
.hero-meta { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 20px; font-size: 13px; color: var(--muted); }
.hero-meta b { color: var(--ink); font-weight: 500; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 24px; scrollbar-width: none; }
.tabs a { padding: 12px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; position: relative; }
.tabs a.on { color: var(--ink); border-color: var(--accent); }
.tabs a .dot { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; text-align: center; border-radius: 99px; background: var(--warn); color: #fff; margin-left: 6px; }

/* tasks */
.task { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.task:first-of-type { border-top: 0; }
.check { flex: 0 0 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--muted); background: none; cursor: pointer; display: grid; place-items: center; padding: 0; margin-top: 2px; color: #fff; }
.check:hover { border-color: var(--accent); background: var(--tint-soft); }
.check.on { background: var(--accent); border-color: var(--accent); }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 500; }
.task.done .title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.task .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 3px; align-items: center; }
.task .tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.task .tools input[type=date] { width: 150px; padding: 5px 8px; font-size: 13px; }

/* timeline */
.gantt { position: relative; margin: 6px 0 26px; }
.gantt-row { display: grid; grid-template-columns: 200px 1fr; gap: 12px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.gantt-track { position: relative; height: 22px; background: var(--soft); border-radius: 6px; }
.gantt-track i { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: var(--tint); }
.gantt-track i.in_progress, .gantt-track i.awaiting_feedback { background: var(--accent); opacity: .8; }
.gantt-track i.complete { background: var(--good); opacity: .55; }
.gantt-overlay { position: absolute; top: 0; bottom: 0; left: 212px; right: 0; pointer-events: none; }
.gantt-today { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--warn); }
.gantt-today::after { content: "Today"; position: absolute; top: -16px; left: -14px; font-size: 10px; color: var(--warn); letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 640px) { .gantt-row { grid-template-columns: 1fr; gap: 4px; } .gantt-overlay { display: none; } }
.checkline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.checkline input { width: auto; margin: 0; }
.stage { display: grid; grid-template-columns: 34px 1fr; gap: 14px; position: relative; padding-bottom: 22px; }
.stage::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 1px; background: var(--line); }
.stage:last-child::before { display: none; }
.stage .num { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--font-head); font-size: 18px; background: var(--paper); }
.stage.complete .num { background: var(--good); color: #fff; border-color: var(--good); }
.stage.in_progress .num, .stage.awaiting_feedback .num { background: var(--accent); color: #fff; border-color: var(--accent); }
.stage .head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.stage .admin-row { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.stage .admin-row > * { width: auto; flex: 0 0 auto; }

/* questionnaire */
.q-section { margin-bottom: 30px; }
.q-section h3 { margin-bottom: 4px; }
.q { margin: 18px 0; }
.q > .label { font-weight: 500; margin-bottom: 8px; display: block; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 14px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink); }
.opt.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.scale { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.scale .opts { gap: 6px; }
.scale .opt { width: 38px; height: 38px; padding: 0; border-radius: 50%; }
.save-state { font-size: 12px; color: var(--muted); }
.sticky-foot { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 26px 0 8px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* feedback */
.thread { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.fb { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.fb.admin { background: var(--tint-soft); }
.fb .who { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.deliverables { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.tip { background: var(--tint-soft); border-radius: 12px; padding: 14px 16px; font-size: 14px; color: #5d554e; }

/* files */
.drop { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); transition: .15s; background: var(--paper); }
.drop.over { border-color: var(--accent); background: var(--tint-soft); }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.file { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.file .thumb { height: 130px; background: var(--soft); display: grid; place-items: center; font-family: var(--font-head); font-size: 26px; color: var(--muted); overflow: hidden; }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .info { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.file .name { font-weight: 500; word-break: break-word; font-size: 14px; }
.file .acts { display: flex; gap: 6px; padding: 0 14px 14px; flex-wrap: wrap; }
.filter { display: flex; gap: 6px; flex-wrap: wrap; }

/* chat */
.chat { display: flex; flex-direction: column; height: min(68vh, 680px); }
.chat-log { flex: 1; overflow-y: auto; padding: 6px 4px 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 72%; padding: 11px 15px; border-radius: 16px; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }
.msg .t { display: block; font-size: 11px; opacity: .7; margin-top: 4px; }
.msg.them { background: var(--soft); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.day { align-self: center; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 8px 0; }
.chat-box { display: flex; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; align-items: flex-end; }
.chat-box textarea { min-height: 48px; max-height: 160px; }

/* docs */
.doclist a, .doclist .doc { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.doclist > :first-child { border-top: 0; }

/* modal + toast + login */
.modal-bg { position: fixed; inset: 0; background: rgba(43, 38, 34, .35); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--paper); border-radius: 20px; padding: 30px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.modal h2 { margin-bottom: 18px; }
.typepick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.typepick button { border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 14px 10px; cursor: pointer; font: inherit; text-align: center; }
.typepick button.on { background: var(--tint-soft);  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { width: min(420px, 100%); text-align: center; padding: 40px 34px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-of-type { border-top: 0; }
.answer { white-space: pre-wrap; background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; min-height: 20px; }

/* small screens */
@media (max-width: 700px) {
  .wrap { padding: 20px 14px 60px; }
  .topbar-in { padding: 10px 14px; gap: 10px; }
  .demo-flag { display: none; }
  .hero { padding: 24px; }
  .card { padding: 18px; }
  .task { flex-wrap: wrap; }
  .task .body { flex: 1 1 calc(100% - 40px); }
  .task .tools { flex-basis: 100%; padding-left: 36px; }
  .grid.two[style] { grid-template-columns: 1fr !important; }
  .msg { max-width: 88%; }
  .typepick { grid-template-columns: 1fr; }
}
