/* ============================================================
   LegalOS Workspace — premium AI legal platform (frontend demo)
   Light: warm ivory paper · Dark: deep navy
   ============================================================ */

:root {
  --bg: #f7f5f0;
  --bg-soft: #f0ede5;
  --surface: #ffffff;
  --surface-2: #fcfbf8;
  --glass: rgba(255, 255, 255, 0.72);
  --ink: #10162e;
  --body: #4a5064;
  --muted: #868b9d;
  --line: rgba(16, 22, 46, 0.1);
  --line-strong: rgba(16, 22, 46, 0.16);
  --accent: #2456e6;
  --accent-soft: rgba(36, 86, 230, 0.09);
  --accent-line: rgba(36, 86, 230, 0.3);
  --navy: #0a1633;
  --ok: #0f7b52;
  --ok-soft: rgba(15, 123, 82, 0.1);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.1);
  --danger: #be3144;
  --danger-soft: rgba(190, 49, 68, 0.09);

  --shadow-sm: 0 1px 2px rgba(16, 22, 46, 0.05), 0 4px 14px rgba(16, 22, 46, 0.05);
  --shadow-md: 0 2px 6px rgba(16, 22, 46, 0.05), 0 18px 44px -14px rgba(16, 22, 46, 0.16);
  --shadow-lg: 0 4px 14px rgba(16, 22, 46, 0.07), 0 36px 90px -28px rgba(16, 22, 46, 0.3);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html.dark {
  --bg: #090e1c;
  --bg-soft: #0c1224;
  --surface: #101830;
  --surface-2: #0d142a;
  --glass: rgba(16, 24, 48, 0.72);
  --ink: #e8ecf9;
  --body: #a7b0cb;
  --muted: #6a7494;
  --line: rgba(168, 186, 235, 0.11);
  --line-strong: rgba(168, 186, 235, 0.2);
  --accent: #5b83f2;
  --accent-soft: rgba(91, 131, 242, 0.13);
  --accent-line: rgba(91, 131, 242, 0.4);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87181;
  --danger-soft: rgba(248, 113, 129, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3), 0 18px 44px -14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 4px 14px rgba(0, 0, 0, 0.35), 0 36px 90px -28px rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background 0.35s ease, color 0.35s ease;
}
a { text-decoration: none; color: inherit; }
::selection { background: rgba(36, 86, 230, 0.2); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.font-serif { font-family: var(--serif) !important; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }

.sidebar {
  position: relative;
  width: 252px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  transition: background 0.35s ease;
  overflow: hidden;
}
.sidebar::before {
  content: "";
  position: absolute;
  top: -140px; left: 50%;
  transform: translateX(-50%);
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 65%);
  pointer-events: none;
}
@media (max-width: 991px) { .app > .sidebar { display: none; } }

