/* Veyro CRM — "Lapis" design system
   Deep navy chrome, lapis-blue accent, sky-blue secondary. 8px grid. Onest (Latin + Cyrillic). */
:root {
  --bg: #EEF3FB;
  --bg-glow-1: rgba(30, 91, 255, .10);
  --bg-glow-2: rgba(34, 184, 240, .10);
  --surface: #FFFFFF;
  --surface-2: #F5F8FE;
  --glass: rgba(255, 255, 255, .72);
  --ink: #0B1638;
  --ink-2: #44506B;
  --ink-3: #7C88A3;
  --line: #DDE4F2;
  --line-2: #C6D1E8;
  --accent: #1E5BFF;
  --accent-2: #22B8F0;
  --accent-ink: #FFFFFF;
  --accent-soft: #E6EDFF;
  --grad: linear-gradient(135deg, #1E5BFF 0%, #3D7BFF 45%, #22B8F0 100%);
  --navy-1: #070F2B;
  --navy-2: #0F1F55;
  --danger: #E5364B;
  --danger-soft: #FDECEE;
  --ok: #10935A;
  --ok-soft: #E4F6EC;
  --warn: #C27803;
  --focus: #1E5BFF;
  --shadow-sm: 0 1px 2px rgba(11, 22, 56, .06), 0 2px 6px rgba(30, 91, 255, .05);
  --shadow: 0 2px 4px rgba(11, 22, 56, .05), 0 10px 28px rgba(30, 91, 255, .10);
  --shadow-lg: 0 24px 60px rgba(11, 22, 56, .22);
  --r-s: 8px;
  --r-m: 14px;
  --sidebar: 240px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060C22; --bg-glow-1: rgba(30, 91, 255, .22); --bg-glow-2: rgba(34, 184, 240, .12);
    --surface: #0E1836; --surface-2: #121E42; --glass: rgba(14, 24, 54, .72);
    --ink: #E8EEFF; --ink-2: #A9B6D6; --ink-3: #7584A8; --line: #1C2A55; --line-2: #2A3B70;
    --accent: #4D7FFF; --accent-soft: #15265C; --danger: #FF6B7D; --danger-soft: #3A1520; --ok: #3DD68C; --ok-soft: #0F3324;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 10px 30px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #060C22; --bg-glow-1: rgba(30, 91, 255, .22); --bg-glow-2: rgba(34, 184, 240, .12);
  --surface: #0E1836; --surface-2: #121E42; --glass: rgba(14, 24, 54, .72);
  --ink: #E8EEFF; --ink-2: #A9B6D6; --ink-3: #7584A8; --line: #1C2A55; --line-2: #2A3B70;
  --accent: #4D7FFF; --accent-soft: #15265C; --danger: #FF6B7D; --danger-soft: #3A1520; --ok: #3DD68C; --ok-soft: #0F3324;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 10px 30px rgba(0,0,0,.35); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font: 400 14px/1.5 "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 24px; letter-spacing: -.015em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons & inputs ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 18px rgba(30, 91, 255, .35);
}
.btn.primary:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 10px 26px rgba(30, 91, 255, .45); transform: translateY(-1px); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.icon-btn { width: 38px; padding: 0; justify-content: center; }

label.f { display: block; margin-bottom: 16px; }
label.f > span { display: block; margin-bottom: 6px; font-weight: 500; color: var(--ink-2); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=number], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=color] { width: 46px; height: 40px; padding: 3px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); cursor: pointer; }
.has-err input, .has-err select { border-color: var(--danger); }
.field-err { color: var(--danger); font-size: 13px; margin-top: 6px; }
.hint { color: var(--ink-3); font-size: 13px; margin-top: 6px; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.row > * { flex: 1; min-width: 0; }

/* Flash & toasts */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--danger-soft); color: var(--danger); }
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 80; }
.toast {
  background: var(--navy-2); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: 380px;
  animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.err { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* Brand mark: a bevelled 3D tile */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -.02em; color: var(--ink); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800;
  background: var(--grad);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -3px 0 rgba(0,0,0,.18), 0 6px 14px rgba(30,91,255,.45);
}

/* ===================================================================== */
/* Guest pages: animated 3D scene                                         */
/* ===================================================================== */
.guest { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); background: var(--bg); }
.guest-side {
  position: relative; overflow: hidden; padding: 44px 48px; display: flex; flex-direction: column; justify-content: space-between;
  color: #D6E2FF; background: radial-gradient(120% 90% at 20% 10%, #16307F 0%, var(--navy-2) 35%, var(--navy-1) 100%);
  isolation: isolate;
}
.guest-side .brand { color: #fff; position: relative; z-index: 3; }
.guest-copy { position: relative; z-index: 3; max-width: 480px; margin-top: auto; margin-bottom: 36px; }
.guest-copy::before { content: ""; position: absolute; inset: -40px -60px -30px -48px; z-index: -1; background: radial-gradient(closest-side, rgba(7,15,43,.75), transparent); }
.guest-copy h2 { font-size: 40px; line-height: 1.08; letter-spacing: -.03em; font-weight: 700; color: #fff; margin-bottom: 14px; }
.guest-copy h2 span { background: linear-gradient(90deg, #8FB2FF, #5FE0FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.guest-copy p { color: #A9BCEB; font-size: 16px; }
.lang-switch { position: relative; z-index: 3; display: flex; gap: 14px; font-size: 13px; }
.lang-switch a { color: #C6D4FF; opacity: .7; }
.lang-switch a[aria-current] { opacity: 1; font-weight: 600; color: #fff; }

/* Aurora light */
.aurora { position: absolute; inset: -20%; z-index: 0; filter: blur(60px); opacity: .85; pointer-events: none; }
.aurora i { position: absolute; border-radius: 50%; mix-blend-mode: screen; animation: drift 18s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 46%; height: 46%; left: 8%; top: 18%; background: #1E5BFF; }
.aurora i:nth-child(2) { width: 38%; height: 38%; right: 6%; top: 8%; background: #22B8F0; animation-duration: 22s; animation-delay: -6s; }
.aurora i:nth-child(3) { width: 40%; height: 40%; left: 30%; bottom: 0; background: #5B3DFF; opacity: .7; animation-duration: 26s; animation-delay: -12s; }
@keyframes drift { to { transform: translate(8%, -6%) scale(1.15); } }
.grid-floor {
  position: absolute; inset: auto -30% -40% -30%; height: 80%; z-index: 1; pointer-events: none;
  background-image: linear-gradient(rgba(120,160,255,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(120,160,255,.18) 1px, transparent 1px);
  background-size: 48px 48px; transform: perspective(600px) rotateX(70deg); transform-origin: top;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%, transparent 95%);
  mask-image: linear-gradient(to bottom, transparent, #000 30%, transparent 95%);
  animation: floor 8s linear infinite;
}
@keyframes floor { to { background-position: 0 48px; } }

/* Floating isometric board */
.scene { position: absolute; inset: 0; z-index: 2; perspective: 1400px; pointer-events: none; }
.scene-board {
  position: absolute; right: -10%; top: 4%; width: 600px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  transform-style: preserve-3d; transform: rotateX(56deg) rotateZ(-34deg);
  transition: transform .4s ease-out;
}
.scene-col { transform-style: preserve-3d; display: grid; gap: 12px; align-content: start; }
.scene-head {
  height: 34px; border-radius: 8px 0 0 8px; color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; padding: 0 14px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%);
  animation: drop .9s cubic-bezier(.2, .9, .25, 1.15) both;
}
.scene-card {
  height: 74px; border-radius: 10px; background: rgba(255,255,255,.96); padding: 12px 14px; display: grid; gap: 7px; align-content: start;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 18px 30px rgba(3, 10, 40, .45);
  border-left: 4px solid var(--c, #1E5BFF);
  animation: drop .9s cubic-bezier(.2, .9, .25, 1.15) both, bob 6s ease-in-out infinite alternate;
}
.scene-card b { display: block; height: 8px; border-radius: 4px; background: #CFDAF5; }
.scene-card b:first-child { width: 70%; background: #0B1638; opacity: .85; }
.scene-card b:nth-child(2) { width: 45%; background: var(--c, #1E5BFF); }
.scene-card b:nth-child(3) { width: 85%; }
@keyframes drop { from { opacity: 0; transform: translateZ(260px) translateY(-40px); } }
@keyframes bob { from { transform: translateZ(10px); } to { transform: translateZ(34px); } }

/* Form side */
.guest-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; position: relative; overflow: hidden; }
.guest-main::before {
  content: ""; position: absolute; width: 520px; height: 520px; right: -200px; top: -200px; border-radius: 50%;
  background: radial-gradient(circle, var(--bg-glow-1), transparent 70%); pointer-events: none;
}
.guest-card {
  position: relative; width: 100%; max-width: 420px; padding: 36px; border-radius: 20px;
  background: var(--glass); backdrop-filter: blur(16px); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise .8s .15s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.guest-card h1 { margin-bottom: 6px; }
.guest-card .sub { color: var(--ink-3); margin-bottom: 24px; }
.guest-card .btn.primary { width: 100%; justify-content: center; height: 44px; font-size: 15px; }
.guest-foot { margin-top: 20px; color: var(--ink-3); }
@media (max-width: 960px) {
  .guest { grid-template-columns: 1fr; }
  .guest-side { min-height: 280px; padding: 28px 24px; }
  .guest-copy h2 { font-size: 28px; }
  .scene-board { width: 420px; right: -55%; top: -12%; opacity: .3; }
}

/* ===================================================================== */
/* App shell                                                              */
/* ===================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column; gap: 18px;
  color: #C9D6FF; background: linear-gradient(180deg, var(--navy-2) 0%, var(--navy-1) 100%);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.06);
}
.sidebar .brand { color: #fff; padding: 0 4px; }
.org-switch select { height: 38px; font-weight: 600; background: rgba(255,255,255,.07); color: #fff; border-color: rgba(255,255,255,.14); }
.org-switch select option { color: #0B1638; }
.nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.nav a, .nav .soon {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px;
  color: #B4C4F0; text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.nav a > span, .nav .soon > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] {
  background: var(--grad); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 20px rgba(30, 91, 255, .45);
}
.nav .soon { color: #6E80B4; cursor: default; }
.nav .soon em { margin-left: auto; font-style: normal; font-size: 10.5px; border: 1px solid rgba(255,255,255,.15); border-radius: 99px; padding: 0 7px; white-space: nowrap; flex: none; }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 6px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 4px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: #fff; }
.me:hover, .me[aria-current] { background: rgba(255,255,255,.07); text-decoration: none; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 11.5px; box-shadow: 0 2px 6px rgba(30,91,255,.4);
}
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; box-shadow: none; }
.avatar.none { background: var(--line-2); color: var(--ink-3); }
.me small { display: block; color: #8EA1D6; font-size: 12px; }
.sidebar .btn.ghost { color: #B4C4F0; }
.sidebar .btn.ghost:hover { color: #fff; background: rgba(255,255,255,.07); }

.main {
  min-width: 0; display: flex; flex-direction: column;
  background:
    radial-gradient(800px 500px at 85% -10%, var(--bg-glow-1), transparent 70%),
    radial-gradient(700px 500px at 10% 110%, var(--bg-glow-2), transparent 70%),
    var(--bg);
}
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 14px 28px;
  background: var(--glass); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin-right: auto; font-size: 22px; }
.menu-btn { display: none; }
.page { padding: 28px; }
.page-narrow { max-width: 800px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 22px; box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin-bottom: 16px; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: 270px; transform: translateX(-100%); transition: transform .25s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .page { padding: 16px; }
}

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-weight: 500; color: var(--ink-3); font-size: 13px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 18px 22px; box-shadow: var(--shadow-sm);
}
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, var(--bg-glow-1), transparent 70%); }
.stat:first-child { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 12px 30px rgba(30,91,255,.35); }
.stat:first-child span { color: rgba(255,255,255,.85); }
.stat b { display: block; font-size: 32px; font-weight: 700; letter-spacing: -.03em; }
.stat span { color: var(--ink-3); font-size: 13px; }
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 200px 1fr 170px; gap: 14px; align-items: center; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { height: 100%; border-radius: 99px; box-shadow: inset 0 1px 0 rgba(255,255,255,.4); animation: grow 1s cubic-bezier(.2,.9,.3,1) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.bar-row .num { text-align: right; font-weight: 600; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bar-row { grid-template-columns: 1fr; gap: 4px; } .bar-row .num { text-align: left; } }

/* ===================================================================== */
/* Kanban board                                                           */
/* ===================================================================== */
.board-tools {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 28px;
  background: var(--glass); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.board-tools input[type=search] {
  width: 260px; padding-left: 36px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237C88A3' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
}
.board-tools select { width: auto; min-width: 160px; }
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(290px, 1fr); gap: 14px;
  padding: 20px 28px 28px; overflow-x: auto; align-items: start; min-height: calc(100vh - 150px);
  perspective: 1600px;
}
.col { display: flex; flex-direction: column; max-height: calc(100vh - 180px); min-width: 0; }
.col-head {
  position: relative; height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 28px 0 16px; color: var(--stage-ink, #fff); font-weight: 600;
  border-radius: 10px 0 0 10px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
  background-color: var(--stage);
  background-image: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,0) 65%);
}
.col-head .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head .count { flex: none; font-weight: 600; font-size: 13px; padding: 1px 9px; border-radius: 99px; background: rgba(255,255,255,.25); }
.col-sum {
  margin: 10px 0; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--ink);
  background: var(--glass); border: 1px dashed var(--line-2);
}
.col-head, .col-sum, .card, .col-empty { flex: none; }
.col-body {
  padding: 4px 2px 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 120px; align-content: start; flex: 1;
  border-radius: 12px; transition: background .15s;
}
.col.drop .col-body { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-empty { color: var(--ink-3); font-size: 13px; text-align: center; padding: 22px 8px; border: 1.5px dashed var(--line-2); border-radius: 12px; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 12px 18px;
  cursor: grab; display: grid; gap: 8px; text-align: left; color: inherit; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--stage); }
.card:hover { transform: translateY(-3px) rotateX(4deg); box-shadow: var(--shadow); border-color: var(--line-2); }
.card.dragging { opacity: .4; transform: scale(.98); }
.card.pending { opacity: .7; }
.card .t { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card .t strong { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.card .v { font-weight: 700; font-size: 15px; letter-spacing: -.01em; color: var(--ink); }
.card .v.zero { color: var(--ink-3); font-weight: 500; }
.card .ph { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 13px; font-weight: 500; }
.card .ph svg.i { width: 14px; height: 14px; }
.card .fl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; font-size: 12.5px; margin: 0; }
.card .fl dt { color: var(--ink-3); }
.card .fl dd { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--ink-2); }
.card .fl dd span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .ft { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); padding-top: 8px; border-top: 1px solid var(--line); }
.card .prio-high { color: var(--danger); font-weight: 600; }
.drop-marker { height: 4px; background: var(--grad); border-radius: 2px; margin: -3px 0; box-shadow: 0 0 10px rgba(30,91,255,.6); }
.board-empty { margin: 24px 28px 0; }

/* Drawer & dialogs */
.scrim { position: fixed; inset: 0; background: rgba(6, 12, 34, .45); backdrop-filter: blur(3px); z-index: 40; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 100vw); background: var(--surface); z-index: 45;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .3s cubic-bezier(.2,.9,.3,1);
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer header { display: flex; align-items: center; gap: 8px; padding: 16px 22px; background: var(--grad); color: #fff; }
.drawer header h2 { margin-right: auto; font-size: 18px; }
.drawer header .btn { color: #fff; }
.drawer header .btn:hover { background: rgba(255,255,255,.15); border-color: transparent; }
.drawer .body { padding: 22px; overflow-y: auto; flex: 1; }
.drawer .stage-pill { border-left: 5px solid var(--stage); }
dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(580px, calc(100vw - 32px)); box-shadow: var(--shadow-lg);
}
dialog[open] { animation: pop .28s cubic-bezier(.2,.9,.3,1.15); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
dialog::backdrop { background: rgba(6, 12, 34, .5); backdrop-filter: blur(3px); }
dialog form > header { padding: 18px 22px; border-bottom: 1px solid var(--line); }
dialog .dbody { padding: 22px; max-height: 70vh; overflow-y: auto; }
dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.dups { border: 1px solid var(--warn); background: rgba(194,120,3,.06); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.dups ul { margin: 8px 0 0; padding-left: 18px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.timeline li { display: grid; grid-template-columns: 12px 1fr; gap: 12px; }
.timeline li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--line-2); margin-top: 4px; box-shadow: 0 0 0 4px var(--surface-2); }
.timeline li.note::before { background: var(--accent); }
.timeline li.stage::before { background: var(--accent-2); }
.timeline .b { white-space: pre-wrap; margin-top: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--navy-1); color: #CFE0FF; border-radius: 12px; padding: 14px; overflow-x: auto; white-space: pre; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: ui-monospace, monospace; font-size: 13px; }
.stage-row { display: grid; grid-template-columns: 24px 1fr 54px 150px auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stage-row .grip { cursor: grab; color: var(--ink-3); }
.stage-row.dragging { opacity: .5; }
@media (max-width: 700px) { .stage-row { grid-template-columns: 24px 1fr 54px; } .stage-row > :nth-child(n+4) { grid-column: 2 / -1; } }

/* ===================================================================== */
/* Welcome animation: plays once after login                              */
/* ===================================================================== */
.intro {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; pointer-events: none;
  background: radial-gradient(90% 90% at 50% 40%, #17348C 0%, var(--navy-2) 40%, var(--navy-1) 100%);
  clip-path: circle(150% at 50% 50%);
  animation: intro-out .9s 1.5s cubic-bezier(.7, 0, .2, 1) forwards;
  perspective: 900px;
}
.intro-cube { width: 96px; height: 96px; position: relative; transform-style: preserve-3d; animation: cube 1.6s cubic-bezier(.3, .9, .3, 1) forwards; }
.intro-cube i {
  position: absolute; inset: 0; border-radius: 22px; display: grid; place-items: center; color: #fff; font: 800 48px/1 "Onest", sans-serif; font-style: normal;
  background: var(--grad); box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 0 60px rgba(34,184,240,.45);
}
.intro-cube i:nth-child(1) { transform: translateZ(48px); }
.intro-cube i:nth-child(2) { transform: rotateY(90deg) translateZ(48px); filter: brightness(.8); }
.intro-cube i:nth-child(3) { transform: rotateY(180deg) translateZ(48px); filter: brightness(.7); }
.intro-cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(48px); filter: brightness(.85); }
.intro-cube i:nth-child(5) { transform: rotateX(90deg) translateZ(48px); filter: brightness(1.1); }
.intro-cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(48px); filter: brightness(.6); }
.intro-word { position: absolute; top: calc(50% + 86px); color: #fff; font: 700 28px/1 "Onest", sans-serif; letter-spacing: .02em; animation: word .8s .7s both; }
.intro-ring { position: absolute; width: 220px; height: 220px; border-radius: 50%; border: 2px solid rgba(95,224,255,.5); animation: ring 1.4s .2s ease-out both; }
@keyframes cube { 0% { transform: rotateX(-30deg) rotateY(-200deg) scale(.3); opacity: 0; } 60% { opacity: 1; } 100% { transform: rotateX(-12deg) rotateY(20deg) scale(1); } }
@keyframes word { from { opacity: 0; transform: translateY(14px); letter-spacing: .4em; } }
@keyframes ring { from { transform: scale(.2); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
@keyframes intro-out { to { clip-path: circle(0% at 50% 50%); opacity: 0; } }
.intro-on .sidebar { animation: side-in .8s 1.7s cubic-bezier(.2,.9,.3,1) both; }
.intro-on .topbar, .intro-on .board-tools { animation: rise .7s 1.8s cubic-bezier(.2,.9,.3,1) both; }
.intro-on .col { animation: col-in .9s cubic-bezier(.2, .9, .25, 1.1) both; animation-delay: calc(1.9s + var(--i, 0) * .09s); transform-origin: top center; }
.intro-on .card { animation: card-in .7s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(2.15s + var(--i, 0) * .09s + var(--j, 0) * .05s); }
@keyframes side-in { from { transform: translateX(-60px); opacity: 0; } }
@keyframes col-in { from { opacity: 0; transform: translateZ(-400px) rotateX(35deg) translateY(60px); } }
@keyframes card-in { from { opacity: 0; transform: translateY(30px) rotateX(-25deg) scale(.95); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .intro { display: none; }
}
