/* ════════════════════════════════════════════════════════════════
   UpgroWIN Client Portal
   Brand-matched to upgrowin.ai — flat, editorial, zero-shadow,
   Sporting Grotesque display + Inter UI, accent color-blocks.
   ════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Sporting Grotesque';
  src: url('./fonts/SportingGrotesque-Bold.otf') format('opentype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Sporting Grotesque';
  src: url('./fonts/SportingGrotesque-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  /* brand ink + neutrals */
  --ink: #0f0f0f;
  --ink-2: #1e1e1e;
  --white: #ffffff;
  --paper: #f5f7f8;        /* app canvas — off-white, not pure */
  --gray: #e0e7e9;         /* brand section gray */
  --line: rgba(15,15,15,0.10);
  --line-soft: rgba(15,15,15,0.06);
  --muted: #6b7480;
  --muted-2: #8a939d;

  /* brand accents */
  --orange: #ff784b;
  --blue: #09abf3;
  --blue-light: #21c1f3;
  --purple: #6652da;
  --yellow: #ffcd26;
  --magenta: #d250e6;
  --green: #2e9e5b;        /* deepened from brand #8cc493 for text contrast */
  --green-soft: #e7f4ec;
  --blue-soft: #e3f5fd;
  --orange-soft: #ffeae2;
  --purple-soft: #ece9fb;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-disp: 'Sporting Grotesque', 'Inter', sans-serif;

  /* radii — varied by element per design guidelines */
  --r-btn: 24px;           /* brand pill */
  --r-card: 18px;
  --r-tile: 10px;
  --r-pill: 999px;

  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --side-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.55;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2;
      stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
.ic-sm { width: 17px; height: 17px; }
.ic-xs { width: 13px; height: 13px; stroke-width: 2.4; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  font: inherit; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-btn);
  padding: 11px 20px; cursor: pointer; white-space: nowrap;
  transition: background-color .18s var(--ease-out), color .18s var(--ease-out),
              border-color .18s var(--ease-out), opacity .18s var(--ease-out);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn-ink { background: var(--ink); color: var(--white); }
@media (hover: hover) { .btn-ink:hover { background: var(--ink-2); } }
.btn-ink:active { background: #2b2b2b; }
.btn-ghost-light { background: transparent; color: rgba(255,255,255,0.72);
  border-color: rgba(255,255,255,0.16); }
@media (hover: hover) { .btn-ghost-light:hover { color: #fff; border-color: rgba(255,255,255,0.34); background: rgba(255,255,255,0.05); } }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 13px; }
.btn-icon { padding: 11px; width: 44px; height: 44px; border-radius: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-label { display: inline-block; }

.link { display: inline-flex; align-items: center; gap: 4px; background: none; border: none;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  transition: color .15s var(--ease-out); }
@media (hover: hover) { .link:hover { color: var(--ink); } }

/* ── Avatars ─────────────────────────────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: var(--r-pill); flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
  letter-spacing: -0.2px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-xs { width: 26px; height: 26px; font-size: 10.5px; }

/* ── Pills / badges ──────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 11px; border-radius: var(--r-pill); white-space: nowrap; line-height: 1.4; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill-plan { background: var(--ink); color: #fff; }
.pill-plan::before { display: none; }
.pill-progress { background: var(--blue-soft); color: #0a6fa0; }
.pill-review { background: var(--orange-soft); color: #c2492a; }
.pill-delivered { background: var(--green-soft); color: var(--green); }
.pill-queued { background: var(--purple-soft); color: #4a3aa8; }

/* ════════ LOGIN ════════ */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 0.95fr; }
.auth-panel { display: flex; flex-direction: column; padding: 40px clamp(32px, 6vw, 96px);
  padding-bottom: 48px; }
.auth-brandbar { margin-bottom: auto; padding-top: 8px; }
.auth-logo { height: 34px; width: auto; display: block; }
.auth-body { margin-top: auto; max-width: 400px; width: 100%; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 18px; }
.auth-h1 { font-family: var(--font-disp); font-weight: 700; font-size: clamp(52px, 7vw, 76px);
  line-height: 0.92; letter-spacing: -0.04em; text-transform: uppercase; text-wrap: balance; }
.auth-lede { color: var(--muted); font-size: 16px; margin: 18px 0 30px; max-width: 34ch; text-wrap: pretty; }
.auth-help { margin-top: 22px; font-size: 13px; color: var(--muted); }
.auth-help a { font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
@media (hover: hover) { .auth-help a:hover { color: var(--blue); } }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; font-weight: 600; }
.field input { font: inherit; font-size: 16px; padding: 13px 15px; color: var(--ink);
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out); width: 100%; }
.field input::placeholder { color: var(--muted-2); }
.field input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,15,15,0.08); }
.form-error { background: var(--orange-soft); color: #b83c1f; border: 1px solid rgba(255,120,75,0.3);
  padding: 10px 13px; border-radius: 10px; font-size: 13px; font-weight: 500; }