.side-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 16px;
}
.side-logo {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(140deg, #0a1633, #1e3fae);
  color: #c8d8ff;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  box-shadow: 0 10px 22px -8px rgba(30, 63, 174, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
html.dark .side-logo { background: linear-gradient(140deg, #2456e6, #5b83f2); color: #fff; }
.side-pro {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(120deg, #1e3fae, #4d79f5);
  color: #fff;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  box-shadow: 0 4px 12px -4px rgba(36, 86, 230, 0.6);
}
.side-name {
  font-family: var(--serif);
  font-size: 1.16rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.1;
  display: flex;
  flex-direction: column;
}
.side-name small { font-family: var(--sans); font-size: 0.64rem; font-weight: 550; color: var(--muted); letter-spacing: 0.02em; }

.side-cta { position: relative; padding: 8px 16px 18px; }
.side-cta .btn-ai { padding: 12px 20px; border-radius: 13px; }

.side-label {
  padding: 4px 28px 8px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.side-nav { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 0 12px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10.5px 14px;
  border-radius: 12px;
  font-size: 0.89rem;
  font-weight: 550;
  color: var(--body);
  transition: background 0.2s ease, color 0.2s ease, transform 0.25s var(--ease), box-shadow 0.25s ease;
}
.side-nav a i:first-child { font-size: 1.02rem; opacity: 0.8; transition: transform 0.3s var(--ease); }
.side-nav a:hover { background: var(--accent-soft); color: var(--ink); transform: translateX(2px); }
.side-nav a:hover i:first-child { transform: scale(1.12); opacity: 1; }
.side-nav a.active {
  background: linear-gradient(100deg, var(--accent-soft), transparent 130%);
  color: var(--accent);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.side-nav a.active i:first-child { opacity: 1; }

.side-badge {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  transition: all 0.2s ease;
}
.side-nav a.active .side-badge, .side-nav a:hover .side-badge {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.side-badge-hot {
  background: linear-gradient(120deg, #1e3fae, #4d79f5) !important;
  border: none !important;
  color: #fff !important;
  letter-spacing: 0.06em;
}

/* AI usage widget */
.side-widget {
  position: relative;
  margin: auto 14px 14px;
  padding: 15px 16px;
  border-radius: 16px;
  background: linear-gradient(155deg, #0a1633, #12245c);
  color: #cfe0ff;
  overflow: hidden;
  box-shadow: 0 16px 34px -14px rgba(10, 22, 51, 0.55);
}
.side-widget::before {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 121, 245, 0.45), transparent 65%);
  pointer-events: none;
}
.sw-head { display: flex; align-items: center; gap: 9px; font-size: 0.76rem; font-weight: 700; color: #e8efff; margin-bottom: 9px; }
.sw-num { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; color: #fff; }
.sw-num span { font-family: var(--sans); font-size: 0.64rem; font-weight: 600; color: #8fa5d8; }
.sw-bar { height: 6px; border-radius: 99px; background: rgba(147, 180, 255, 0.16); overflow: hidden; margin: 9px 0 7px; }
.sw-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4d79f5, #9db9ff); animation: sw-fill 1.4s var(--ease) both; }
@keyframes sw-fill { from { width: 0; } }
.side-widget small { font-size: 0.64rem; color: #8fa5d8; font-weight: 550; }

.side-foot { padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.side-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.side-user:hover { background: var(--surface); border-color: var(--line); }
.side-user .avatar { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--accent-line); }
.side-user strong { display: block; font-size: 0.8rem; font-weight: 650; color: var(--ink); }
.side-user small { font-size: 0.66rem; color: var(--muted); }
.side-gear {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.2s ease, transform 0.4s var(--ease);
}
.side-user:hover .side-gear { color: var(--accent); transform: rotate(40deg); }

.side-offcanvas { width: 272px !important; background: var(--surface-2); border-right: 1px solid var(--line); }
.sidebar-mobile { width: 100%; height: 100%; border-right: none; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 20;
}
.top-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.top-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.top-search i { color: var(--muted); font-size: 0.9rem; }
.top-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.86rem;
  color: var(--ink);
  font-family: var(--sans);
}
.top-search input::placeholder { color: var(--muted); }
.top-search kbd {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--muted);
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--body);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.25s var(--ease), background 0.2s ease;
}
.icon-btn:hover { border-color: var(--accent-line); color: var(--accent); transform: translateY(-1px); }
.notif-dot {
  position: absolute;
  top: 9px; right: 10px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--surface);
}
.theme-ico-light { display: none; }
html.dark .theme-ico-dark { display: none; }
html.dark .theme-ico-light { display: block; }

/* ---------- View ---------- */
.view {
  flex: 1;
  overflow-y: auto;
  padding: 26px 26px 60px;
  scroll-behavior: smooth;
}
@media (max-width: 640px) { .view { padding: 18px 14px 80px; } }

.view-enter { animation: view-in 0.5s var(--ease) both; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.6vw, 2.15rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.page-head h1 em { font-style: italic; color: var(--accent); font-weight: 400; }
.page-sub { margin: 5px 0 0; font-size: 0.9rem; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn-ai {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(120deg, #1e3fae, #2456e6 60%, #4d79f5);
  background-size: 160% 160%;
  color: #fff;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 10px 24px -10px rgba(36, 86, 230, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background-position 0.4s ease;
}
.btn-ai:hover {
  transform: translateY(-1.5px);
  background-position: 100% 50%;
  box-shadow: 0 14px 30px -10px rgba(36, 86, 230, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #fff;
}
.btn-ai:active { transform: translateY(0); }
.btn-ai:disabled { opacity: 0.55; pointer-events: none; }

.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.3s var(--ease), background 0.2s ease;
}
.btn-soft:hover { border-color: var(--accent-line); transform: translateY(-1px); color: var(--ink); }

.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.2s ease, box-shadow 0.25s ease;
  white-space: nowrap;
}
.btn-chip:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(36, 86, 230, 0.5); }

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--body);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}
.btn-ghost-sm:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }

/* ---------- Cards, pills, avatars ---------- */
.los-card {
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.25s ease, background 0.35s ease;
}
.los-card.hoverable { cursor: pointer; }
.los-card.hoverable:hover { transform: translateY(-4px); border-color: var(--accent-line); box-shadow: var(--shadow-md); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3.5px 11px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-muted { background: var(--bg-soft); color: var(--muted); }

.avatar {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.avatar.sm { width: 28px; height: 28px; font-size: 0.56rem; }
.avatar.lg { width: 58px; height: 58px; font-size: 1rem; }
.av-navy { background: linear-gradient(135deg, #0a1633, #1e3fae); }
.av-blue { background: linear-gradient(135deg, #2456e6, #4d79f5); }
.av-teal { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.av-plum { background: linear-gradient(135deg, #6d28d9, #a78bfa); }
.av-rose { background: linear-gradient(135deg, #9f1239, #fb7185); }
.av-amber { background: linear-gradient(135deg, #92400e, #f59e0b); }

/* stat tile */
.stat-tile { padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.stat-tile small { font-size: 0.7rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.stat-tile strong { display: block; font-family: var(--serif); font-size: 1.7rem; font-weight: 500; color: var(--ink); margin-top: 3px; }
.stat-tile .trend { font-size: 0.7rem; font-weight: 650; }

/* ---------- Category / template cards ---------- */
.cat-card {
  position: relative;
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.25s ease;
}
.cat-card:hover { transform: translateY(-4px); border-color: var(--accent-line); box-shadow: var(--shadow-md); }
.cat-card.open { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md); }
.cat-ico {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.15rem;
  margin-bottom: 14px;
  transition: transform 0.35s var(--ease);
}
.cat-card:hover .cat-ico { transform: scale(1.08) rotate(-4deg); }
.cat-card h3 { font-family: var(--serif); font-size: 1.05rem; font-weight: 500; margin: 0 0 3px; color: var(--ink); }
.cat-card small { font-size: 0.72rem; color: var(--muted); font-weight: 550; }

.tpl-panel {
  grid-column: 1 / -1;
  border-radius: var(--r-lg);
  border: 1px solid var(--accent-line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 22px;
  animation: view-in 0.45s var(--ease) both;
}
.tpl-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.2s ease, background 0.2s ease, box-shadow 0.3s ease;
}
.tpl-item:hover { transform: translateY(-2px); border-color: var(--accent-line); background: var(--surface); box-shadow: var(--shadow-sm); }
.tpl-item i { color: var(--accent); font-size: 1.05rem; }
.tpl-item strong { display: block; font-size: 0.84rem; font-weight: 650; color: var(--ink); }
.tpl-item small { font-size: 0.68rem; color: var(--muted); }
.tpl-item .bi-arrow-right { margin-left: auto; opacity: 0; transform: translateX(-4px); transition: all 0.3s var(--ease); color: var(--accent); }
.tpl-item:hover .bi-arrow-right { opacity: 1; transform: none; }

/* ---------- Drafting workspace (split) ---------- */
.draft-wrap {
  display: grid;
  grid-template-columns: minmax(360px, 440px) 1fr;
  gap: 18px;
  height: calc(100vh - 175px);
  height: calc(100dvh - 175px);
  min-height: 480px;
}
.draft-wrap.chat-main { grid-template-columns: 1fr minmax(300px, 380px); }
@media (max-width: 991px) {
  .draft-wrap, .draft-wrap.chat-main { grid-template-columns: 1fr; height: auto; }
  .draft-pane { height: 68vh; }
  .draft-pane.d-none-mobile { display: none; }
}

.draft-pane {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 0;
}
.pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  flex-shrink: 0;
}
.pane-head strong { font-size: 0.86rem; font-weight: 650; color: var(--ink); }
.pane-head small { font-size: 0.68rem; color: var(--muted); }
.ai-orb {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2456e6, #7c9bf7);
  color: #fff;
  font-size: 0.8rem;
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: orb-breathe 3.2s ease-in-out infinite;
}
@keyframes orb-breathe {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 8px rgba(36, 86, 230, 0.04); }
}

/* Chat */
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 13px; }
.msg { max-width: 88%; animation: msg-in 0.4s var(--ease) both; }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.msg-ai {
  align-self: flex-start;
  padding: 12px 15px;
  border-radius: 15px 15px 15px 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--body);
}
.msg-ai b, .msg-ai strong { color: var(--ink); }
.msg-user {
  align-self: flex-end;
  padding: 12px 15px;
  border-radius: 15px 15px 5px 15px;
  background: linear-gradient(120deg, #1e3fae, #2456e6);
  color: #e8efff;
  font-size: 0.84rem;
  line-height: 1.55;
}
.msg-sys {
  align-self: center;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}
.typing { display: inline-flex; gap: 4px; padding: 13px 16px; }
.typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: ty 1.1s ease-in-out infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ty { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.chat-suggest { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 18px 10px; }
.chat-input-row {
  display: flex;
  gap: 9px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 15px;
  font-size: 0.85rem;
  font-family: var(--sans);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.chat-input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.chat-send {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(120deg, #1e3fae, #2456e6);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease;
  flex-shrink: 0;
}
.chat-send:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -8px rgba(36, 86, 230, 0.7); }

/* Document paper */
.doc-scroll { flex: 1; overflow-y: auto; padding: 22px; background: var(--bg-soft); }
.doc-paper {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: clamp(26px, 4vw, 52px);
  font-size: 0.86rem;
  line-height: 1.75;
  color: var(--body);
}
.doc-paper h2 {
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 550;
  text-align: center;
  color: var(--ink);
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}
.doc-paper h3 {
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 26px 0 10px;
}
.doc-paper .doc-meta { text-align: center; font-size: 0.72rem; color: var(--muted); margin-bottom: 26px; }
.doc-paper p { margin: 0 0 12px; }
.doc-paper .sig { margin-top: 40px; display: flex; justify-content: space-between; gap: 20px; font-size: 0.76rem; color: var(--muted); }
.doc-paper .sig span { border-top: 1px solid var(--line-strong); padding-top: 8px; min-width: 170px; text-align: center; }

.ph {
  display: inline-block;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.76rem;
  font-weight: 650;
  border: 1px dashed rgba(180, 83, 9, 0.4);
}
.filled {
  display: inline;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.flash { animation: fill-flash 1.4s ease both; }
@keyframes fill-flash {
  0% { background: rgba(36, 86, 230, 0.35); box-shadow: 0 0 0 5px rgba(36, 86, 230, 0.18); }
  100% { background: var(--accent-soft); box-shadow: none; }
}
.sec-new { animation: sec-in 0.7s var(--ease) both; }
@keyframes sec-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* Floating AI actions on document */
.doc-actions {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 9px 11px;
  margin: -8px auto 16px;
  max-width: 760px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  scrollbar-width: none;
}
.doc-actions::-webkit-scrollbar { display: none; }

/* Progress checklist / review */
.review-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.review-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.review-item.done { color: var(--ink); }
.review-item .spin {
  width: 15px; height: 15px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.review-item .bi-check-circle-fill { color: var(--ok); }

/* Draft progress bar */
.draft-progress { height: 4px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; flex: 1; }
.draft-progress i { display: block; height: 100%; background: linear-gradient(90deg, #2456e6, #7c9bf7); border-radius: inherit; transition: width 0.6s var(--ease); }

/* Mobile chat/doc switch */
.pane-switch { display: none; gap: 8px; margin-bottom: 14px; }
@media (max-width: 991px) { .pane-switch { display: flex; } }
.pane-switch button {
  flex: 1;
  padding: 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--body);
  cursor: pointer;
}
.pane-switch button.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* ---------- Clients ---------- */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.client-card { padding: 20px; }
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.76rem; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.meta-row:last-child { border-bottom: none; }
.meta-row span:first-child { color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 7px; }
.meta-row span:last-child { color: var(--ink); font-weight: 600; text-align: right; }
.ai-note {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--body);
}
.ai-note b { color: var(--accent); font-weight: 700; }

/* Detail tabs */
.los-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 20px; scrollbar-width: none; }
.los-tabs::-webkit-scrollbar { display: none; }
.los-tab {
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.los-tab:hover { color: var(--ink); }
.los-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Timeline */
.tl { position: relative; padding-left: 26px; display: flex; flex-direction: column; gap: 18px; }
.tl::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -25px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
}
.tl-item strong { display: block; font-size: 0.83rem; font-weight: 650; color: var(--ink); }
.tl-item p { margin: 2px 0 0; font-size: 0.78rem; color: var(--body); }
.tl-item small { font-size: 0.66rem; color: var(--muted); font-weight: 600; }

/* Quick actions row */
.qa-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Documents ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 15px; }
.doc-card { padding: 18px; position: relative; }
.doc-type {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  font-size: 1.05rem;
  margin-bottom: 13px;
}
.dt-pdf { background: var(--danger-soft); color: var(--danger); }
.dt-doc { background: var(--accent-soft); color: var(--accent); }
.dt-img { background: var(--ok-soft); color: var(--ok); }
.doc-card h4 { font-size: 0.85rem; font-weight: 650; color: var(--ink); margin: 0 0 4px; line-height: 1.4; word-break: break-word; }
.doc-card .doc-sub { font-size: 0.68rem; color: var(--muted); }
.doc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.doc-list-row {
  display: grid;
  grid-template-columns: 44px 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
}
@media (max-width: 767px) { .doc-list-row { grid-template-columns: 44px 1fr auto; } .doc-list-hide { display: none; } }

.folder-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--body);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.folder-chip.active, .folder-chip:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }

.los-dropdown {
  border-radius: 14px !important;
  border: 1px solid var(--line) !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-md) !important;
  padding: 6px !important;
  font-size: 0.82rem;
}
.los-dropdown .dropdown-item { border-radius: 9px; padding: 8px 12px; color: var(--body); font-weight: 550; display: flex; gap: 10px; align-items: center; }
.los-dropdown .dropdown-item i { width: 16px; }
.los-dropdown .dropdown-item:hover { background: var(--accent-soft); color: var(--accent); }
.los-dropdown .dropdown-item.text-danger:hover { background: var(--danger-soft); color: var(--danger) !important; }
.los-dropdown .dropdown-divider { border-color: var(--line); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(262px, 1fr)); gap: 15px; overflow-x: auto; align-items: start; padding-bottom: 12px; }
@media (max-width: 1200px) { .kanban { display: flex; } .kanban > * { min-width: 272px; } }
.kb-col {
  border-radius: var(--r-lg);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 13px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.kb-col.drag-over { border-color: var(--accent-line); background: var(--accent-soft); }
.kb-col-head { display: flex; align-items: center; gap: 9px; padding: 2px 6px 12px; }
.kb-col-head strong { font-size: 0.8rem; font-weight: 700; color: var(--ink); }
.kb-count { margin-left: auto; font-size: 0.66rem; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; }
.kb-dot { width: 8px; height: 8px; border-radius: 50%; }
.kb-cards { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.kb-card {
  padding: 14px 15px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.2s ease, opacity 0.2s ease;
}
.kb-card:hover { transform: translateY(-2px); border-color: var(--accent-line); box-shadow: var(--shadow-md); }
.kb-card.dragging { opacity: 0.45; transform: rotate(2deg) scale(0.98); cursor: grabbing; }
.kb-card h5 { font-size: 0.82rem; font-weight: 650; color: var(--ink); margin: 8px 0 6px; line-height: 1.45; }
.kb-card .kb-meta { display: flex; align-items: center; gap: 8px; font-size: 0.66rem; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.kb-progress { height: 5px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; margin-top: 11px; }
.kb-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2456e6, #7c9bf7); }
.kb-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }

/* ---------- Modal / inputs ---------- */
.los-modal {
  border-radius: var(--r-xl) !important;
  border: 1px solid var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink);
  box-shadow: var(--shadow-lg) !important;
}
.los-modal .modal-header, .los-modal .modal-footer { border-color: var(--line); }
.los-modal .modal-title { font-family: var(--serif); font-weight: 550; font-size: 1.1rem; }
.los-modal .form-label { font-size: 0.76rem; font-weight: 650; color: var(--muted); }
.los-modal .btn-close { filter: none; }
html.dark .los-modal .btn-close { filter: invert(1) brightness(1.6); }

.los-input {
  border-radius: 12px !important;
  border: 1px solid var(--line) !important;
  background: var(--surface-2) !important;
  color: var(--ink) !important;
  font-size: 0.86rem !important;
  padding: 10px 14px !important;
}
.los-input:focus { border-color: var(--accent-line) !important; box-shadow: 0 0 0 4px var(--accent-soft) !important; }
.los-input::placeholder { color: var(--muted); }

.email-attach { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--body);
}
.attach-chip i { color: var(--danger); }

.preview-body { background: var(--bg-soft); border-radius: 0 0 var(--r-xl) var(--r-xl); max-height: 72vh; overflow-y: auto; padding: 24px; }

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
}
.los-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 17px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--ink);
  animation: toast-in 0.45s var(--ease) both;
}
.los-toast.out { animation: toast-out 0.4s var(--ease) both; }
.los-toast i { color: var(--accent); font-size: 1rem; margin-top: 1px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(0.97); } }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
  font-size: 0.85rem;
}
.empty i { font-size: 1.8rem; display: block; margin-bottom: 10px; opacity: 0.5; }

/* ---------- AI shimmer text ---------- */
.ai-grad {
  background: linear-gradient(100deg, #1e3fae, #2456e6 45%, #7c9bf7 65%, #2456e6);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 5s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* ============================================================
   PREMIUM POLISH
   ============================================================ */

/* ---------- Drafting hero panel ---------- */
.hero-panel {
  position: relative;
  border-radius: var(--r-xl);
  background: linear-gradient(160deg, #081128 0%, #0a1633 55%, #12245c 100%);
  overflow: hidden;
  box-shadow: 0 34px 80px -28px rgba(6, 13, 33, 0.55);
}
.hp-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(147, 180, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(147, 180, 255, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 90% 80% at 30% 0%, #000, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 30% 0%, #000, transparent 80%);
  pointer-events: none;
}
.hp-glow {
  position: absolute;
  width: 560px; height: 560px;
  top: -280px; right: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 121, 245, 0.35), rgba(77, 121, 245, 0.1) 42%, transparent 68%);
  pointer-events: none;
  animation: hp-drift 16s ease-in-out infinite alternate;
}
.hp-glow2 {
  width: 420px; height: 420px;
  top: auto; right: auto;
  bottom: -260px; left: -140px;
  background: radial-gradient(circle, rgba(36, 86, 230, 0.28), transparent 65%);
  animation-delay: -8s;
}
@keyframes hp-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-26px, 20px) scale(1.06); }
}
.hp-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 30px;
  align-items: center;
  padding: clamp(28px, 4vw, 52px);
}
@media (max-width: 991px) { .hp-inner { grid-template-columns: 1fr; } .hp-visual { display: none; } }

.hp-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid rgba(147, 180, 255, 0.28);
  background: rgba(77, 121, 245, 0.14);
  color: #b9ccff;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.hp-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #7c9bf7;
  box-shadow: 0 0 0 3px rgba(124, 155, 247, 0.25);
  animation: orb-breathe 2.4s ease-in-out infinite;
}
.hp-copy h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.6vw, 2.7rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: #f5f7ff;
  margin: 18px 0 14px;
}
.hp-copy h1 em {
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(100deg, #9db9ff, #6f95f7 50%, #c1d2ff);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s ease-in-out infinite;
}
.hp-copy p { color: #9dabce; font-size: 0.94rem; line-height: 1.7; max-width: 30rem; margin: 0; }
.hp-trust { margin-top: 22px; font-size: 0.7rem; font-weight: 600; color: #6d7ea8; letter-spacing: 0.03em; }
.hp-trust i { color: #4ade80; margin-right: 4px; }

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 26px;
  border: none;
  border-radius: 13px;
  background: #fff;
  color: var(--navy);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.55), inset 0 -1px 0 rgba(10, 22, 51, 0.08);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.btn-hero:hover { transform: translateY(-2px); box-shadow: 0 20px 44px -12px rgba(0, 0, 0, 0.65); }
.btn-hero i { color: var(--accent); }
.btn-hero-ghost {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 24px;
  border-radius: 13px;
  border: 1px solid rgba(147, 180, 255, 0.3);
  background: rgba(147, 180, 255, 0.07);
  color: #cfe0ff;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}
.btn-hero-ghost:hover { transform: translateY(-2px); background: rgba(147, 180, 255, 0.14); border-color: rgba(147, 180, 255, 0.55); }

/* --- animated mini document --- */
.hp-visual { position: relative; }
.mini-doc {
  position: relative;
  max-width: 400px;
  margin-left: auto;
  padding: 20px 22px;
  border-radius: 18px;
  background: rgba(252, 251, 248, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 32px 70px -20px rgba(0, 0, 0, 0.55);
  transform: rotate(1.6deg);
  display: flex;
  flex-direction: column;
  gap: 11px;
  animation: floaty 8s ease-in-out infinite;
  will-change: transform;
}
@keyframes floaty {
  0%, 100% { transform: rotate(1.6deg) translateY(0); }
  50% { transform: rotate(1.6deg) translateY(-9px); }
}
.md-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(16, 22, 46, 0.09);
  font-size: 0.76rem;
  font-weight: 700;
  color: #10162e;
}
.md-head i { color: #2456e6; }
.md-badge {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: linear-gradient(120deg, #1e3fae, #2456e6);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}
.md-line { display: block; height: 8px; border-radius: 4px; background: rgba(16, 22, 46, 0.1); }
.md-fill {
  display: block;
  padding: 7px 11px;
  border-radius: 8px;
  background: rgba(36, 86, 230, 0.08);
  color: #2456e6;
  font-size: 0.68rem;
  font-weight: 700;
}
.md-redline {
  display: block;
  padding: 8px 11px;
  border-radius: 8px;
  background: #fff;
  border: 1px dashed rgba(36, 86, 230, 0.45);
  color: #4a5064;
  font-size: 0.64rem;
  font-weight: 600;
}
.md-write {
  position: relative;
  width: 30%;
  background: rgba(36, 86, 230, 0.35);
  animation: md-write 3.2s ease-in-out infinite;
}
.md-write::after {
  content: "";
  position: absolute;
  right: -7px; top: -2px;
  width: 2px; height: 12px;
  background: #2456e6;
  animation: blink 0.9s steps(1) infinite;
}
@keyframes md-write { 0%, 15% { width: 8%; } 70%, 100% { width: 76%; } }
@keyframes blink { 50% { opacity: 0; } }
.md-foot {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(16, 22, 46, 0.09);
  font-size: 0.62rem;
  font-weight: 700;
  color: #868b9d;
}
.md-check { color: #0f7b52; }

.hp-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.97);
  color: #10162e;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 16px 34px -12px rgba(0, 0, 0, 0.5);
  animation: floaty-chip 6.5s ease-in-out infinite;
  will-change: transform;
}
.hp-chip i { color: #2456e6; }
.hp-chip1 { top: -16px; right: 6%; }
.hp-chip1 i { color: #0f7b52; }
.hp-chip2 { bottom: -14px; left: 4%; animation-delay: 1s; }
@keyframes floaty-chip { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- Stat tiles upgrade ---------- */
.stat-tile { position: relative; overflow: hidden; }
.st-ico {
  position: absolute;
  top: 16px; right: 16px;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
}
.stat-tile strong {
  background: linear-gradient(100deg, var(--ink), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Button sheen (AI buttons) ---------- */
.btn-ai { position: relative; overflow: hidden; }
.btn-ai::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.35) 50%, transparent 62%);
  transform: translateX(-130%);
  transition: transform 0.7s var(--ease);
  pointer-events: none;
}
.btn-ai:hover::after { transform: translateX(130%); }

/* ---------- Sidebar active indicator ---------- */
.side-nav a { position: relative; }
.side-nav a.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 22%;
  width: 3.5px; height: 56%;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #2456e6, #7c9bf7);
}

/* ---------- Category card arrow ---------- */
.cat-card { display: flex; flex-direction: column; }
.cat-arrow {
  position: absolute;
  right: 16px; bottom: 14px;
  font-size: 1.2rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-6px);
  transition: all 0.3s var(--ease);
}
.cat-card:hover .cat-arrow { opacity: 1; transform: none; }

/* ---------- Staggered card entrances ---------- */
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *,
#catGrid > [data-catwrap] {
  opacity: 0;
  animation: rise-in 0.55s var(--ease) forwards;
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *:nth-child(1), #catGrid > [data-catwrap]:nth-child(1) { animation-delay: 0.03s; }
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *:nth-child(2), #catGrid > [data-catwrap]:nth-child(2) { animation-delay: 0.08s; }
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *:nth-child(3), #catGrid > [data-catwrap]:nth-child(3) { animation-delay: 0.13s; }
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *:nth-child(4), #catGrid > [data-catwrap]:nth-child(4) { animation-delay: 0.18s; }
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *:nth-child(5), #catGrid > [data-catwrap]:nth-child(5) { animation-delay: 0.23s; }
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *:nth-child(6), #catGrid > [data-catwrap]:nth-child(6) { animation-delay: 0.28s; }
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *:nth-child(7), #catGrid > [data-catwrap]:nth-child(7) { animation-delay: 0.33s; }
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *:nth-child(8), #catGrid > [data-catwrap]:nth-child(8) { animation-delay: 0.38s; }
:is(.client-grid, .doc-grid, .kanban, .stat-row) > *:nth-child(n+9), #catGrid > [data-catwrap]:nth-child(n+9) { animation-delay: 0.43s; }

/* ---------- Topbar avatar ring ---------- */
.top-actions .avatar {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  cursor: pointer;
  transition: transform 0.3s var(--ease);
}
.top-actions .avatar:hover { transform: scale(1.06); }

/* ---------- Card gradient top edge on hover ---------- */
.los-card.hoverable { position: relative; }
.los-card.hoverable::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(90deg, #1e3fae, #2456e6 50%, #7c9bf7);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease);
}
.los-card.hoverable:hover::before { transform: scaleX(1); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
