:root {
  --ink: #121417;
  --ink-soft: #2a3038;
  --paper: #f2f3f7;
  --surface: #ffffff;
  --line: #e6e8ee;
  --muted: #7a8290;
  --teal: #00a3a1;
  --teal-deep: #006d77;
  --orange: #ff6a00;
  --orange-soft: #fff1e6;
  --ok: #12a454;
  --warn: #f0a202;
  --danger: #e23d3d;
  --shadow: 0 8px 24px rgba(18, 20, 23, 0.06);
  --shadow-card: 0 10px 28px rgba(18, 20, 23, 0.08);
  --radius: 22px;
  --radius-sm: 16px;
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Onest", "Segoe UI", sans-serif;
  --display: "Unbounded", "Onest", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px); }
#app { min-width: 0; width: 100%; }
a { color: var(--teal-deep); text-decoration: none; }
button, input, select, textarea { font: inherit; }

.reveal { animation: rise .45s cubic-bezier(.22,.8,.2,1) both; }
.reveal-delay { animation-delay: .06s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes softPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* ===== Auth (bank splash) ===== */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(24px + var(--safe-b));
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 10%, rgba(255,106,0,.35), transparent 30%),
    linear-gradient(160deg, #004f56 0%, #006d77 45%, #00a3a1 100%);
}
.auth-atmosphere {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.12), transparent 35%),
    radial-gradient(circle at 70% 40%, rgba(255,106,0,.18), transparent 28%);
  pointer-events: none;
}
.auth-panel {
  width: min(100%, 420px);
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 28px;
  padding: 28px 22px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
}
.brand-mark {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 2.4rem);
  letter-spacing: -0.04em;
  color: var(--teal-deep);
  margin-bottom: 6px;
}
.auth-lead { margin: 0 0 20px; color: var(--muted); line-height: 1.45; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #f2f3f7;
  border-radius: 16px;
  margin-bottom: 16px;
}
.auth-tab {
  border: 0;
  background: transparent;
  padding: 11px 8px;
  border-radius: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.auth-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.auth-hint { margin-top: 14px; font-size: .84rem; color: var(--muted); line-height: 1.4; }
.auth-hint code {
  background: #f2f3f7;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--ink);
}

/* ===== Shell ===== */
.app-shell { min-height: 100vh; }
.app-content { min-width: 0; width: 100%; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 8px;
  background: rgba(242, 243, 247, 0.94);
  backdrop-filter: blur(12px);
}
.topbar-left { min-width: 0; flex: 1; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.greet-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.brand-inline {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  color: var(--teal-deep);
}
.brand-inline span { color: var(--orange); }
.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.icon-btn svg { width: 20px; height: 20px; }
.avatar-sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  text-decoration: none;
  flex: 0 0 auto;
}
.main {
  padding: 8px 16px 24px;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

/* Bottom nav — full-bleed mobile bar */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 6px 4px calc(6px + var(--safe-b));
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(18,20,23,.06);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  min-width: 0;
  border-radius: 12px;
  color: #9aa1ad;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  padding: 4px 2px;
}
.bottom-nav a span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.bottom-nav a svg { width: 22px; height: 22px; flex: 0 0 auto; }
.bottom-nav a.active {
  color: var(--teal-deep);
  background: rgba(0,163,161,.1);
}

.side-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.side-drawer.open { pointer-events: auto; opacity: 1; }
.side-drawer .backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18,20,23,.45);
}
.side-drawer .panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(86vw, 340px);
  height: 100%;
  background: #fff;
  padding: 22px 18px;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  box-shadow: -12px 0 40px rgba(0,0,0,.12);
}
.side-drawer.open .panel { transform: none; }
.side-drawer .nav-link {
  display: block;
  padding: 13px 12px;
  border-radius: 14px;
  color: var(--ink);
  margin-bottom: 4px;
  font-weight: 600;
  text-decoration: none;
}
.side-drawer .nav-link:hover,
.side-drawer .nav-link.active { background: #f2f3f7; }

/* ===== Bank cards ===== */
.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 18px 16px 16px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 10%, rgba(255,106,0,.45), transparent 35%),
    linear-gradient(135deg, #008b8d 0%, #006d77 55%, #04505a 100%);
  box-shadow: 0 16px 40px rgba(0,109,119,.28);
  margin-bottom: 14px;
}
.hero-card::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  right: -40px;
  bottom: -60px;
  background: rgba(255,255,255,.08);
}
.hero-card::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  right: 40px;
  top: -30px;
  background: rgba(255,106,0,.25);
}
.hero-card > * { position: relative; z-index: 1; }
.hero-kicker {
  font-size: .82rem;
  opacity: .85;
  font-weight: 500;
  margin-bottom: 6px;
}
.hero-value {
  font-family: var(--display);
  font-size: clamp(1.45rem, 5.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 12px;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.hero-stat {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
}
.hero-stat b {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.1;
}
.hero-stat span {
  display: block;
  margin-top: 2px;
  font-size: .68rem;
  opacity: .85;
}

/* Quick actions */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 16px;
  padding: 14px 10px 12px;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.qa-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 0;
  text-decoration: none;
  color: var(--ink);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  padding: 2px;
}
.qa-item span {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qa-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #f4f6fa;
  color: var(--teal-deep);
}
.qa-icon svg {
  width: 21px;
  height: 21px;
  display: block;
}
.qa-item:active .qa-icon { transform: scale(.95); }
.qa-icon.orange { color: var(--orange); background: var(--orange-soft); }
.qa-icon.teal { color: #fff; background: linear-gradient(135deg, var(--teal), var(--teal-deep)); }
.qa-icon.mint { color: var(--ok); background: #e8f8ef; }
.qa-icon.rose { color: #c0392b; background: #fdecec; }

/* Mobile task cards */
.task-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.task-card {
  display: block;
  background: #fff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}
.task-card:active { background: #fafbfc; }
.task-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.task-num {
  font-size: .75rem;
  font-weight: 800;
  color: var(--teal-deep);
  letter-spacing: .02em;
}
.task-pct {
  font-size: .8rem;
  font-weight: 800;
  color: var(--ok);
}
.task-pct.bad { color: var(--danger); }
.task-card-title {
  font-size: 1rem;
  font-weight: 750;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.task-card-meta span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-card-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.task-card-progress { margin-top: 2px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 12px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.link-all {
  font-size: .86rem;
  font-weight: 700;
  color: var(--teal-deep);
}

/* Transaction-like lists */
.bank-list {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.tx-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f0f1f5;
}
.tx-item:last-child { border-bottom: 0; }
.tx-item:active { background: #fafbfc; }
.tx-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 13px;
  background: #eef8f7;
  color: var(--teal-deep);
  margin-top: 2px;
}
.tx-icon.warn { background: #fff6e8; color: #c97800; }
.tx-icon.danger { background: #fdecec; color: var(--danger); }
.tx-body { flex: 1; min-width: 0; }
.tx-title {
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tx-sub {
  margin-top: 2px;
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tx-right {
  text-align: right;
  flex: 0 0 auto;
  max-width: 30%;
}
.tx-amount {
  font-weight: 800;
  font-size: .95rem;
}
.tx-amount.plus { color: var(--ok); }
.tx-amount.minus { color: var(--danger); }
.tx-date {
  display: block;
  margin-top: 2px;
  font-size: .72rem;
  color: var(--muted);
}

.surface {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* ===== Task detail page (mobile-first) ===== */
.td-page {
  display: grid;
  gap: 10px;
  padding-bottom: calc(12px + var(--safe-b));
  animation: rise .4s cubic-bezier(.22,.8,.2,1) both;
  max-width: 100%;
  min-width: 0;
}
.td-hero {
  --td-accent: var(--teal);
  border-radius: 20px;
  padding: 14px 14px 12px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 10%, rgba(255,106,0,.4), transparent 36%),
    linear-gradient(145deg, #004f56 0%, #006d77 50%, var(--td-accent) 100%);
  box-shadow: 0 12px 28px rgba(0, 109, 119, .2);
}
.td-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.td-back {
  color: rgba(255,255,255,.9);
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
  padding: 6px 0;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.td-num {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  opacity: .85;
}
.td-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(1.1rem, 4.6vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.2;
  word-break: break-word;
}
.td-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.td-tags .pill {
  box-shadow: none;
  font-size: .7rem;
  padding: 4px 8px;
}
.td-progress { max-width: 100%; margin-bottom: 6px; }
.td-progress .progress { background: rgba(255,255,255,.2); height: 6px; }
.td-progress .progress span { background: #fff; }
.td-project {
  font-size: .78rem;
  font-weight: 600;
  opacity: .88;
  line-height: 1.3;
}
.td-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.td-card-label {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 8px;
}
.td-desc {
  margin: 0;
  font-size: .92rem;
  line-height: 1.45;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}
.td-people { display: grid; gap: 10px; }
.td-person {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.td-ava {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: .75rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  flex-shrink: 0;
}
.td-ava.sm {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: .55rem;
}
.td-person-role {
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.td-person-name {
  font-weight: 700;
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.td-helper-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.td-helper {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  background: #f4f8f8;
  border: 1px solid #e2ebee;
  font-size: .74rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.td-assign-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}
.td-assign-row .form-control {
  font-size: 16px; /* prevent iOS zoom */
  min-height: 44px;
  border-radius: 12px;
}
.td-status-grid {
  display: flex;
  gap: 8px;
  margin: 0 -4px 12px;
  padding: 2px 4px 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.td-status-grid::-webkit-scrollbar { display: none; }
.td-status {
  border: 1px solid var(--line);
  background: #f7f9fb;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  min-height: 40px;
}
.td-status.active {
  background: var(--s, var(--teal-deep));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0,109,119,.2);
}
.td-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.td-actions .btn {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
}
.td-subs { display: grid; gap: 8px; }
.td-sub {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #f6f9f9;
  border: 1px solid #e6eef0;
  text-decoration: none;
  color: inherit;
  min-height: 52px;
}
.td-sub .pill { grid-column: 2; justify-self: start; }
.td-sub-num { font-size: .7rem; font-weight: 800; color: var(--teal-deep); }
.td-sub-title {
  font-weight: 700;
  font-size: .88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Discussion — collapsed list → WhatsApp-like messenger */
.td-discuss {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.td-discuss-open {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.td-discuss-open:active { background: #f7fafb; }
.td-discuss-open-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.td-discuss-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #e7f6f6, #d7f0ef);
  flex-shrink: 0;
  position: relative;
}
.td-discuss-icon::before {
  content: "";
  width: 20px;
  height: 14px;
  border: 2.5px solid var(--teal-deep);
  border-radius: 8px 8px 8px 3px;
  box-sizing: border-box;
}
.td-discuss-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.td-discuss-sub {
  margin-top: 2px;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.3;
}
.td-chat-count {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #eef6f6;
  color: var(--teal-deep);
  font-size: .75rem;
  font-weight: 800;
  flex-shrink: 0;
}
.td-discuss-preview {
  border-top: 1px solid #eef1f5;
  cursor: pointer;
}
.td-preview-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f4f7;
}
.td-preview-row:last-child { border-bottom: 0; }
.td-preview-row:active { background: #f7fafb; }
.td-preview-body { min-width: 0; flex: 1; }
.td-preview-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.td-preview-top strong {
  font-size: .82rem;
  font-weight: 800;
  color: var(--ink);
}
.td-preview-top time {
  font-size: .68rem;
  color: var(--muted);
  white-space: nowrap;
}
.td-preview-text {
  font-size: .86rem;
  color: #445;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-preview-empty {
  padding: 16px 14px 18px;
  color: var(--muted);
  font-size: .84rem;
}

/* Fullscreen messenger overlay — juicy WhatsApp-like */
.wa-messenger {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  background: #0f3d42;
  animation: waSlide .28s cubic-bezier(.22,.8,.2,1);
}
.wa-messenger.hidden { display: none !important; }
.wa-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(255,106,0,.28), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(0,230,210,.22), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(0,109,119,.55), transparent 55%),
    linear-gradient(165deg, #123f45 0%, #1a555c 42%, #0e3338 100%);
  opacity: 1;
}
.wa-wallpaper::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .22;
  background-image:
    radial-gradient(rgba(255,255,255,.55) 1px, transparent 1.2px),
    radial-gradient(rgba(255,180,120,.35) .8px, transparent 1px);
  background-size: 18px 18px, 28px 28px;
  background-position: 0 0, 9px 14px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 92%);
}
.wa-wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,.12), transparent 18%),
    linear-gradient(0deg, rgba(0,0,0,.28), transparent 22%);
}
@keyframes waSlide {
  from { transform: translateY(18px) scale(.985); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes waPop {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: none; }
}
body.wa-open {
  overflow: hidden;
}
body.wa-open .bottom-nav,
body.wa-open .desktop-nav,
body.wa-open .topbar {
  display: none !important;
}
.wa-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  color: #fff;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(0,80,88,.92), rgba(0,140,138,.88) 55%, rgba(0,163,161,.82));
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid rgba(255,255,255,.12);
  box-shadow:
    0 10px 28px rgba(0,30,36,.35),
    inset 0 1px 0 rgba(255,255,255,.18);
}
.wa-back {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
  transition: background .15s, transform .12s;
}
.wa-back:active { transform: scale(.94); background: rgba(255,255,255,.22); }
.wa-head-ava-wrap {
  position: relative;
  flex-shrink: 0;
}
.wa-head-ava {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, #ff8a3d, #ff6a00 55%, #e85d00);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow:
    0 8px 18px rgba(255,106,0,.35),
    inset 0 1px 0 rgba(255,255,255,.35);
}
.wa-online {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2ee59a;
  border: 2px solid #0f4a50;
  box-shadow: 0 0 0 2px rgba(46,229,154,.25);
}
.wa-head-info { min-width: 0; flex: 1; }
.wa-head-title {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 8px rgba(0,0,0,.2);
}
.wa-head-sub {
  margin-top: 3px;
  font-size: .72rem;
  opacity: .9;
  letter-spacing: .01em;
}
.wa-feed {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.wa-day {
  display: flex;
  justify-content: center;
  margin: 4px 0 2px;
  animation: waPop .35s cubic-bezier(.22,.8,.2,1) both;
}
.wa-day span {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  background: rgba(8,30,34,.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.wa-empty {
  margin: auto;
  text-align: center;
  color: rgba(255,255,255,.88);
  padding: 28px 22px;
  max-width: 280px;
  line-height: 1.45;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
  animation: waPop .4s cubic-bezier(.22,.8,.2,1) both;
}
.wa-empty-ico {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.2), rgba(255,255,255,.05));
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.wa-empty-ico::before {
  content: "";
  position: absolute;
  inset: 16px 14px 18px;
  border: 2.5px solid rgba(255,255,255,.85);
  border-radius: 10px 10px 10px 4px;
}
.wa-empty strong {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.wa-empty p {
  margin: 0;
  font-size: .86rem;
  opacity: .82;
}
.wa-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: min(86%, 420px);
  width: fit-content;
  animation: waPop .34s cubic-bezier(.22,.8,.2,1) both;
  animation-delay: calc(min(var(--i, 0), 12) * 28ms);
}
.wa-msg.other { align-self: flex-start; }
.wa-msg.mine { align-self: flex-end; }
.wa-ava {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: .58rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, #5aa8ad, #0f6b72);
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,.18);
}
.wa-bubble {
  position: relative;
  padding: 9px 12px 8px;
  border-radius: 18px 18px 18px 6px;
  background: linear-gradient(180deg, #ffffff, #f3f7f8);
  color: var(--ink);
  box-shadow:
    0 8px 22px rgba(0,20,24,.16),
    0 1px 0 rgba(255,255,255,.7) inset;
  min-width: 84px;
  max-width: 100%;
}
.wa-bubble::after {
  content: "";
  position: absolute;
  left: -5px;
  bottom: 0;
  width: 12px;
  height: 12px;
  background: #f3f7f8;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  filter: drop-shadow(-2px 2px 2px rgba(0,0,0,.06));
}
.wa-msg.mine .wa-bubble {
  background: linear-gradient(145deg, #08949c 0%, #00b3aa 48%, #00a3a1 100%);
  color: #fff;
  border-radius: 18px 18px 6px 18px;
  box-shadow:
    0 10px 24px rgba(0,120,120,.32),
    0 1px 0 rgba(255,255,255,.28) inset;
}
.wa-msg.mine .wa-bubble::after {
  left: auto;
  right: -5px;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  background: #00a3a1;
}
.wa-name {
  font-size: .72rem;
  font-weight: 800;
  color: #0b6e76;
  margin-bottom: 3px;
  letter-spacing: .01em;
}
.wa-text {
  font-size: .94rem;
  line-height: 1.38;
  white-space: pre-wrap;
  word-break: break-word;
  padding-right: 4px;
}
.wa-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  min-height: 14px;
}
.wa-time {
  font-size: .66rem;
  opacity: .62;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.wa-msg.mine .wa-time { color: rgba(255,255,255,.82); opacity: 1; }
.wa-ticks {
  font-size: .68rem;
  letter-spacing: -.08em;
  color: #b8fff4;
  line-height: 1;
  text-shadow: 0 0 8px rgba(184,255,244,.35);
}
.wa-composer {
  position: relative;
  z-index: 2;
  padding: 10px 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  background: linear-gradient(180deg, transparent, rgba(6,28,32,.55) 28%, rgba(6,28,32,.78));
}
.wa-composer-shell {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 6px 6px 6px 14px;
  border-radius: 28px;
  background: rgba(255,255,255,.96);
  box-shadow:
    0 14px 36px rgba(0,0,0,.28),
    0 1px 0 rgba(255,255,255,.8) inset,
    0 0 0 1px rgba(255,255,255,.2);
}
.wa-composer textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  border-radius: 0;
  padding: 11px 4px;
  font-size: 16px;
  line-height: 1.35;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  outline: none;
}
.wa-composer textarea::placeholder { color: #93a0a8; }
.wa-send {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, #ff8f3f, #ff6a00 60%, #e85d00);
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 10px 22px rgba(255,106,0,.42),
    inset 0 1px 0 rgba(255,255,255,.35);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: transform .12s, filter .15s;
}
.wa-send:hover { filter: brightness(1.05); }
.wa-send:active { transform: scale(.92); }

@media (min-width: 900px) {
  .wa-messenger {
    left: auto;
    width: min(440px, 100%);
    border-left: 1px solid rgba(255,255,255,.08);
    box-shadow: -24px 0 60px rgba(0,10,14,.45);
    border-radius: 20px 0 0 20px;
    overflow: hidden;
  }
}

@media (min-width: 480px) {
  .td-assign-row { grid-template-columns: 1fr 1fr; }
  .td-actions { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .td-status-grid {
    flex-wrap: wrap;
    overflow: visible;
    margin: 0 0 12px;
    padding: 0;
  }
}

@media (min-width: 900px) {
  .td-page {
    grid-template-columns: 1.05fr .95fr;
    gap: 14px;
    align-items: start;
  }
  .td-hero { grid-column: 1 / -1; padding: 22px 24px; border-radius: 24px; }
  .td-title { font-size: 1.7rem; max-width: 28ch; }
  .td-discuss {
    grid-column: 1 / -1;
  }
  .td-assign-row { grid-template-columns: 1.2fr 1fr; }
  .td-sub {
    grid-template-columns: auto 1fr auto;
  }
  .td-sub .pill { grid-column: auto; justify-self: auto; }
}

.grid { display: grid; gap: 12px; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
.grid-2 { grid-template-columns: 1fr; }
.stat {
  background: #fff;
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.stat h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.stat .value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat.danger .value { color: var(--danger); }
.stat.ok .value { color: var(--ok); }
.stat.warn .value { color: var(--warn); }

.btn {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--orange), #ff8126);
  color: #fff;
  box-shadow: 0 10px 24px rgba(255,106,0,.28);
}
.btn-secondary { background: #eef1f6; color: var(--ink); }
.btn-danger { background: #fdecec; color: #9f1f1f; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-teal {
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff;
}
.btn-sm { padding: 8px 12px; font-size: .84rem; border-radius: 12px; }
.btn-block { width: 100%; }

.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
}
.form-control {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: #f8f9fc;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.form-control:focus {
  background: #fff;
  border-color: rgba(0,163,161,.55);
  box-shadow: 0 0 0 4px rgba(0,163,161,.12);
}
textarea.form-control { min-height: 110px; resize: vertical; }

.alert {
  padding: 11px 12px;
  border-radius: 14px;
  margin-bottom: 12px;
  font-size: .9rem;
}
.alert-danger { background: #fdecec; color: #9f1f1f; }
.alert-success { background: #e8f8ef; color: #0f5c38; }
.alert-info { background: #e8f7f7; color: #04505a; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.chip-soft { background: #eef1f6; color: var(--ink-soft); }
.chip-pending { background: #fff1d6; color: #8a5a00; }
.chip-active { background: #d9f5e7; color: #0f5c38; }
.chip-blocked { background: #fdecec; color: #9f1f1f; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.progress {
  height: 7px;
  background: #e8ebf2;
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--orange));
}

.list { display: grid; gap: 10px; }
.list-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}
.list-item .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #eef8f7;
  color: var(--teal-deep);
  flex: 0 0 auto;
}
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; margin-bottom: 2px; }
.list-item .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.user-roles-help {
  margin-bottom: 12px;
  padding: 14px 16px;
}
.user-roles-help strong {
  display: block;
  font-size: .95rem;
  margin-bottom: 4px;
}
.user-roles-help p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.4;
}
.user-roles-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.user-card {
  flex-direction: column;
  align-items: stretch !important;
  gap: 12px;
}
.user-card-top {
  display: flex;
  gap: 12px;
  width: 100%;
}
.user-role-field {
  display: grid;
  gap: 6px;
  width: 100%;
}
.user-role-label {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.user-role-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #d9e2e6;
  background: #f7fafb;
  font-weight: 700;
}
.user-role-select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,163,161,.15);
  background: #fff;
}
.user-role-hint {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.35;
}
.chip-role {
  background: linear-gradient(145deg, #e7f6f6, #d7f0ef);
  color: var(--teal-deep);
  font-weight: 800;
}
.user-role-saved {
  font-size: .78rem;
  font-weight: 700;
  color: var(--ok) !important;
}
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.filters .btn { white-space: nowrap; flex: 0 0 auto; }

.invite-box,
.invite-panel {
  background: linear-gradient(135deg, #006d77, #008b8d);
  color: #fff;
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 14px 30px rgba(0,109,119,.25);
}
.invite-panel h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.invite-panel p {
  margin: 0 0 12px;
  color: rgba(255,255,255,.85);
  font-size: .88rem;
  line-height: 1.4;
}
.invite-link-box {
  background: rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: .78rem;
  word-break: break-all;
  margin-bottom: 12px;
  font-family: ui-monospace, Consolas, monospace;
}
.invite-panel .actions-row .btn:not(.btn-secondary) {
  background: #fff;
  color: var(--teal-deep);
}
.invite-box code {
  display: inline-block;
  margin-top: 8px;
  font-size: 1.1rem;
  letter-spacing: .08em;
  background: rgba(255,255,255,.14);
  padding: 8px 12px;
  border-radius: 12px;
}
.desk-top { display: grid; gap: 12px; margin-bottom: 12px; }
.desk-split { display: grid; gap: 8px; }

/* Projects */
.proj-grid {
  display: grid;
  gap: 12px;
}
.proj-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  color: inherit;
  transition: transform .12s, box-shadow .15s;
}
.proj-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  flex: 1;
}
.proj-card-link:active { opacity: .96; }
.proj-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 12px;
}
.proj-edit-bar {
  padding: 12px;
  border-radius: 14px;
  background: #fff8f0;
  border: 1px solid #ffe0c2;
}
.proj-cover {
  height: 120px;
  background: #dfe8ea center/cover no-repeat;
}
.proj-cover-empty {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #006d77, #00a3a1);
  color: #fff;
  font-weight: 800;
  font-size: 1.4rem;
}
.proj-card-body { padding: 12px 14px 14px; }
.proj-card-title {
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.proj-card-desc {
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
  margin-bottom: 8px;
}
.proj-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: .8rem;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.proj-card-foot {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--muted);
}
.proj-card-foot strong { color: var(--teal-deep); }
.project-sheet { max-width: 520px; }
.proj-image-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}
.proj-image-preview {
  width: 96px;
  height: 72px;
  border-radius: 12px;
  background: #eef3f5 center/cover no-repeat;
  display: grid;
  place-items: center;
  font-size: .72rem;
  color: var(--muted);
  border: 1px dashed #c5d0d4;
  flex-shrink: 0;
}
.proj-image-preview.has-img {
  border-style: solid;
  color: transparent;
}
.proj-members-pick {
  max-height: 180px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fafb;
}
.proj-member-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
  font-size: .88rem;
}
.proj-member-check:hover { background: #fff; }
.proj-member-check .avatar.sm,
.proj-member-check .avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: .62rem;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #4a8f92, #006d77);
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.proj-detail { padding: 0; overflow: hidden; }
.proj-hero-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: min(52vh, 420px);
  padding: 20px 16px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255,255,255,.85), transparent 55%),
    linear-gradient(160deg, #e8f4f4 0%, #f2f5f7 55%, #eef1f4 100%);
  border-bottom: 1px solid #e6ecee;
}
.proj-hero-cover img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 360px);
  max-height: min(42vh, 340px);
  object-fit: contain;
  object-position: center;
}
.proj-detail-body { padding: 16px; }
.proj-detail-heading {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
}
.proj-detail-desc {
  margin: 0 0 8px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.proj-detail-owner {
  font-size: .86rem;
  color: var(--muted);
}
@media (min-width: 900px) {
  .proj-hero-cover {
    min-height: 260px;
    padding: 28px 24px;
  }
  .proj-hero-cover img {
    max-width: 420px;
    max-height: 360px;
  }
}
@media (min-width: 900px) {
  .proj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proj-cover { height: 140px; }
}
@media (min-width: 1280px) {
  .proj-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.board-toolbar .form-control { max-width: 280px; flex: 1; }
.board-toolbar #btnPurgeDb { margin-left: auto; }
.purge-sheet { max-width: 440px; }
.purge-counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #fff5f5;
  border: 1px solid #ffd0d0;
}
.purge-counts div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: .82rem;
  color: #5a4040;
}
.purge-counts b { font-weight: 800; color: var(--danger); }
.purge-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .84rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.purge-check input { margin-top: 3px; }
.view-tabs {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.view-tab {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: .86rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
}
.view-tab.active {
  background: var(--teal-deep);
  color: #fff;
}
.board-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.4;
}

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 82vw);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.kanban-col {
  background: #fff;
  border-radius: 16px;
  min-height: 380px;
  scroll-snap-align: start;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.kanban-col h3 {
  margin: 0;
  padding: 12px 14px;
  font-size: .9rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-col h3 span {
  background: #f3f5f8;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .75rem;
  color: var(--muted);
}
.kanban-list { padding: 10px; min-height: 320px; }
.kanban-card {
  background: #f8f9fc;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: grab;
  border: 1px solid #eef1f6;
}
.kanban-card.dragging { opacity: .5; }
.kanban-card .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.k-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.k-title {
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.3;
  margin-bottom: 4px;
}
.k-subs {
  margin-top: 8px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--teal-deep);
}
.k-children {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.k-child {
  font-size: .72rem;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.k-trail {
  margin-top: 8px;
  font-size: .72rem;
  color: #6b7280;
  line-height: 1.3;
}
.k-empty {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  padding: 20px 8px;
}

/* ===== Org-chart tree (real blocks + connectors) ===== */
.org-topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}
.org-kicker {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.org-project {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.02em;
}
.org-stats {
  display: flex;
  gap: 8px;
}
.org-stats > div {
  min-width: 72px;
  padding: 8px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: center;
}
.org-stats b {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--teal-deep);
  line-height: 1.1;
}
.org-stats span {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

/* Interactive flow canvas — pull threads from blocks */
.flow-host { margin-bottom: 20px; }
.flow-host.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 80;
  margin: 0;
  padding: 12px 14px calc(12px + var(--safe-b));
  background: #eef3f5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.flow-host.is-fullscreen .flow-hint { display: none; }
.flow-host.is-fullscreen .flow-toolbar {
  flex-shrink: 0;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.flow-host.is-fullscreen .flow-viewport {
  flex: 1;
  min-height: 0;
  max-height: none;
  height: 100%;
  border-radius: 16px;
}
body.flow-board-fs {
  overflow: hidden;
  padding-bottom: 0;
}
body.flow-board-fs .bottom-nav,
body.flow-board-fs .desktop-nav,
body.flow-board-fs .topbar {
  display: none !important;
}
body.flow-board-fs .app-content {
  margin-left: 0 !important;
  width: 100% !important;
}
body.flow-board-fs .main {
  padding: 0 !important;
}
body.flow-board-fs .board-toolbar,
body.flow-board-fs .org-topbar {
  display: none !important;
}
.flow-hint {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff8f0;
  border: 1px solid #ffe0c2;
  color: var(--ink-soft);
  font-size: .86rem;
  line-height: 1.4;
}
.flow-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.flow-selbar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 12px;
  background: #fff8f0;
  border: 1px solid #ffd2a8;
}
.flow-selbar.hidden { display: none; }
.flow-selbar #flowSelCount {
  font-size: .8rem;
  font-weight: 800;
  color: #c44f00;
  margin-right: 4px;
}
.flow-zoom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 3px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.flow-zoom-btn {
  width: 34px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: #f3f6f8;
  color: var(--teal-deep);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}
.flow-zoom-btn:hover { background: #e7f3f2; }
.flow-zoom-btn.soft {
  width: auto;
  padding: 0 10px;
  font-size: .78rem;
}
.flow-zoom-label {
  min-width: 48px;
  text-align: center;
  font-size: .8rem;
  font-weight: 800;
  color: var(--ink-soft);
}
.flow-viewport {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid #d9e4e6;
  background:
    radial-gradient(circle at 12% 8%, rgba(0,163,161,.1), transparent 28%),
    radial-gradient(circle at 88% 90%, rgba(255,106,0,.08), transparent 30%),
    linear-gradient(180deg, #eef5f6 0%, #f3f5f9 100%);
  min-height: 62vh;
  max-height: calc(100vh - 220px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.flow-scaler {
  position: relative;
  min-width: 100%;
  min-height: 520px;
}
.flow-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  background-image:
    linear-gradient(rgba(0,109,119,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,109,119,.05) 1px, transparent 1px);
  background-size: 28px 28px;
}
.flow-edges,
.flow-draft {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.flow-draft { z-index: 5; }
.flow-edges { z-index: 1; }
.flow-edge {
  fill: none;
  stroke: #7eb8b7;
  stroke-width: 2.5;
}
.flow-edge.is-hot {
  stroke: #ff6a00;
  stroke-width: 3;
}
.flow-edge-dot { fill: #006d77; }
.flow-marquee {
  position: absolute;
  border: 1.5px dashed #ff6a00;
  background: rgba(255, 106, 0, .08);
  border-radius: 6px;
  pointer-events: none;
  z-index: 6;
}
.flow-marquee.hidden { display: none; }
.flow-draft-line {
  fill: none;
  stroke: #ff6a00;
  stroke-width: 2.5;
  stroke-dasharray: 6 5;
}
.flow-draft-end { fill: #ff6a00; }

.flow-nodes { position: absolute; inset: 0; z-index: 2; }
.flow-block {
  --accent: var(--teal);
  position: absolute;
  width: 236px;
  min-height: 236px;
  background: #fff;
  border: 1px solid #d5e1e4;
  border-radius: 16px;
  padding: 12px 12px 42px;
  box-shadow: 0 10px 26px rgba(18, 20, 23, .1);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.flow-block.is-root {
  background: linear-gradient(180deg, #f4fbfb, #fff 50%);
  border-color: #aed4d2;
}
.flow-block.is-anchor {
  box-shadow: 0 0 0 2px rgba(255, 106, 0, .35), 0 10px 24px rgba(255, 106, 0, .12);
}
.flow-block.is-anchor .flow-block-code {
  color: #ff6a00;
  font-weight: 800;
}
.flow-block-history {
  margin: 0 10px 8px;
  display: grid;
  gap: 3px;
}
.flow-hist {
  font-size: .68rem;
  color: #6a7580;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 6px;
  border-radius: 8px;
  background: #f3f6f8;
}
.org-scope {
  margin: 6px 0 0;
  font-size: .82rem;
  color: var(--muted);
  max-width: 52ch;
  line-height: 1.35;
}
.flow-block.is-done {
  background: #f3fbf6;
  border-color: #bfe6cd;
}
.flow-block.is-dragging {
  cursor: grabbing;
  z-index: 8;
  box-shadow: 0 18px 36px rgba(0, 109, 119, .2);
}
.flow-block.is-selected {
  border-color: #ff6a00;
  box-shadow: 0 0 0 3px rgba(255, 106, 0, .22), 0 12px 28px rgba(18, 20, 23, .12);
  z-index: 4;
}
.flow-block.is-focus {
  box-shadow: 0 0 0 3px rgba(255, 106, 0, .35), 0 14px 32px rgba(255, 106, 0, .18);
}
.flow-block:hover { border-color: #9ec9c8; }
.flow-block.is-selected:hover { border-color: #ff6a00; }
.flow-block-bar {
  height: 4px;
  border-radius: 99px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--accent), #ff6a00);
}
.flow-block-code {
  font-size: .7rem;
  font-weight: 800;
  color: var(--teal-deep);
  margin-bottom: 4px;
}
.flow-block-title {
  font-family: var(--display);
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.02em;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3em;
}
.flow-block-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid #e4ecee;
  border-radius: 12px;
  background: #f4f8f8;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.flow-block-meta:hover {
  border-color: #9ec9c8;
  background: #eef8f7;
}
.flow-meta-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-soft);
  font-weight: 700;
}
.flow-ava {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: .58rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  flex-shrink: 0;
}
.flow-block-helpers {
  display: flex;
  margin-left: auto;
}
.flow-helper-ava {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  margin-left: -5px;
  display: grid;
  place-items: center;
  font-size: .5rem;
  font-weight: 800;
  background: #ffb070;
  color: #5a2a00;
}
.flow-helper-ava.more {
  background: #dfe6ea;
  color: var(--muted);
}
.flow-helper-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.flow-helper-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px 5px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e2e8ee;
  font-size: .78rem;
  font-weight: 700;
}
.flow-helper-chip button {
  border: 0;
  background: #f1f3f7;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0;
}
.flow-helper-chip button:hover {
  background: #ffe5e5;
  color: var(--danger);
}
.flow-block-comments {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
  padding: 7px 8px;
  border-radius: 12px;
  background: #f7f9fb;
  border: 1px solid #e8eef2;
  max-height: 78px;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
.flow-block-comments.empty {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  place-items: center;
  min-height: 42px;
}
.flow-block-comments:hover { border-color: #c5d9d8; background: #f1f7f7; }
.flow-cmt {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 6px;
  align-items: start;
}
.flow-cmt-ava {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: .48rem;
  font-weight: 800;
  color: #fff;
  background: #6a9ea0;
}
.flow-cmt b {
  display: block;
  font-size: .65rem;
  color: var(--teal-deep);
  line-height: 1.1;
}
.flow-cmt span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .7rem;
  line-height: 1.25;
  color: var(--ink-soft);
}
.flow-chat-list {
  max-height: 42vh;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 4px 2px;
}
.flow-chat-item {
  padding: 10px 12px;
  border-radius: 14px;
  background: #f6f8fa;
  border: 1px solid #e8eef2;
}
.flow-chat-who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: .8rem;
}
.flow-chat-who .time {
  margin-left: auto;
  color: var(--muted);
  font-size: .7rem;
}
.flow-chat-body {
  font-size: .9rem;
  line-height: 1.35;
  white-space: pre-wrap;
}
.flow-block-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.flow-mini {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
}
.flow-mini.ok {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.flow-done-label {
  font-size: .72rem;
  font-weight: 800;
  color: var(--ok);
}

.flow-port {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #00a3a1;
  box-shadow: 0 0 0 2px rgba(0,163,161,.25);
  cursor: crosshair;
  padding: 0;
  z-index: 3;
  transition: transform .12s ease, background .12s ease;
}
.flow-port:hover {
  transform: scale(1.25);
  background: #ff6a00;
  box-shadow: 0 0 0 3px rgba(255,106,0,.28);
}
.flow-port.left { left: -8px; top: 50%; margin-top: -8px; }
.flow-port.right { right: -8px; top: 50%; margin-top: -8px; }
.flow-port.down { left: 50%; bottom: -8px; margin-left: -8px; }

@media (min-width: 900px) {
  .kanban {
    grid-auto-columns: minmax(280px, 1fr);
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    grid-auto-flow: unset;
  }
  .org-project { font-size: 1.55rem; }
  .flow-viewport { min-height: 68vh; }
  .board-toolbar .form-control { max-width: 320px; }
}

.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th, table.data td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: .9rem;
}
table.data th {
  color: var(--muted);
  font-weight: 700;
  background: #f8f9fc;
}

.modal-sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  align-items: end;
  background: rgba(18,20,23,.45);
  padding: 0;
}
.modal-sheet .sheet {
  background: #fff;
  border-radius: 28px 28px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  max-height: 92vh;
  overflow: auto;
  animation: rise .32s cubic-bezier(.2,.8,.2,1);
}
.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: #d9dde6;
  margin: 0 auto 14px;
}

.fab {
  position: fixed;
  right: 14px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 30;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), #ff8126);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(255,106,0,.3);
  cursor: pointer;
  display: none; /* hide by default — use quick actions / top buttons */
}

.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  background: #eef8f7;
  color: var(--teal-deep);
  white-space: nowrap;
  max-width: 100%;
}
.deadline-badge.soon { background: #fff6e8; color: #b86e00; }
.deadline-badge.overdue { background: #fdecec; color: #b42318; }
.deadline-badge.ok { background: #e8f8ef; color: #0f5c38; }

.hint-card {
  background: #fff8f0;
  border: 1px solid #ffe0c2;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: .86rem;
  color: #7a4a12;
  line-height: 1.4;
}
.hint-card strong { color: #5c3708; }

.status-quick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 10px 0 4px;
}
.status-quick button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.status-quick button.active {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  color: #fff;
}

.empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.4;
}
.task-list .empty,
.bank-list .empty {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

@media (max-width: 380px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .qa-icon { width: 44px; height: 44px; }
  .hero-value { font-size: 1.35rem; }
  .bottom-nav a { font-size: 9px; }
}

.desktop-nav { display: none; }
.desktop-only { display: none !important; }
.mobile-only { display: initial; }
.kpi-row { display: none; }
.invite-bar { display: none; }

/* ===== Desktop / PC full-width ===== */
@media (min-width: 900px) {
  body {
    padding-bottom: 0;
    background: #f3f5f8;
  }
  .bottom-nav, .fab, .mobile-only { display: none !important; }
  .desktop-only { display: flex !important; }
  .kpi-row.desktop-only { display: grid !important; }

  :root { --sidebar-w: 240px; }

  html, body {
    overflow-x: hidden;
  }

  #app {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  /* Sidebar is fixed — not in content flow */
  .app-shell {
    display: block;
    width: 100%;
    min-height: 100vh;
    background: #f3f5f8;
    margin: 0;
    max-width: none;
  }

  .desktop-nav {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    width: var(--sidebar-w);
    height: 100vh;
    height: 100dvh;
    padding: 24px 14px;
    background: #0b2f33;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .app-content {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    min-width: 0;
    min-height: 100vh;
    background: #f3f5f8;
    box-sizing: border-box;
  }
  .desktop-nav .brand-inline {
    margin-bottom: 24px;
    display: block;
    color: #fff;
    font-size: 1.3rem;
    padding: 0 8px;
  }
  .desktop-nav .brand-inline span { color: #ff8a3d; }
  .desktop-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 10px;
    color: rgba(255,255,255,.75);
    margin-bottom: 2px;
    text-decoration: none;
    font-weight: 600;
    font-size: .95rem;
  }
  .desktop-nav a svg { width: 20px; height: 20px; }
  .desktop-nav a.active,
  .desktop-nav a:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
  }
  .desktop-nav #logoutBtn {
    margin-top: auto;
    color: rgba(255,255,255,.45);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(243,245,248,.92);
    backdrop-filter: blur(10px);
    padding: 16px 28px;
    border-bottom: 1px solid #e5e8ef;
  }
  .topbar h1 {
    font-size: 1.5rem;
    max-width: none;
  }

  .main {
    padding: 20px 28px 40px;
    max-width: none !important;
    width: 100%;
  }

  /* KPI row full width */
  .kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
  }
  .kpi-card {
    background: #fff;
    border: 1px solid #e5e8ef;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 4px 14px rgba(15,23,42,.04);
  }
  .kpi-card .label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
  }
  .kpi-card .num {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--ink);
  }
  .kpi-card.accent {
    background: linear-gradient(135deg, #008b8d, #006d77);
    border: 0;
    color: #fff;
  }
  .kpi-card.accent .label { color: rgba(255,255,255,.8); }
  .kpi-card.accent .num { color: #fff; }
  .kpi-card.warn .num { color: var(--danger); }

  /* Hide mobile hero on desktop dashboard */
  .desk-top { display: none !important; }

  .invite-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid #e5e8ef;
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 16px;
    box-shadow: 0 4px 14px rgba(15,23,42,.04);
  }
  .invite-bar .invite-text { flex: 1; min-width: 0; }
  .invite-bar h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    color: var(--ink);
  }
  .invite-bar p {
    margin: 0;
    color: var(--muted);
    font-size: .86rem;
  }
  .invite-bar .invite-link-box {
    flex: 1.2;
    margin: 0;
    background: #f3f5f8;
    color: var(--ink);
    font-size: .8rem;
  }
  .invite-bar .actions-row { flex: 0 0 auto; margin: 0; flex-wrap: nowrap; }
  .invite-bar.desktop-only { display: flex !important; }

  .qa-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    max-width: none;
    margin-bottom: 22px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
  .qa-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e5e8ef;
    border-radius: 14px;
    font-size: .92rem;
    box-shadow: 0 4px 14px rgba(15,23,42,.03);
  }
  .qa-item span { width: auto; white-space: nowrap; }
  .qa-icon { width: 42px; height: 42px; }

  .desk-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
  }
  .desk-split .section-head {
    margin-top: 0;
    margin-bottom: 12px;
  }
  .desk-split .section-head h2 { font-size: 1.15rem; }

  .task-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: none;
  }
  .task-card {
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid #e5e8ef;
    box-shadow: 0 4px 14px rgba(15,23,42,.03);
  }
  .task-card-title { font-size: 1rem; }

  .users-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: 1.2fr 1fr; }
  .modal-sheet { place-items: center; }
  .modal-sheet .sheet {
    width: min(560px, 92vw);
    border-radius: 20px;
    max-height: 86vh;
  }
  .list-item { border-radius: 14px; }
  .surface { border: 1px solid #e5e8ef; }
  .bank-list { border: 1px solid #e5e8ef; }
}

@media (min-width: 1280px) {
  :root { --sidebar-w: 260px; }
  .desktop-nav { padding: 28px 18px; }
  .main { padding: 24px 36px 48px; }
  .topbar { padding: 18px 36px; }
  .desk-split { grid-template-columns: minmax(0, 1fr) 380px; }
  .task-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .users-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1600px) {
  .main { padding-left: 48px; padding-right: 48px; }
  .topbar { padding-left: 48px; padding-right: 48px; }
  .task-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