.login-form-shake { animation: shake .4s ease-in-out; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

.auth-aside { position: relative; overflow: hidden; background: var(--ink); color: #fff;
  display: flex; flex-direction: column; justify-content: center; padding: clamp(40px, 5vw, 80px);
  gap: 28px; }
.blocks { display: flex; gap: 12px; }
.blk { width: 46px; height: 46px; border-radius: 14px; }
.blk-orange { background: var(--orange); border-radius: 14px 14px 14px 28px; }
.blk-blue { background: var(--blue-light); border-radius: 28px 14px 14px 14px; }
.blk-purple { background: var(--purple); border-radius: 14px 28px 14px 14px; }
.blk-yellow { background: var(--yellow); border-radius: 14px 14px 28px 14px; }
.aside-quote { font-family: var(--font-disp); font-weight: 700; font-size: clamp(36px, 4vw, 50px);
  line-height: 1.0; letter-spacing: -0.03em; text-transform: uppercase; }
.aside-feats { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.aside-feats li { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,0.82); font-size: 14.5px; }
.aside-feats .ic { color: var(--blue-light); }
.aside-foot { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.4); }

/* ════════ APP SHELL ════════ */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; min-height: 100dvh; }

.side { background: var(--ink); color: #fff; display: flex; flex-direction: column;
  padding: 22px 16px; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.side-top { padding: 6px 8px 24px; }
.side-logo { height: 28px; width: auto; filter: brightness(0) invert(1); }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-i { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; font: inherit; font-size: 14.5px; font-weight: 500;
  color: rgba(255,255,255,0.62); padding: 10px 12px; border-radius: 11px;
  transition: color .15s var(--ease-out), background-color .15s var(--ease-out); }
.nav-i .ic { width: 19px; height: 19px; stroke-width: 1.9; }
@media (hover: hover) { .nav-i:hover { color: #fff; background: rgba(255,255,255,0.06); } }
.nav-i.is-active { color: var(--ink); background: #fff; font-weight: 600; }
.side-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 0 4px; min-width: 0; }
.side-user-meta { display: flex; flex-direction: column; min-width: 0; }
.side-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-sub { font-size: 12px; color: rgba(255,255,255,0.5); }

.main { display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 26px clamp(20px, 3vw, 40px) 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
.top-title { font-family: var(--font-disp); font-weight: 700; font-size: 30px; letter-spacing: -0.03em;
  text-transform: uppercase; line-height: 1; }
.top-sub { color: var(--muted); font-size: 14px; margin-top: 7px; }
.scroll { padding: clamp(20px, 3vw, 32px) clamp(20px, 3vw, 40px) 56px; }
.view { display: flex; flex-direction: column; gap: 22px; }

/* ── Stat cards ──────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { position: relative; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 18px 20px 20px; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; }
.stat-blue::before { background: var(--blue); }
.stat-green::before { background: var(--green); }
.stat-purple::before { background: var(--purple); }
.stat-ink::before { background: var(--ink); }
.stat-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.stat-k { font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em; }
.stat-head .ic { color: var(--muted-2); }
.stat-n { font-family: var(--font-disp); font-weight: 700; font-size: 46px; line-height: 1;
  letter-spacing: -0.03em; margin: 14px 0 6px; font-variant-numeric: tabular-nums; }
.stat-n-sm { font-size: 30px; text-transform: uppercase; }
.stat-foot { font-size: 12.5px; color: var(--muted-2); }

/* ── Two-column ──────────────────────────────────────────────── */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* ── Cards ───────────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; padding-bottom: 14px; }
.card-h { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card-h-mb { margin-bottom: 16px; }
.card-note { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--muted); line-height: 1.55; text-wrap: pretty; }

/* ── Project list (dashboard) ────────────────────────────────── */
.proj-list { display: flex; flex-direction: column; }
.proj-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.proj-row:first-child { border-top: none; }
.proj-row-main { min-width: 0; flex: 1; }
.proj-row-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-row-meta { font-size: 12px; color: var(--muted-2); margin-top: 3px; }

/* progress ring */
.ring { flex: none; }
.ring-track { stroke: var(--line); }
.ring-label { font-family: var(--font-body); font-weight: 700; font-size: 11px; fill: var(--ink); font-variant-numeric: tabular-nums; }

/* ── Project grid (full view) ────────────────────────────────── */
.proj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.pcard { position: relative; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.pcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.pcard-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
.pcard-desc { font-size: 13.5px; color: var(--muted); line-height: 1.55; text-wrap: pretty; }
.pcard-mid { display: flex; align-items: center; gap: 16px; }
.bar { flex: 1; height: 8px; background: var(--gray); border-radius: var(--r-pill); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--r-pill); transition: width .5s var(--ease-smooth); }
.pcard-pct { font-family: var(--font-disp); font-weight: 700; font-size: 22px; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.pcard-foot { display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; border-top: 1px solid var(--line-soft); }
.pcard-team { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }

/* ── File / deliverable list ─────────────────────────────────── */
.file-list { display: flex; flex-direction: column; }
.file-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.file-row:first-child { border-top: none; }
.file-list-lg .file-row { padding: 16px 22px; }
.file-tile { width: 40px; height: 40px; border-radius: var(--r-tile); flex: none; display: grid; place-items: center; }
.file-tile .ic { width: 19px; height: 19px; color: #fff; }
.ft-orange { background: var(--orange); }
.ft-purple { background: var(--purple); }
.ft-blue { background: var(--blue); }
.ft-ink { background: var(--ink); }
.file-main { min-width: 0; flex: 1; }
.file-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.file-get { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted);
  background: none; cursor: pointer; transition: color .15s var(--ease-out), border-color .15s var(--ease-out), background-color .15s var(--ease-out); }
@media (hover: hover) { .file-get:hover { color: var(--ink); border-color: var(--ink); background: var(--paper); } }

/* ── Chat ────────────────────────────────────────────────────── */
.view-fill { flex: 1; min-height: 0; }
.chat { display: flex; flex-direction: column; height: calc(100vh - 168px); height: calc(100dvh - 168px); min-height: 440px; }
.chat-thread { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 24px;
  display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 10px; max-width: 76%; }
.msg-team { align-self: flex-start; }
.msg-client { align-self: flex-end; flex-direction: row-reverse; }
.msg-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msg-client .msg-body { align-items: flex-end; }
.bubble { padding: 11px 15px; border-radius: 16px; font-size: 14px; line-height: 1.5; text-wrap: pretty; }
.msg-team .bubble { background: var(--gray); color: var(--ink); border-bottom-left-radius: 5px; }
.msg-client .bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
.msg-meta { font-size: 11px; color: var(--muted-2); padding: 0 4px; }
.chat-bar { display: flex; gap: 10px; padding: 16px 18px; border-top: 1px solid var(--line); }
.chat-bar input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 0 16px; height: 44px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.chat-bar input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,15,15,0.07); }

/* ── Key-value (account) ─────────────────────────────────────── */
.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 0; border-top: 1px solid var(--line-soft); }
.kv > div:first-child { border-top: none; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { font-weight: 600; font-size: 14px; text-align: right; }

/* ── Empty states ────────────────────────────────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 40px 20px; color: var(--muted-2); }
.empty .ic { width: 26px; height: 26px; color: var(--muted-2); margin-bottom: 4px; }
.empty-t { font-size: 14px; font-weight: 600; color: var(--muted); }
.empty-s { font-size: 13px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; width: 100%;
    flex-direction: row; align-items: center; padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)); z-index: 40; }
  .side-top, .side-bottom { display: none; }
  .nav { flex-direction: row; justify-content: space-around; gap: 0; }
  .nav-i { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 7px 6px; flex: 1; }
  .nav-i.is-active { background: rgba(255,255,255,0.1); color: #fff; }
  .main { padding-bottom: 64px; }
  .cols { grid-template-columns: 1fr; }
  .proj-grid { grid-template-columns: 1fr; }
  .chat { height: calc(100vh - 210px); }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .msg { max-width: 88%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .bar-fill { transition: none; }
}
