@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  /* Tells the browser to use its own dark-mode rendering for native controls
     (select dropdown popups, checkboxes, date pickers, scrollbars) — the
     reliable fix for native <option> popups ignoring our custom colors and
     rendering as unreadable light-on-white in Chromium on Windows. */
  color-scheme: dark;
  /* Dark palette — neutral near-black, no blue tint */
  --bg-1: #09090f;
  --bg-2: #111118;
  --bg-3: #18181f;
  --surface: rgba(22, 22, 30, 0.82);
  --surface-soft: rgba(18, 18, 26, 0.65);
  --text: #f0f0f5;
  --muted: #8b8b9e;
  --line: rgba(255, 255, 255, 0.08);
  --primary: #22d3a0;
  --accent: #3b9eff;
  --primary-press: #16b888;
  --danger: #f56565;
  --warning: #f6ad3c;
  --success: #48bb78;
  --focus: 0 0 0 3px rgba(34, 211, 160, 0.22);
  --radius: 10px;
  --sidebar-w: 220px;
  --topbar-h: 60px;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-head: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-1);
  min-height: 100vh;
}

/* Custom background artwork (dark theme only — it's a dark image, would
   clash with the light theme's white surfaces). Supersedes the procedural
   .bg-orb/.bg-grid effect below, which stays for light theme. */
body:not(.light-theme) {
  background-image: url("../bg-pattern.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
body:not(.light-theme) .bg-orb,
body:not(.light-theme) .bg-grid {
  display: none;
}

/* ─── Auth screen ────────────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-wrap {
  width: min(980px, 100%);
  border-radius: 24px;
  padding: 32px;
  display: grid;
  gap: 24px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand h1 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.2fr 1fr;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(6, 14, 26, 0.6);
  padding: 20px;
}

.auth-notes {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 12.5px;
}

/* ─── Ambient decorations ────────────────────────────────────────────────── */
.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #3b9eff, #0040aa);
  top: -150px;
  right: -100px;
}

.orb-b {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #22d3a0, #0d6647);
  bottom: -60px;
  left: -80px;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
}

/* ─── App shell ──────────────────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

/* ─── Glass morph ────────────────────────────────────────────────────────── */
.glass {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.02) 100%);
  box-shadow: 0 8px 32px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.06);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.sidebar {
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
}

.brand-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 8px 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  color: #03151d;
  box-shadow: 0 4px 14px rgba(34,211,160,0.3);
  flex-shrink: 0;
}

.brand {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--text) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.02em;
}

.nav-block {
  border-radius: 10px;
  padding: 4px 4px 8px;
}

.nav-title {
  margin: 0 0 4px;
  padding: 6px 10px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  opacity: 0.7;
  font-weight: 600;
}

.nav-btn {
  width: 100%;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: rgba(232,241,255,0.65);
  text-align: left;
  padding: 8px 10px;
  margin-bottom: 1px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.nav-btn.active {
  background: rgba(34, 211, 160, 0.12);
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
  flex-shrink: 0;
}

.status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding-bottom: 52px; /* room for log drawer header */
}

.topbar {
  border-radius: 16px;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: var(--topbar-h);
}

.topbar-left { display: flex; flex-direction: column; gap: 2px; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.overline {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

h1, h2, h3 { margin: 0; }

h1 {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
}

h3 {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.panel {
  border-radius: 16px;
  padding: 20px;
}

.auth hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 10px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 5px;
  color: rgba(232,241,255,0.75);
  font-size: 12.5px;
  font-weight: 500;
}

.field label { letter-spacing: 0.01em; }

.field.slim {
  min-width: 200px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(120,165,210,0.25);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: rgba(5,12,24,0.5);
  transition: border-color 0.15s, box-shadow 0.15s;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237fa0c0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Native <option> popups ignore translucent backgrounds and default to an
   opaque white box, which makes light-on-dark option text unreadable —
   give the popup itself an explicit opaque color per theme. Kept as a
   fallback for the rare <select multiple> that custom-select.js leaves
   native (see below). */
select option {
  background: #10141f;
  color: var(--text);
}

body.light-theme select option {
  background: #ffffff;
  color: var(--text);
}

/* ─── Custom dropdown (progressive enhancement over native <select>) ─────── */
.cs-wrap { position: relative; display: block; width: 100%; }
.cs-native.cs-enhanced {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.cs-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  border: 1px solid rgba(120, 165, 210, 0.25);
  border-radius: var(--radius);
  padding: 9px 34px 9px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: rgba(5, 12, 24, 0.5)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237fa0c0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.cs-trigger-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-trigger:hover { background-color: rgba(5, 14, 28, 0.65); }
.cs-trigger:focus-visible { outline: none; border-color: rgba(34, 211, 160, 0.6); box-shadow: var(--focus); }
.cs-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
.cs-wrap.cs-open .cs-trigger { border-color: rgba(34, 211, 160, 0.55); box-shadow: var(--focus); }

.cs-popup {
  position: fixed;
  z-index: 900;
  overflow-y: auto;
  background: #10141f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  padding: 6px;
  animation: cs-pop-in 0.12s ease-out;
}
@keyframes cs-pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.cs-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 26px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cs-option:hover { background: rgba(59, 158, 255, 0.16); }
.cs-option.cs-selected { color: var(--primary); font-weight: 600; }
.cs-option.cs-selected::before {
  content: "✓";
  position: absolute;
  left: 8px;
  font-weight: 700;
}
.cs-option.cs-disabled { color: var(--muted); cursor: default; opacity: 0.55; }

/* bpmn-js-properties-panel: was a white surface with a dark-text contrast
   fix; now re-themed dark to match the canvas re-theme (a bright-white
   panel popping in next to the dark canvas every time you select an
   element read as a jarring "flash" — this keeps the whole designer one
   consistent dark surface instead). */
#bpmn-props-panel {
  background: #1c1f2b;
  color: #d7d9e0;
}
#bpmn-props-panel * { color: inherit; }
#bpmn-props-panel .bio-properties-panel-label,
#bpmn-props-panel .bio-properties-panel-group-header-title,
#bpmn-props-panel .bio-properties-panel-header .bio-properties-panel-header-label {
  color: #d7d9e0 !important;
  opacity: 1 !important;
}
#bpmn-props-panel .bio-properties-panel-header-icon svg {
  fill: #d7d9e0;
}
#bpmn-props-panel input,
#bpmn-props-panel textarea,
#bpmn-props-panel select {
  color: #d7d9e0 !important;
  background: #14141c !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}
#bpmn-props-panel input::placeholder,
#bpmn-props-panel textarea::placeholder {
  color: #7a7d8a !important;
  opacity: 1 !important;
}
#bpmn-props-panel .bio-properties-panel-group,
#bpmn-props-panel .bio-properties-panel-header {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* bpmn-js's context pad (the small action icons — connect/change-type/
   delete — that pop up next to a selected canvas element) inherits the
   app's global --text color (a near-white #f0f0f5 tuned for the dark
   theme) since bpmn-js sets no color of its own here; against the white
   canvas that's almost invisible. Same class of bug as the properties
   panel above, different element. */
.djs-context-pad .entry {
  color: #1c2128 !important;
}

/* Same inherited-near-white-text bug as the context pad above, but for the
   inline label-rename editor (double-click a shape/flow to rename it) — the
   typed text was almost invisible against the white canvas until the edit
   committed and bpmn-js re-rendered it as an SVG <text> (which already had
   its own dark fill, hence "turns black after"). */
.djs-direct-editing-content {
  color: #1c2128 !important;
}

/* Custom "Тип узла (CarvonOS)" sidebar section — same dark re-theme as
   #bpmn-props-panel above, since it sits directly above it in the same
   column and must match. */
.bpmn-carvon-panel {
  background: #1c1f2b;
  color: #d7d9e0;
}
.bpmn-carvon-panel input,
.bpmn-carvon-panel textarea,
.bpmn-carvon-panel select {
  color: #d7d9e0 !important;
  background: #14141c !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}
.bpmn-carvon-panel input::placeholder,
.bpmn-carvon-panel textarea::placeholder {
  color: #7a7d8a !important;
  opacity: 1 !important;
}
.bpmn-carvon-panel textarea { width: 100%; resize: vertical; font-family: inherit; }

/* bpmn-js's palette (the left-side tool/element icon strip) still had its
   default white background + dark icons — same "bright island on the now-
   dark canvas" issue as the properties panel had, same fix. */
#bpmn-canvas .djs-palette {
  background: #1c1f2b !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}
#bpmn-canvas .djs-palette .entry {
  color: #d7d9e0 !important;
}
#bpmn-canvas .djs-palette .entry:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08);
}
#bpmn-canvas .djs-palette .separator {
  border-color: rgba(255, 255, 255, 0.14) !important;
}

/* Graph-paper grid on the BPMN canvas itself, behind bpmn-js's own
   (transparent-background) SVG — purely CSS, doesn't touch bpmn-js. */
#bpmn-canvas svg {
  background: transparent !important;
}
#bpmn-canvas {
  background-color: #14141c;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Dark-canvas re-theme: bpmn-js's shapes (task/event/gateway rects, circles,
   diamonds) already have opaque white fill by default, so black stroke +
   black text on THEM stays perfectly legible without any changes — they
   just read as light cards on the dark canvas. The elements that have NO
   shape fill behind them — sequence flow lines/arrowheads, lane dividers,
   lane header text, text-annotation connectors — are bare black strokes
   that would vanish against the new dark background, so those need an
   explicit light color. */
#bpmn-canvas .djs-connection .djs-visual path {
  stroke: #d7d9e0 !important;
}
#bpmn-canvas .djs-connection .djs-visual polygon,
#bpmn-canvas marker path,
#bpmn-canvas marker polygon {
  fill: #d7d9e0 !important;
  stroke: #d7d9e0 !important;
}
#bpmn-canvas .djs-connection .djs-visual text {
  fill: #d7d9e0 !important;
  font-size: 13px !important;
}
/* Inverted shape treatment (per request): task/event/gateway shapes get a
   dark fill + light outline instead of bpmn-js's default white fill + black
   outline, so the whole canvas reads as one consistent dark surface rather
   than light cards on a dark ground. Lane/pool container rects are
   excluded (:not(.carvon-dark-canvas-divider)) — they must stay unfilled,
   or they'd paint a solid dark block over the whole lane, hiding the grid
   and any element z-ordered beneath it. */
#bpmn-canvas .djs-visual > rect:not(.carvon-dark-canvas-divider),
#bpmn-canvas .djs-visual > circle,
#bpmn-canvas .djs-visual > polygon {
  fill: #1c1f2b !important;
  stroke: #d7d9e0 !important;
}
/* Gateway inner glyphs (the X / + mark inside the diamond) and any other
   icon strokes drawn as bare <path>s follow the same light-on-dark flip. */
#bpmn-canvas .djs-visual path {
  stroke: #d7d9e0 !important;
}
#bpmn-canvas .djs-visual text {
  fill: #d7d9e0 !important;
  font-size: 13px !important;
}
/* Lane/pool dividers and their header labels have no shape fill behind them
   at all — they float directly on the dark canvas. bpmn-js exposes no
   CSS-selectable bpmn-type class to target only these, so
   bpmn-designer.js's fixDarkCanvasLabels() flags them via elementRegistry +
   $instanceOf and tags them with this class instead. */
#bpmn-canvas .carvon-dark-canvas-label {
  fill: #d7d9e0 !important;
}
#bpmn-canvas .carvon-dark-canvas-divider {
  stroke: #d7d9e0 !important;
}

/* Small icon badge overlaid on a task's canvas shape (via bpmn-js's Overlays
   service) to show its CarvonOS kind — Согласование/Webhook/Уведомление —
   at a glance, without opening the properties panel. */
.carvon-node-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #c9cdd3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}

/* Pre-save structural validation: highlights disconnected elements in red
   directly on the bpmn-js canvas (canvas.addMarker), instead of only a
   generic error toast. */
.carvon-validation-error .djs-visual > :nth-child(1) {
  stroke: #e5484d !important;
  stroke-width: 3px !important;
}

body.light-theme .cs-trigger { background-color: rgba(0, 0, 0, 0.02); }
body.light-theme .cs-trigger:hover { background-color: rgba(0, 0, 0, 0.05); }
body.light-theme .cs-popup { background: #ffffff; border-color: rgba(0, 0, 0, 0.08); }
body.light-theme .cs-option:hover { background: rgba(0, 112, 196, 0.1); }

textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.6;
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.6; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(34,211,160,0.6);
  box-shadow: var(--focus);
  background: rgba(5,14,28,0.7);
}

/* ─── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(120,165,210,0.3);
  border-radius: 10px;
  padding: 9px 16px;
  background: rgba(10,22,40,0.65);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(34,211,160,0.55);
  background: rgba(34,211,160,0.07);
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

.btn:active { transform: translateY(0); }

.btn.primary {
  background: linear-gradient(145deg, #22d3a0 0%, #3b9eff 100%);
  color: #020e18;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(34,211,160,0.28);
}

.btn.primary:hover {
  background: linear-gradient(145deg, #1ec494 0%, #2f8fe8 100%);
  box-shadow: 0 6px 20px rgba(34,211,160,0.38);
  transform: translateY(-2px);
}

.btn.danger {
  border-color: rgba(245,101,101,0.45);
  color: #fca5a5;
  background: rgba(239,68,68,0.08);
}

.btn.danger:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(245,101,101,0.7);
}

.btn.warning {
  border-color: rgba(246,173,60,0.45);
  color: #fde68a;
  background: rgba(246,173,60,0.08);
}

.btn.warning:hover {
  background: rgba(246,173,60,0.18);
}

.actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stack {
  display: grid;
  gap: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(11,22,40,0.5);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255,255,255,0.03), transparent);
  pointer-events: none;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.metric .label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.metric .value {
  margin-top: 8px;
  font-size: 32px;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.module-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(10, 22, 36, 0.55);
  transition: border-color 0.2s, background 0.2s;
  cursor: default;
}

.module-card:hover {
  border-color: rgba(34,211,160,0.3);
  background: rgba(34,211,160,0.04);
}

.module-card .title {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 4px;
}

.workspace-grid {
  display: grid;
  gap: 12px;
}

.workspace-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%),
    radial-gradient(circle at top right, rgba(59,158,255,0.08), transparent 40%),
    rgba(7,18,32,0.65);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.workspace-card:hover {
  border-color: rgba(59,158,255,0.25);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.workspace-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}

.actions.compact {
  margin-top: 0;
}

.detail-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(150, 186, 216, 0.18);
  background: rgba(10, 22, 36, 0.45);
}

.approval-inbox {
  display: grid;
  gap: 10px;
}

.approval-card {
  border: 1px solid rgba(120,165,210,0.18);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(8,19,34,0.6);
  transition: border-color 0.15s;
}

.approval-card:hover {
  border-color: rgba(59,158,255,0.3);
}

.approval-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
}

.pill.ok {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.12);
}

.pill.warn {
  color: #fde68a;
  border-color: rgba(247, 197, 95, 0.4);
  background: rgba(247, 197, 95, 0.12);
}

.pill.neutral {
  color: #d8ecff;
  border-color: rgba(125, 164, 197, 0.32);
  background: rgba(125, 164, 197, 0.1);
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  border: 1px solid var(--line);
  color: #d1e6ff;
  margin-top: 8px;
}

.tag.ok {
  border-color: rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
}

.tag.partial {
  border-color: rgba(247, 197, 95, 0.5);
  color: #fde68a;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 18, 32, 0.6);
}

.task-views-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9,22,40,0.7);
  color: rgba(232,241,255,0.7);
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.chip:hover {
  background: rgba(34,211,160,0.1);
  color: var(--text);
  border-color: rgba(34,211,160,0.35);
}

.chip.active {
  border-color: rgba(34,211,160,0.65);
  background: rgba(34,211,160,0.18);
  color: var(--primary);
  font-weight: 600;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-col {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(6,14,26,0.55);
  padding: 10px;
  min-width: 0;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.kanban-col-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.kanban-col-count {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
}

.kanban-card {
  border: 1px solid rgba(120,165,210,0.2);
  border-radius: 11px;
  padding: 10px 10px 10px 13px;
  margin-bottom: 8px;
  background: rgba(11,26,46,0.85);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.kanban-card:hover {
  border-color: rgba(59,158,255,0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.kanban-card.dragging {
  opacity: 0.35;
  cursor: grabbing;
  transform: rotate(2deg) scale(1.03);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.kanban-col.drag-over {
  background: rgba(34,211,160,0.07);
  border-color: rgba(34,211,160,0.4);
  box-shadow: inset 0 0 0 2px rgba(34,211,160,0.25);
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 6px;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-day {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 110px;
  padding: 8px;
  background: rgba(7,18,32,0.5);
  transition: border-color 0.15s;
}

.calendar-day.today {
  border-color: rgba(34,211,160,0.5);
  background: rgba(34,211,160,0.05);
}

.calendar-day:hover {
  border-color: rgba(59,158,255,0.3);
}

.day-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-item {
  font-size: 11.5px;
  border-radius: 7px;
  padding: 3px 7px;
  margin-bottom: 3px;
  background: rgba(34,211,160,0.16);
  color: #a7f3d0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(7,18,32,0.55);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color 0.15s, background 0.15s;
}

.timeline-item:hover {
  border-color: rgba(59,158,255,0.3);
  background: rgba(59,158,255,0.04);
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
}

.timeline-body { flex: 1; min-width: 0; }

.gantt {
  display: grid;
  gap: 8px;
}

.gantt-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(7,18,32,0.55);
  transition: background 0.15s;
}

.gantt-row:hover {
  background: rgba(11,26,46,0.75);
}

.gantt-bar-wrap {
  position: relative;
  margin-top: 6px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.gantt-bar {
  position: absolute;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #34d399);
}

.workload-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workload-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7,18,32,0.55);
  padding: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.workload-card:hover {
  border-color: rgba(59,158,255,0.28);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.workload-name {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.workload-stat {
  font-size: 12px;
  color: var(--muted);
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 8px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #34d399);
}

.wiki-tree-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(7, 18, 32, 0.6);
  max-height: 280px;
  overflow: auto;
}

.wiki-tree-node {
  border-left: 1px dashed rgba(150, 186, 216, 0.24);
  margin: 6px 0;
  padding-left: 10px;
}

.designer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.designer-toolbar.compact select {
  min-width: 180px;
}

.designer-toolbar.compact input {
  min-width: 220px;
}

.process-designer-canvas {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 900px;
  min-width: 2200px;
  background:
    radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.08), transparent 55%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    rgba(7, 18, 32, 0.65);
  background-size: auto, 22px 22px, 22px 22px, auto;
  overflow: visible;
}

.process-designer-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.designer-edge {
  fill: none;
  stroke: rgba(84, 176, 255, 0.9);
  stroke-width: 2;
}

.designer-edge-label {
  fill: #dbeafe;
  font-size: 11px;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(7, 18, 32, 0.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.process-designer-nodes {
  position: absolute;
  inset: 0;
}

.designer-node {
  position: absolute;
  width: 160px;
  border: 1px solid rgba(122, 162, 195, 0.5);
  border-radius: 10px;
  background: rgba(13, 31, 50, 0.95);
  box-shadow: 0 10px 20px rgba(3, 8, 16, 0.45);
  cursor: grab;
  padding: 8px;
}

.designer-node.active {
  border-color: rgba(52, 211, 153, 0.95);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.35), 0 12px 24px rgba(3, 8, 16, 0.45);
}

.designer-node:active {
  cursor: grabbing;
}

.designer-node-port {
  position: absolute;
  right: -11px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3b9eff;
  border: 2px solid rgba(255,255,255,0.3);
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  opacity: 0;
  transition: opacity 0.15s, transform 0.1s;
  z-index: 20;
  user-select: none;
  line-height: 1;
}
.designer-node:hover .designer-node-port {
  opacity: 1;
}
.designer-node-port:hover {
  transform: translateY(-50%) scale(1.2);
  background: #22d3a0;
}

.designer-edge-preview {
  fill: none;
  stroke: rgba(34, 211, 160, 0.8);
  stroke-width: 2;
  stroke-dasharray: 7 4;
  pointer-events: none;
}

.process-designer-canvas.is-connecting {
  cursor: crosshair !important;
}
.process-designer-canvas.is-connecting .designer-node {
  cursor: pointer;
}
.process-designer-canvas.is-connecting .designer-node:hover {
  border-color: rgba(34, 211, 160, 0.95);
  box-shadow: 0 0 0 2px rgba(34, 211, 160, 0.3), 0 12px 24px rgba(3, 8, 16, 0.45);
}

.designer-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.designer-node-type {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b1c8e4;
}

.designer-node-label {
  width: 100%;
}

.arch-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.arch-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 18, 32, 0.6);
  padding: 12px;
}

.arch-card ul {
  margin: 8px 0 0;
  padding-left: 16px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.table th,
.table td {
  text-align: left;
  border-bottom: 1px solid rgba(120,165,210,0.12);
  padding: 11px 14px;
  font-size: 13px;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  position: sticky;
  top: 0;
  background: rgba(7,16,30,0.95);
  backdrop-filter: blur(8px);
  z-index: 1;
  white-space: nowrap;
}

.table tbody tr {
  transition: background 0.1s;
}

.table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.inline-note {
  font-size: 12px;
  color: var(--muted);
}

.error {
  color: #fecaca;
}

.ok {
  color: #bbf7d0;
}

.hidden {
  display: none;
}

/* kept for legacy compat */
.log { display: none; }

/* ─── Activity Log Drawer ─────────────────────────────────────────────────── */
.log-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  background: rgba(5, 14, 26, 0.88);
  border-top: 1px solid rgba(34,211,160,0.18);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.45);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.log-drawer.collapsed .log-body { display: none; }

.log-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.log-drawer.collapsed .log-drawer-header { border-bottom-color: transparent; }
.log-drawer:not(.collapsed) .log-drawer-header { border-bottom-color: rgba(34,211,160,0.1); }

.log-drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.log-drawer-icon {
  display: flex;
  align-items: center;
  color: #22d3a0;
  opacity: 0.9;
}
.log-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(34,211,160,0.18);
  color: #34d399;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  border: 1px solid rgba(34,211,160,0.3);
}
.log-drawer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.log-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.log-action-btn:hover { background: rgba(255,255,255,0.06); color: #94a3b8; }

.log-body {
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(34,211,160,0.2) transparent;
}
.log-body::-webkit-scrollbar { width: 4px; }
.log-body::-webkit-scrollbar-track { background: transparent; }
.log-body::-webkit-scrollbar-thumb { background: rgba(34,211,160,0.2); border-radius: 4px; }

.log-entries { display: flex; flex-direction: column; }

.log-entry {
  display: grid;
  grid-template-columns: 70px 20px 1fr;
  align-items: baseline;
  gap: 6px;
  padding: 4px 18px;
  font-size: 11.5px;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255,255,255,0.025);
  animation: logSlideIn 0.2s ease both;
  transition: background 0.12s;
}
.log-entry:hover { background: rgba(255,255,255,0.03); }
.log-entry:last-child { border-bottom: none; }
.log-entry-in { opacity: 0; transform: translateY(-4px); }

@keyframes logSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.log-ts {
  color: #475569;
  font-size: 10px;
  white-space: nowrap;
  padding-top: 1px;
}
.log-icon {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  padding-top: 1px;
}
.log-msg {
  color: #94a3b8;
  word-break: break-word;
  font-size: 11.5px;
}
.log-payload {
  color: #475569;
  font-size: 10.5px;
}

/* Light theme */
body.light-theme .log-drawer {
  background: rgba(240,248,255,0.95);
  border-top-color: rgba(11,158,112,0.2);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.1);
}
body.light-theme .log-drawer-title { color: #475569; }
body.light-theme .log-entry { border-bottom-color: rgba(0,0,0,0.04); }
body.light-theme .log-entry:hover { background: rgba(0,0,0,0.02); }
body.light-theme .log-ts { color: #94a3b8; }
body.light-theme .log-msg { color: #475569; }
body.light-theme .log-payload { color: #94a3b8; }
body.light-theme .log-action-btn { color: #94a3b8; }
body.light-theme .log-action-btn:hover { background: rgba(0,0,0,0.05); color: #475569; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.panel,
.topbar {
  animation: fadeUp 0.3s ease;
}

.nav-block {
  animation: slideIn 0.25s ease;
}

@media (max-width: 1200px) {
  :root { --sidebar-w: 240px; }
}

@media (max-width: 1060px) {
  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
    position: static;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
  }

  .brand-wrap { width: 100%; }

  .content {
    order: 1;
  }

  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid.three,
  .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  .kanban {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workload-grid,
  .arch-grid,
  .workspace-grid.two-col,
  .detail-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #app {
    padding: 10px;
    gap: 10px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-right {
    flex-wrap: wrap;
  }

  .field.slim {
    min-width: 0;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .module-grid,
  .kpi-grid,
  .kanban,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  h1 { font-size: 22px; }
  h2 { font-size: 18px; }

  .panel { padding: 14px; }
}

/* ─── Portal: Новости ──────────────────────────────────────────────────────── */
.news-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.news-card {
  background: rgba(30, 48, 72, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
}

.news-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.news-body {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.news-meta {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}

/* ─── Portal: Чат ─────────────────────────────────────────────────────────── */
.chat-feed {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 12px;
}

.chat-bubble {
  background: rgba(10, 28, 50, 0.8);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  max-width: 80%;
}

.chat-author {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 3px;
}

.chat-text {
  font-size: 13px;
  color: var(--text);
}

.chat-time {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.65;
  text-align: right;
  margin-top: 4px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chat-input-row input {
  flex: 1;
}

/* ─── Portal: Оргструктура ────────────────────────────────────────────────── */
.org-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.org-dept {
  background: rgba(20, 40, 64, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
}

.org-dept-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.org-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.org-member-badge {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--text);
}

.org-member-badge em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}

/* ─── Tab bar ──────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tab-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.tab-btn:hover {
  background: rgba(34,211,160,0.08);
  border-color: rgba(34,211,160,0.35);
  color: var(--text);
}

.tab-btn.active {
  background: rgba(34,211,160,0.14);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* ─── Entity Builder ──────────────────────────────────────────────────────── */
.entity-type-card {
  background: rgba(12, 28, 50, 0.8);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
}

.entity-type-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.entity-type-icon {
  font-size: 20px;
  line-height: 1;
}

.entity-fields-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.field-badge {
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 16px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--text);
}

.field-badge em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}

.entity-fields-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.entity-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  padding: 6px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}

.entity-field-row input,
.entity-field-row select {
  min-width: 90px;
  flex: 1;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form input {
  flex: 1;
}

.btn.small {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn.danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn.danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* ─── SVG Charts ──────────────────────────────────────────────────────────── */
.chart-wrap {
  margin: 16px 0;
  overflow-x: auto;
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chart-bar rect {
  opacity: 0.9;
}

.chart-bar text {
  fill: var(--muted);
  font-size: 11px;
}

/* ─── Icon buttons & topbar extras ──────────────────────────────────────── */
.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 15px;
  border-radius: 9px;
  position: relative;
  flex-shrink: 0;
}

.notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  border: 1.5px solid var(--bg-2);
}

.notif-badge:empty { display: none; }

.topbar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  align-self: center;
}

.topbar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #020e18;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* ─── Ghost button ──────────────────────────────────────────────────────── */
.btn.ghost {
  background: transparent;
  border-color: transparent;
  padding: 6px 8px;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line);
}

/* ─── Colored metric variants ───────────────────────────────────────────── */
.metric.green .value { color: #34d399; }
.metric.blue  .value { color: #38bdf8; }
.metric.amber .value { color: #f59e0b; }
.metric.red   .value { color: #f87171; }
.metric.purple .value { color: #a78bfa; }

.metric.green  { border-color: rgba(52, 211, 153, 0.3); background: linear-gradient(160deg, rgba(52,211,153,0.07), rgba(52,211,153,0.02)); }
.metric.blue   { border-color: rgba(56, 189, 248, 0.3); background: linear-gradient(160deg, rgba(56,189,248,0.07), rgba(56,189,248,0.02)); }
.metric.amber  { border-color: rgba(245,158, 11, 0.3); background: linear-gradient(160deg, rgba(245,158,11,0.07), rgba(245,158,11,0.02)); }
.metric.red    { border-color: rgba(248,113,113, 0.3); background: linear-gradient(160deg, rgba(248,113,113,0.07), rgba(248,113,113,0.02)); }
.metric.purple { border-color: rgba(167,139,250, 0.3); background: linear-gradient(160deg, rgba(167,139,250,0.07), rgba(167,139,250,0.02)); }

.metric .trend {
  font-size: 11px;
  margin-top: 6px;
  color: var(--muted);
}

/* ─── Mini progress bar ─────────────────────────────────────────────────── */
.mini-progress {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  margin-top: 8px;
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.mini-progress-fill.green  { background: linear-gradient(90deg, #34d399, #10b981); }
.mini-progress-fill.blue   { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.mini-progress-fill.amber  { background: linear-gradient(90deg, #f59e0b, #d97706); }
.mini-progress-fill.red    { background: linear-gradient(90deg, #f87171, #ef4444); }
.mini-progress-fill.purple { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

/* ─── Activity feed ─────────────────────────────────────────────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(150, 186, 216, 0.10);
  font-size: 13px;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
}

.activity-dot.warn { background: var(--warning); }
.activity-dot.danger { background: var(--danger); }
.activity-dot.info { background: var(--accent); }

.activity-text { flex: 1; line-height: 1.5; }
.activity-time { font-size: 11px; color: var(--muted); white-space: nowrap; margin-top: 2px; }

/* ─── Quick action buttons ──────────────────────────────────────────────── */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 22, 36, 0.55);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: 0.2s ease;
}

.quick-action-btn:hover {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.1);
  transform: translateY(-2px);
}

.quick-action-btn svg { flex-shrink: 0; }

/* ─── Nav icons ─────────────────────────────────────────────────────────── */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.nav-btn.active .nav-icon,
.nav-btn:hover .nav-icon {
  opacity: 1;
}

/* ─── Priority colors ───────────────────────────────────────────────────── */
.priority-low      { color: #86efac; }
.priority-medium   { color: #fde68a; }
.priority-high     { color: #fb923c; }
.priority-critical { color: #f87171; }

.kanban-card[data-priority="critical"] { border-left: 3px solid #f87171 !important; padding-left: 11px; }
.kanban-card[data-priority="high"]     { border-left: 3px solid #fb923c !important; padding-left: 11px; }
.kanban-card[data-priority="medium"]   { border-left: 3px solid #fde68a !important; padding-left: 11px; }
.kanban-card[data-priority="low"]      { border-left: 3px solid #86efac !important; padding-left: 11px; }

/* ─── SLA / Task progress bar ───────────────────────────────────────────── */
.task-sla-bar {
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}
.task-sla-fill { height: 100%; border-radius: 999px; }
.task-sla-fill.ok     { background: #34d399; }
.task-sla-fill.warn   { background: #f59e0b; }
.task-sla-fill.danger { background: #f87171; }

/* ─── Delegation cards ──────────────────────────────────────────────────── */
.delegation-list { display: flex; flex-direction: column; gap: 10px; }

.delegation-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(10, 22, 36, 0.55);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.delegation-info { display: flex; flex-direction: column; gap: 4px; }
.delegation-title { font-weight: 600; font-size: 14px; }
.delegation-period { font-size: 12px; color: var(--muted); }

/* ─── Light theme ───────────────────────────────────────────────────────── */
body.light-theme {
  color-scheme: light;
  --bg-1: #f5f5f7;
  --bg-2: #ececf0;
  --bg-3: #e2e2e8;
  --surface: rgba(255,255,255,0.88);
  --surface-soft: rgba(248,248,250,0.8);
  --text: #111118;
  --muted: #6b6b7b;
  --line: rgba(0,0,0,0.09);
  --primary: #0b9e70;
  --accent: #0070c4;
  --primary-press: #087d58;
  --danger: #d63232;
  --warning: #c47300;
  --success: #2d8f50;
  --focus: 0 0 0 3px rgba(11,158,112,0.2);
}

body.light-theme {
  background: var(--bg-1);
}

body.light-theme .glass {
  background: rgba(255,255,255,0.80);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
  background: rgba(255,255,255,0.9);
  color: var(--text);
  border-color: rgba(90,140,200,0.3);
}

body.light-theme .btn {
  background: rgba(245,250,255,0.95);
  color: var(--text);
  border-color: rgba(90,140,200,0.25);
}

body.light-theme .btn.primary {
  background: linear-gradient(145deg, var(--primary), var(--accent));
  color: #fff;
  border-color: transparent;
}

body.light-theme .nav-btn { color: rgba(12,28,46,0.75); }
body.light-theme .nav-btn.active { color: var(--primary); background: rgba(11,158,112,0.1); box-shadow: inset 3px 0 0 var(--primary); }
body.light-theme .nav-btn:hover { color: var(--text); background: rgba(11,158,112,0.06); }
body.light-theme .nav-block { background: rgba(220,238,255,0.25); }
body.light-theme .auth-card { background: rgba(255,255,255,0.75); }

body.light-theme .kanban-card,
body.light-theme .kanban-col,
body.light-theme .calendar-day,
body.light-theme .timeline-item,
body.light-theme .gantt-row,
body.light-theme .workload-card,
body.light-theme .module-card,
body.light-theme .table-wrap,
body.light-theme .wiki-tree-wrap,
body.light-theme .arch-card,
body.light-theme .workspace-card,
body.light-theme .approval-card,
body.light-theme .news-card,
body.light-theme .delegation-card {
  background: rgba(255,255,255,0.8);
  border-color: rgba(90,140,200,0.16);
}

body.light-theme .metric {
  background: rgba(255,255,255,0.75);
  border-color: rgba(90,140,200,0.16);
}

body.light-theme .chip {
  background: rgba(255,255,255,0.8);
  color: rgba(12,28,46,0.7);
  border-color: rgba(90,140,200,0.2);
}

body.light-theme .chip.active {
  background: rgba(11,158,112,0.12);
  color: var(--primary);
  border-color: rgba(11,158,112,0.4);
}

body.light-theme .tab-btn {
  background: rgba(255,255,255,0.7);
  color: var(--muted);
}

body.light-theme .tab-btn.active {
  background: rgba(11,158,112,0.1);
  color: var(--primary);
}

body.light-theme .pill.ok { color: #0b6c40; background: rgba(11,158,112,0.12); border-color: rgba(11,158,112,0.3); }
body.light-theme .pill.warn { color: #925800; background: rgba(196,115,0,0.1); border-color: rgba(196,115,0,0.3); }
body.light-theme .table th { background: rgba(240,248,255,0.97); color: var(--muted); }
body.light-theme .log { color: #2a4a6c; background: rgba(210,228,250,0.6); }
body.light-theme .bg-orb { opacity: 0.08; }
body.light-theme .brand { -webkit-text-fill-color: var(--text); background: none; }

/* ─── Task List View ─────────────────────────────────────────────────────── */
.task-list-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* --- Integration catalog --- */
.integration-catalog { display:grid; grid-template-columns:repeat(auto-fill,minmax(155px,1fr)); gap:12px; }
.integration-card { display:flex; flex-direction:column; align-items:flex-start; gap:8px; padding:16px; border-radius:14px; border:1px solid var(--line); background:rgba(10,22,36,0.55); cursor:pointer; transition:border-color 0.2s, background 0.2s, transform 0.15s; }
.integration-card:hover { border-color:rgba(34,211,160,0.4); background:rgba(34,211,160,0.07); transform:translateY(-2px); box-shadow:0 6px 20px rgba(34,211,160,0.1); }
.integration-card-icon { font-size:26px; line-height:1; }
.integration-card-name { font-weight:700; font-size:13px; color:var(--text); }
.integration-card-status { font-size:11px; color:var(--muted); }
.integration-card-configured { color:var(--primary) !important; }

/* --- Mini bar chart --- */
.mini-bar-chart { display:flex; flex-direction:column; gap:10px; }
.mini-bar-item { display:flex; align-items:center; gap:10px; font-size:12px; }
.mini-bar-label { min-width:90px; color:var(--muted); font-size:12px; }
.mini-bar-track { flex:1; height:8px; background:rgba(255,255,255,0.06); border-radius:999px; overflow:hidden; }
.mini-bar-fill { height:100%; border-radius:999px; transition:width 0.6s cubic-bezier(.4,0,.2,1); }
.mini-bar-value { min-width:24px; text-align:right; font-weight:700; font-size:12px; }

/* --- Automation badges --- */
.automation-trigger-badge { display:inline-flex; align-items:center; padding:2px 8px; border-radius:999px; font-size:11px; font-weight:600; background:rgba(34,211,160,0.12); color:#34d399; border:1px solid rgba(34,211,160,0.2); }
.automation-action-badge { display:inline-flex; align-items:center; padding:2px 8px; border-radius:999px; font-size:11px; font-weight:600; background:rgba(59,158,255,0.12); color:#60a5fa; border:1px solid rgba(59,158,255,0.2); }

/* --- Button variants --- */
.btn.danger { background:rgba(239,68,68,0.1); border-color:rgba(239,68,68,0.28); color:#f87171; }
.btn.danger:hover { background:rgba(239,68,68,0.2); border-color:rgba(239,68,68,0.5); color:#fca5a5; }
.btn.warning { background:rgba(245,158,11,0.1); border-color:rgba(245,158,11,0.28); color:#fbbf24; }
.btn.warning:hover { background:rgba(245,158,11,0.2); border-color:rgba(245,158,11,0.5); }

/* --- Animations --- */
@keyframes fadeInUp { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.animate-in { animation:fadeInUp 0.35s ease both; }
.kpi-grid > *:nth-child(1) { animation-delay:0.00s; }
.kpi-grid > *:nth-child(2) { animation-delay:0.05s; }
.kpi-grid > *:nth-child(3) { animation-delay:0.10s; }
.kpi-grid > *:nth-child(4) { animation-delay:0.15s; }
.kpi-grid > *:nth-child(5) { animation-delay:0.20s; }
.kpi-grid > *:nth-child(6) { animation-delay:0.25s; }

/* --- Project status badges --- */
.status-pill-active { background:rgba(34,211,160,0.12); color:var(--primary); border:1px solid rgba(34,211,160,0.3); border-radius:999px; padding:2px 8px; font-size:11px; font-weight:600; }
.status-pill-on_hold { background:rgba(245,158,11,0.12); color:#fbbf24; border:1px solid rgba(245,158,11,0.3); border-radius:999px; padding:2px 8px; font-size:11px; font-weight:600; }
.status-pill-completed { background:rgba(59,158,255,0.12); color:#60a5fa; border:1px solid rgba(59,158,255,0.3); border-radius:999px; padding:2px 8px; font-size:11px; font-weight:600; }
.status-pill-archived { background:rgba(150,150,150,0.1); color:var(--muted); border:1px solid rgba(150,150,150,0.2); border-radius:999px; padding:2px 8px; font-size:11px; font-weight:600; }

/* --- Light theme --- */
body.light-theme .integration-card { background:rgba(255,255,255,0.82); border-color:rgba(90,140,200,0.15); }
body.light-theme .integration-card:hover { border-color:rgba(11,158,112,0.4); background:rgba(11,158,112,0.07); }
body.light-theme .mini-bar-track { background:rgba(0,0,0,0.07); }
body.light-theme .integration-card-name { color:var(--text); }

.task-list-header {
  display: grid;
  grid-template-columns: 44px 1fr 130px 120px 180px 110px 130px;
  min-width: 900px;
  padding: 0 4px;
  height: 44px;
  align-items: center;
  border-bottom: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  border-radius: 12px 12px 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.task-list-header-cell {
  padding: 0 12px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

.task-list-body { min-width: 900px; }

.task-list-row {
  display: grid;
  grid-template-columns: 44px 1fr 130px 120px 180px 110px 130px;
  min-height: 56px;
  align-items: center;
  border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.15s;
  cursor: pointer;
}

.task-list-row:hover { background: rgba(34,211,160,0.06) !important; }
.task-list-row:last-child { border-bottom: none; }

.task-list-num { padding: 0 12px; color: #475569; font-size: 12px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.task-list-info { padding: 0 12px; overflow: hidden; }
.task-list-title { color: #f1f5f9; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-list-desc { color: #64748b; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-list-status, .task-list-priority, .task-list-sla { padding: 0 12px; text-align: center; }
.task-list-assignee { padding: 0 12px; }
.task-list-due { padding: 0 12px; text-align: center; color: #94a3b8; font-size: 13px; font-variant-numeric: tabular-nums; }

.task-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  border-radius: 0 0 12px 12px;
  color: #475569;
  font-size: 12px;
}

.task-list-footer strong { color: #94a3b8; }

/* ─── Project Cards ───────────────────────────────────────────────────────── */
.project-cards { display: flex; flex-direction: column; gap: 10px; }

.project-card {
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  transition: background 0.15s, border-color 0.15s;
}

.project-card:hover { background: rgba(34,211,160,0.05); border-color: rgba(34,211,160,0.2); }
.project-card.archived { opacity: 0.6; }

.project-card-head { display: flex; align-items: flex-start; gap: 12px; }
.project-card-icon { font-size: 22px; margin-top: 1px; flex-shrink: 0; }
.project-card-name { font-size: 14.5px; font-weight: 600; color: var(--text); }
.project-card-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.project-card-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

/* ─── Project Members ────────────────────────────────────────────────────── */
.project-members-list { display: flex; flex-direction: column; gap: 8px; }

.project-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ─── Entity Builder ─────────────────────────────────────────────────────── */
.entity-type-card {
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.025);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.entity-type-card:hover { border-color: rgba(34,211,160,0.25); }

.entity-type-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.entity-type-icon { font-size: 22px; flex-shrink: 0; }

.entity-fields-list { display: flex; flex-wrap: wrap; gap: 6px; }

.field-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  background: rgba(59,158,255,0.1);
  border: 1px solid rgba(59,158,255,0.2);
  color: #94c7ff;
  font-weight: 500;
}

.field-badge.muted { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); color: var(--muted); }
.field-badge em { color: var(--muted); font-style: normal; font-size: 10.5px; }

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 20px;
  text-align: center;
  animation: fadeUp 0.25s ease both;
}

.empty-state-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(34,211,160,0.08);
  border: 1px solid rgba(34,211,160,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  color: var(--primary);
}
.empty-state-icon { font-size: 40px; opacity: 0.45; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text); margin: 0; }
.empty-state-subtitle { font-size: 13px; color: var(--muted); max-width: 300px; margin: 0; line-height: 1.5; }

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0 4px;
}
.pagination-info {
  font-size: 12.5px;
  color: var(--muted);
  min-width: 100px;
  text-align: center;
}

/* ─── Topbar search ──────────────────────────────────────────────────────── */
.topbar-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.topbar-search-icon {
  position: absolute;
  left: 9px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}
.topbar-search-input {
  height: 32px;
  width: 200px;
  padding: 0 10px 0 30px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 12.5px;
  font-family: var(--font-body);
  transition: width 0.2s ease, border-color 0.15s, background 0.15s;
  outline: none;
}
.topbar-search-input::placeholder { color: var(--muted); }
.topbar-search-input:focus {
  width: 260px;
  border-color: rgba(34,211,160,0.4);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 2px rgba(34,211,160,0.1);
}
body.light-theme .topbar-search-input {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.10);
  color: var(--text);
}
body.light-theme .topbar-search-input:focus {
  border-color: rgba(11,158,112,0.4);
  background: rgba(255,255,255,0.8);
}

/* ─── Topbar API field — inline layout ──────────────────────────────────── */
.topbar-right .field.slim {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.topbar-right .field.slim span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-right .field.slim input {
  height: 32px;
  width: 150px;
  padding: 0 8px;
  font-size: 12px;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(150,186,216,0.28); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(150,186,216,0.5); }

/* ─── Notification items ─────────────────────────────────────────────────── */
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(10, 22, 36, 0.45);
  transition: background 0.2s, border-color 0.2s;
}

.notification-item:hover {
  background: rgba(10, 22, 36, 0.65);
  border-color: rgba(255,255,255,0.12);
}

.notification-item.unread {
  background: rgba(34, 211, 160, 0.06);
  border-color: rgba(34, 211, 160, 0.2);
}

.notification-item.unread:hover {
  background: rgba(34, 211, 160, 0.1);
  border-color: rgba(34, 211, 160, 0.35);
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
  margin-top: 5px;
}

.notification-item.unread .notification-dot {
  background: var(--primary);
  box-shadow: 0 0 6px rgba(34, 211, 160, 0.6);
}

/* ─── Section header ─────────────────────────────────────────────────────── */
.section-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}

/* ─── User cards ─────────────────────────────────────────────────────────── */
.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(10, 22, 36, 0.45);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.user-card:hover {
  background: rgba(10, 22, 36, 0.7);
  border-color: rgba(34, 211, 160, 0.25);
  transform: translateY(-1px);
}

.user-avatar-lg {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(34,211,160,0.25), rgba(59,158,255,0.25));
  border: 1.5px solid rgba(34,211,160,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ─── Welcome banner ─────────────────────────────────────────────────────── */
.welcome-banner {
  border-radius: 18px;
  padding: 24px 28px;
  background: linear-gradient(135deg, rgba(34,211,160,0.14) 0%, rgba(59,158,255,0.1) 60%, rgba(10,22,36,0.7) 100%);
  border: 1px solid rgba(34,211,160,0.2);
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.07);
}

.welcome-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(34,211,160,0.35);
}

/* ─── Recent task rows ───────────────────────────────────────────────────── */
.recent-task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.recent-task-row:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--line);
}

/* ─── Detail rows (dashboard status card) ───────────────────────────────── */
.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: var(--muted);
  font-size: 12px;
  min-width: 120px;
  flex-shrink: 0;
}

/* ─── Light theme extensions ─────────────────────────────────────────────── */
body.light-theme .notification-item { background: rgba(255,255,255,0.75); border-color: rgba(90,140,200,0.15); }
body.light-theme .notification-item.unread { background: rgba(11,158,112,0.07); border-color: rgba(11,158,112,0.2); }
body.light-theme .user-card { background: rgba(255,255,255,0.75); border-color: rgba(90,140,200,0.15); }
body.light-theme .welcome-banner { background: linear-gradient(135deg, rgba(11,158,112,0.1), rgba(0,112,196,0.07), rgba(240,248,255,0.9)); border-color: rgba(11,158,112,0.2); }
body.light-theme .recent-task-row:hover { background: rgba(11,158,112,0.05); border-color: rgba(90,140,200,0.15); }

/* ─── Toast notifications ─────────────────────────────────────────────────── */
.toast-notification {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  max-width: 360px;
}
.toast-notification.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: rgba(34,211,160,0.18); border: 1px solid rgba(34,211,160,0.35); color: #34d399; }
.toast-error   { background: rgba(239,68,68,0.18);  border: 1px solid rgba(239,68,68,0.35);  color: #f87171; }
.toast-warn    { background: rgba(245,158,11,0.18); border: 1px solid rgba(245,158,11,0.35); color: #fbbf24; }
body.light-theme .toast-success { background: rgba(11,158,112,0.1); border-color: rgba(11,158,112,0.3); color: #0b9e70; }
body.light-theme .toast-error   { background: rgba(220,38,38,0.1);  border-color: rgba(220,38,38,0.3);  color: #dc2626; }

/* ═══════════════════════════════════════════════════════════════════════════
   CARVON OS — MODERN REFRESH 2025
   Overrides applied at the cascade end for maximum specificity
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Background ────────────────────────────────────────────────────────────── */
body {
  background:
    radial-gradient(ellipse 900px 600px at -5% -5%, rgba(34,211,160,0.05) 0%, transparent 55%),
    radial-gradient(ellipse 700px 500px at 110% 20%, rgba(59,158,255,0.04) 0%, transparent 50%),
    var(--bg-1);
  min-height: 100vh;
}

/* ── Ambient orbs — subtle ────────────────────────────────────────────────── */
.orb-a { width:600px; height:600px; opacity:0.07; filter:blur(100px); }
.orb-b { width:420px; height:420px; opacity:0.05; filter:blur(90px);  }

/* ── Glass — flat, subtle ──────────────────────────────────────────────────── */
.glass {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25), 0 6px 20px rgba(0,0,0,0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── Auth screen ───────────────────────────────────────────────────────────── */
.auth-wrap {
  width: min(1060px, 100%);
  border-radius: 32px;
  padding: 44px 48px;
}

.auth-brand { gap: 18px; }

.auth-card {
  border-radius: 22px;
  padding: 26px;
  background: rgba(3,8,16,0.58);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ── Brand mark ────────────────────────────────────────────────────────────── */
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(34,211,160,0.25);
}

/* ── Sidebar — opaque, compact, Linear-style ───────────────────────────────── */
.sidebar {
  border-radius: 14px;
  padding: 14px 8px;
  gap: 1px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(10,10,16,0.95);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.brand-wrap {
  padding: 6px 8px 14px;
  margin-bottom: 2px;
}

.brand { font-size: 15px; }

.nav-title {
  font-size: 9px;
  letter-spacing: 0.10em;
  padding: 8px 8px 2px;
  opacity: 0.35;
  margin: 4px 0 0;
}

.nav-btn {
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  gap: 8px;
  color: rgba(240,240,245,0.42);
  border: none;
  position: relative;
  transition: background 0.12s, color 0.12s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(240,240,245,0.82);
  transform: none;
  border: none;
  box-shadow: none;
}

.nav-btn.active {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-weight: 600;
  border: none;
  box-shadow: none;
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 14px;
  border-radius: 0 2px 2px 0;
  background: var(--primary);
}

.nav-btn.active .nav-icon { filter: none; }
.nav-icon { width: 16px; height: 16px; opacity: 0.52; }
.nav-btn.active .nav-icon,
.nav-btn:hover  .nav-icon { opacity: 1; }

/* ── Topbar — opaque, compact ──────────────────────────────────────────────── */
.topbar {
  border-radius: 12px;
  padding: 10px 20px;
  border: 1px solid rgba(255,255,255,0.07);
  min-height: var(--topbar-h);
  background: rgba(10,10,16,0.95);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#view-title {
  font-size: 20px;
  letter-spacing: -0.025em;
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: var(--text);
  background-clip: unset;
  color: var(--text);
}

.overline { font-size: 10px; opacity: 0.50; letter-spacing: 0.12em; }
.topbar-user-avatar { width: 28px; height: 28px; border-radius: 6px; font-size: 10px; }
.topbar-user-name { max-width: 90px; font-size: 12px; }

/* ── Main panel ────────────────────────────────────────────────────────────── */
.panel {
  border-radius: 14px;
  padding: 22px 24px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(12,12,18,0.9);
  backdrop-filter: blur(8px);
  animation: fadeUp 0.22s cubic-bezier(0.4,0,0.2,1) both;
}

/* ── Buttons — flat, no bounce ─────────────────────────────────────────────── */
.btn {
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.16);
  transform: none;
  box-shadow: none;
}

.btn.primary {
  background: var(--primary);
  color: #060e0b;
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(34,211,160,0.25);
}

.btn.primary:hover {
  background: #1ec494;
  transform: none;
  box-shadow: 0 4px 12px rgba(34,211,160,0.35);
}

.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,0.06); }

/* ── Inputs ────────────────────────────────────────────────────────────────── */
input, select, textarea {
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  font-size: 13.5px;
  padding: 8px 11px;
  transition: border-color 0.12s, background 0.12s;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(34,211,160,0.5);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 2px rgba(34,211,160,0.12);
}

/* ── Metric cards — bento style, colored top border ────────────────────────── */
.metric {
  border-radius: 12px;
  padding: 20px 18px;
  background: rgba(12,12,18,0.85);
  border: 1px solid rgba(255,255,255,0.07);
  border-top: 2px solid rgba(255,255,255,0.12);
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.metric .value { font-size: 40px; letter-spacing: -0.03em; }
.metric::before { display: none; }

.metric.green  { border-top-color: #34d399; }
.metric.blue   { border-top-color: #38bdf8; }
.metric.amber  { border-top-color: #f59e0b; }
.metric.red    { border-top-color: #f87171; }
.metric.purple { border-top-color: #a78bfa; }

/* ── Cards — flat, single border ──────────────────────────────────────────── */
.workspace-card,
.approval-card,
.module-card,
.project-card,
.notification-item,
.user-card,
.kanban-col {
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(16,16,22,0.7);
  border-radius: 12px;
  box-shadow: none;
}

.workspace-card:hover { border-color: rgba(255,255,255,0.13); box-shadow: none; }

.kanban-card {
  border-radius: 8px;
  background: rgba(18,18,26,0.9);
  border: 1px solid rgba(255,255,255,0.07);
  transition: border-color 0.12s;
}

.kanban-card:hover {
  border-color: rgba(255,255,255,0.14);
  transform: none;
  box-shadow: none;
}

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(12,12,18,0.85);
}

.table th {
  background: rgba(12,12,18,0.97);
  font-size: 10.5px;
  letter-spacing: 0.10em;
}

/* ── Chips / Tabs ──────────────────────────────────────────────────────────── */
.chip {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(8,18,36,0.72);
}

.chip.active {
  border-color: rgba(34,211,160,0.60);
  background: rgba(34,211,160,0.16);
  color: #3dffcc;
}

.tab-btn { border-radius: 10px; }

.tab-btn.active {
  background: rgba(34,211,160,0.14);
  border-color: rgba(34,211,160,0.55);
  color: #3dffcc;
}

/* ── Welcome banner ────────────────────────────────────────────────────────── */
.welcome-banner {
  background: rgba(14,14,20,0.8);
  border: 1px solid rgba(34,211,160,0.12);
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: none;
}

/* ── Pills ─────────────────────────────────────────────────────────────────── */
.pill { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; }

/* ── Status dot ────────────────────────────────────────────────────────────── */
.status-dot.online {
  box-shadow: 0 0 0 3px rgba(34,197,94,0.20), 0 0 10px rgba(34,197,94,0.40);
}

/* ── Sidebar footer ────────────────────────────────────────────────────────── */
.sidebar-foot { padding: 10px 6px 4px; font-size: 11px; border-top: 1px solid rgba(255,255,255,0.06); }

/* ── Log drawer ────────────────────────────────────────────────────────────── */
.log-drawer {
  border-top: 1px solid rgba(34,211,160,0.22);
  background: rgba(3,8,18,0.90);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
}

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(18px); }
  to   { opacity:1; transform:translateY(0);    }
}

.metric        { animation: fadeUp 0.30s cubic-bezier(0.4,0,0.2,1) both; }
.workspace-card,
.module-card,
.project-card  { animation: fadeUp 0.30s cubic-bezier(0.4,0,0.2,1) both; }

/* ── Light theme overrides ─────────────────────────────────────────────────── */
body.light-theme #view-title {
  background: none;
  -webkit-text-fill-color: var(--text);
  color: var(--text);
}

body.light-theme .sidebar {
  background: rgba(245,245,247,0.98);
  border-color: rgba(0,0,0,0.08);
}

body.light-theme .topbar {
  background: rgba(245,245,247,0.98);
  border-color: rgba(0,0,0,0.08);
}

body.light-theme .panel {
  background: rgba(255,255,255,0.92);
  border-color: rgba(0,0,0,0.07);
}

body.light-theme .nav-btn { color: rgba(17,17,24,0.45); }
body.light-theme .nav-btn:hover { background: rgba(0,0,0,0.05); color: rgba(17,17,24,0.82); }
body.light-theme .nav-btn.active {
  background: rgba(0,0,0,0.06);
  color: var(--text);
  box-shadow: none;
  border: none;
}

body.light-theme .nav-btn.active .nav-icon { filter: none; }

body.light-theme .btn {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.10);
  color: var(--text);
}
body.light-theme .btn:hover { background: rgba(0,0,0,0.07); border-color: rgba(0,0,0,0.15); }

body.light-theme .glass {
  background: rgba(255,255,255,0.80);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* ── Task filter bar ───────────────────────────────────────────────────────── */
.task-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 0 4px;
}
.task-filter-label { font-size: 11px; color: var(--muted); letter-spacing: 0.05em; flex-shrink: 0; }
.task-filter-sep { width: 1px; height: 16px; background: rgba(255,255,255,0.10); flex-shrink: 0; margin: 0 4px; }
.task-filter-chip {
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
}
.task-filter-chip:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.task-filter-chip[data-active="1"] {
  background: rgba(34,211,160,0.12);
  border-color: rgba(34,211,160,0.35);
  color: var(--primary);
  font-weight: 600;
}

/* ── Task row quick actions ───────────────────────────────────────────────── */
.task-list-row { position: relative; }
.task-row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-2);
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.09);
  z-index: 2;
}
.task-list-row:hover .task-row-actions {
  opacity: 1;
  pointer-events: all;
}
.task-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.task-action-btn:hover { background: rgba(255,255,255,0.10); }

/* ── Deadline highlighting ────────────────────────────────────────────────── */
.task-list-row[data-deadline="overdue"] { background: rgba(248,113,113,0.05); border-left-color: #f87171; }
.task-list-row[data-deadline="today"] { background: rgba(251,146,60,0.05); border-left-color: #fb923c; }

/* ── Notification dropdown ────────────────────────────────────────────────── */
.notif-bell-wrap { position: relative; }
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-2);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  z-index: 200;
  overflow: hidden;
  animation: fadeUp 0.15s ease both;
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.notif-dropdown-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-dropdown-list { max-height: 320px; overflow-y: auto; }
.notif-dropdown-item {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: default;
  transition: background 0.1s;
}
.notif-dropdown-item:hover { background: rgba(255,255,255,0.04); }
.notif-dropdown-item.unread { background: rgba(34,211,160,0.04); border-left: 2px solid var(--primary); }
.notif-dropdown-item.unread:hover { background: rgba(34,211,160,0.07); }
.notif-dropdown-text { font-size: 13px; color: var(--text); line-height: 1.45; }
.notif-dropdown-time { font-size: 11px; color: var(--muted); margin-top: 3px; }
.notif-dropdown-empty { padding: 24px; text-align: center; font-size: 13px; color: var(--muted); }
.notif-dropdown-footer {
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  text-align: center;
}
body.light-theme .notif-dropdown { background: #fff; border-color: rgba(0,0,0,0.10); }
body.light-theme .notif-dropdown-item.unread { border-left-color: var(--primary); background: rgba(11,158,112,0.04); }

/* ═══════════════════════════════════════════════════════════════
   TASK DETAIL DRAWER
═══════════════════════════════════════════════════════════════ */
#task-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}
#task-drawer.open {
  pointer-events: all;
  opacity: 1;
}
.td-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 20, 0.6);
  backdrop-filter: blur(3px);
  cursor: pointer;
}
.td-panel {
  position: relative;
  margin-left: auto;
  width: min(520px, 96vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, rgba(9,22,44,0.97) 0%, rgba(5,14,26,0.99) 100%);
  border-left: 1px solid rgba(34,211,160,0.18);
  box-shadow: -12px 0 60px rgba(0,0,0,0.55), -1px 0 0 rgba(34,211,160,0.08);
  transform: translateX(32px);
  transition: transform 0.28s cubic-bezier(0.22,1,0.36,1);
  overflow: hidden;
}
#task-drawer.open .td-panel {
  transform: translateX(0);
}
.td-header {
  padding: 20px 22px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.td-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.td-id {
  font-size: 11px;
  font-weight: 700;
  color: #22d3a0;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.td-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: #e8f1ff;
  font-family: 'Space Grotesk', sans-serif;
  border: none;
  background: transparent;
  outline: none;
  padding: 3px 6px;
  border-radius: 6px;
  transition: background 0.15s;
  min-width: 0;
}
.td-title:hover, .td-title:focus {
  background: rgba(255,255,255,0.06);
}
.td-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.td-close:hover {
  background: rgba(248,113,113,0.15);
  border-color: rgba(248,113,113,0.3);
  color: #f87171;
}
.td-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}
.td-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: default;
}
.td-meta-chip select {
  background: transparent;
  border: none;
  outline: none;
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}
.td-meta-chip.status { background: rgba(34,211,160,0.1); border-color: rgba(34,211,160,0.25); color: #22d3a0; }
.td-meta-chip.priority-low    { background: rgba(134,239,172,0.1); border-color: rgba(134,239,172,0.25); color: #86efac; }
.td-meta-chip.priority-medium { background: rgba(253,230,138,0.1); border-color: rgba(253,230,138,0.25); color: #fde68a; }
.td-meta-chip.priority-high   { background: rgba(251,146,60,0.1);  border-color: rgba(251,146,60,0.25);  color: #fb923c; }
.td-meta-chip.priority-critical { background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.3); color: #f87171; }
.td-meta-chip.assignee { background: rgba(59,158,255,0.1); border-color: rgba(59,158,255,0.25); color: #3b9eff; }
.td-meta-chip.due      { background: rgba(167,139,250,0.1); border-color: rgba(167,139,250,0.25); color: #a78bfa; }
.td-meta-chip.recur    { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.25); color: #fbbf24; }

/* Tabs */
.td-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 22px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.td-tabs::-webkit-scrollbar { display: none; }
.td-tab {
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.2px;
}
.td-tab:hover { color: #94a3b8; }
.td-tab.active { color: #22d3a0; border-bottom-color: #22d3a0; }
.td-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: rgba(34,211,160,0.15);
  color: #22d3a0;
  font-size: 10px;
  font-weight: 700;
  margin-left: 5px;
}

/* Body */
.td-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(34,211,160,0.2) transparent;
}
.td-body::-webkit-scrollbar { width: 4px; }
.td-body::-webkit-scrollbar-track { background: transparent; }
.td-body::-webkit-scrollbar-thumb { background: rgba(34,211,160,0.2); border-radius: 4px; }

.td-section { margin-bottom: 20px; }
.td-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 8px;
}
.td-description {
  width: 100%;
  min-height: 80px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.6;
  padding: 10px 12px;
  resize: vertical;
  font-family: Inter, sans-serif;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.td-description:focus { border-color: rgba(34,211,160,0.35); }
.td-save-desc {
  margin-top: 6px;
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid rgba(34,211,160,0.3);
  background: rgba(34,211,160,0.1);
  color: #22d3a0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.td-save-desc:hover { background: rgba(34,211,160,0.2); }

/* Comments */
.td-comment {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.td-comment:last-child { border-bottom: none; }
.td-comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(34,211,160,0.15);
  border: 1.5px solid rgba(34,211,160,0.3);
  color: #22d3a0;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.td-comment-body { flex: 1; min-width: 0; }
.td-comment-author { font-size: 12px; font-weight: 600; color: #94a3b8; }
.td-comment-text { font-size: 13px; color: #cbd5e1; margin-top: 2px; line-height: 1.5; word-break: break-word; }
.td-comment-time { font-size: 11px; color: #475569; margin-top: 2px; }

.td-add-comment {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.td-add-comment input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  font-family: Inter, sans-serif;
  transition: border-color 0.15s;
}
.td-add-comment input:focus { border-color: rgba(34,211,160,0.35); }
.td-add-comment button {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(34,211,160,0.3);
  background: rgba(34,211,160,0.12);
  color: #22d3a0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.td-add-comment button:hover { background: rgba(34,211,160,0.22); }

/* Checklist */
.td-checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.td-checklist-item:last-child { border-bottom: none; }
.td-checklist-cb {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid rgba(34,211,160,0.4);
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s;
}
.td-checklist-cb:checked {
  background: #22d3a0;
  border-color: #22d3a0;
}
.td-checklist-cb:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #050e1a;
  font-size: 10px;
  font-weight: 700;
}
.td-checklist-text {
  flex: 1;
  font-size: 13px;
  color: #cbd5e1;
  transition: opacity 0.15s;
}
.td-checklist-item.done .td-checklist-text {
  opacity: 0.4;
  text-decoration: line-through;
}

/* Files */
.td-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.td-file-row:last-child { border-bottom: none; }
.td-file-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(59,158,255,0.1);
  border: 1px solid rgba(59,158,255,0.2);
  color: #3b9eff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.td-file-info { flex: 1; min-width: 0; }
.td-file-name { font-size: 13px; color: #e2e8f0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-file-meta { font-size: 11px; color: #64748b; margin-top: 1px; }
.td-file-dl {
  font-size: 12px;
  color: #3b9eff;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(59,158,255,0.25);
  transition: all 0.15s;
  flex-shrink: 0;
}
.td-file-dl:hover { background: rgba(59,158,255,0.1); }

.td-file-upload {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.td-file-upload input[type=file] {
  flex: 1;
  font-size: 12px;
  color: #64748b;
}

/* Dep items */
.td-dep-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(248,113,113,0.06);
  border: 1px solid rgba(248,113,113,0.14);
  margin-bottom: 6px;
  font-size: 13px;
}
.td-dep-item.blocked-by { background: rgba(251,146,60,0.06); border-color: rgba(251,146,60,0.14); }
.td-dep-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.td-dep-item .td-dep-badge { background: rgba(248,113,113,0.2); color: #f87171; }
.td-dep-item.blocked-by .td-dep-badge { background: rgba(251,146,60,0.2); color: #fb923c; }

/* Quick add row */
.td-quick-add {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.td-quick-add input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 13px;
  padding: 7px 11px;
  outline: none;
  font-family: Inter, sans-serif;
  transition: border-color 0.15s;
}
.td-quick-add input:focus { border-color: rgba(34,211,160,0.35); }
.td-quick-add button {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid rgba(34,211,160,0.3);
  background: rgba(34,211,160,0.1);
  color: #22d3a0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.td-quick-add button:hover { background: rgba(34,211,160,0.2); }

/* Footer */
.td-footer {
  padding: 12px 22px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.td-footer-btn {
  flex: 1;
  padding: 9px 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #94a3b8;
  transition: all 0.15s;
}
.td-footer-btn:hover { background: rgba(255,255,255,0.08); color: #e2e8f0; }
.td-footer-btn.danger { border-color: rgba(248,113,113,0.3); color: #f87171; }
.td-footer-btn.danger:hover { background: rgba(248,113,113,0.1); }
.td-footer-btn.primary { border-color: rgba(34,211,160,0.4); background: rgba(34,211,160,0.12); color: #22d3a0; }
.td-footer-btn.primary:hover { background: rgba(34,211,160,0.22); }

/* Light theme overrides */
body.light-theme .td-panel {
  background: linear-gradient(160deg, rgba(245,250,255,0.98) 0%, rgba(235,245,255,0.99) 100%);
  border-left-color: rgba(34,211,160,0.2);
}
body.light-theme .td-title { color: #1e293b; }
body.light-theme .td-description { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.08); color: #334155; }
body.light-theme .td-comment-text { color: #334155; }
body.light-theme .td-comment-author { color: #64748b; }
body.light-theme .td-checklist-text { color: #334155; }
body.light-theme .td-file-name { color: #1e293b; }
body.light-theme .td-add-comment input, body.light-theme .td-quick-add input {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.1);
  color: #1e293b;
}
body.light-theme .td-tab { color: #94a3b8; }
body.light-theme .td-tab.active { color: #22d3a0; }
body.light-theme .td-section-label { color: #94a3b8; }

/* ══════════════════════════════════════════════════════════════
   PROCESS BUILDER — full page BPM interface
   ══════════════════════════════════════════════════════════════ */

/* Page shell */
.proc-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 0;
}

/* Top tab bar + switcher row */
.proc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 12px;
  flex-shrink: 0;
}
.proc-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.proc-tab-bar {
  display: flex;
  gap: 2px;
}
.proc-tab-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.proc-tab-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.proc-tab-btn.active {
  background: rgba(34,211,160,0.12);
  color: var(--primary);
  font-weight: 600;
}

/* Tab content area */
.proc-tab-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-top: 16px;
}

/* ── List tab — process definition grid ─────────────────────── */
.process-def-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.process-def-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.process-def-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.13);
}
.process-def-card.active {
  border-color: rgba(34,211,160,0.35);
  background: rgba(34,211,160,0.06);
}
.process-def-card.new-card {
  border-style: dashed;
  border-color: rgba(255,255,255,0.12);
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: var(--muted);
  gap: 6px;
}
.process-def-card.new-card:hover {
  border-color: rgba(34,211,160,0.4);
  color: var(--primary);
  background: rgba(34,211,160,0.05);
}
.process-def-new-icon {
  font-size: 28px;
  line-height: 1;
}
.process-def-new-label {
  font-size: 13px;
  font-weight: 500;
}
.process-def-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.process-def-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(34,211,160,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.process-def-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.process-def-key {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.process-def-stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}
.process-def-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* empty state in list */
.process-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 6px;
  color: var(--muted);
}
.process-empty-icon { font-size: 40px; margin-bottom: 4px; }
.process-empty-title { font-size: 18px; font-weight: 600; color: var(--text); }
.process-empty-sub { font-size: 14px; }

/* ── Builder tab — two-panel layout ────────────────────────── */
.proc-builder-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  height: 100%;
  min-height: 520px;
}
.proc-builder-sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  overflow-y: auto;
}
.proc-builder-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 4px;
}
.proc-builder-canvas-wrap {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  overflow: auto;
  background: rgba(5,8,14,0.7);
  min-height: 560px;
}
.proc-builder-canvas-wrap .process-designer-canvas {
  border: none;
  border-radius: 0;
}
/* Hide bpmn-js built-in "BPMN.io" watermark */
.bjs-powered-by {
  display: none !important;
}
.proc-builder-canvas-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.proc-builder-canvas-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.proc-canvas-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

/* Def selector list in sidebar */
.proc-def-select-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.proc-def-select-item {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.1s, color 0.1s;
}
.proc-def-select-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.proc-def-select-item.active { background: rgba(34,211,160,0.1); color: var(--primary); }

/* Node palette */
.designer-node-palette {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.designer-palette-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--text);
  text-align: left;
  transition: background 0.1s, border-color 0.1s;
}
.designer-palette-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
}
.designer-palette-icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── Fields tab ─────────────────────────────────────────────── */
.proc-fields-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  height: 100%;
  min-height: 520px;
}
.proc-fields-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  overflow-y: auto;
}
.proc-field-type-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}
.proc-field-type-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.1s, color 0.1s;
}
.proc-field-type-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}
.proc-field-type-icon {
  width: 20px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
}
.proc-fields-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.proc-fields-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.proc-add-field-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 120px auto;
  gap: 8px;
  align-items: end;
  padding: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}
.proc-add-field-form .field { margin: 0; }
.proc-fields-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.proc-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 9px;
  transition: background 0.1s;
}
.proc-field-row:hover {
  background: rgba(255,255,255,0.06);
}
.proc-field-pos {
  width: 20px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.proc-field-type-badge {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59,158,255,0.15);
  border-radius: 5px;
  font-size: 12px;
  flex-shrink: 0;
}
.proc-field-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.proc-field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.proc-field-key {
  font-size: 11px;
  color: var(--muted);
}
/* ─── Form builder: sections + drag-and-drop field cards ─────────────────── */
.proc-form-section { margin-bottom: 18px; }
.proc-form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.proc-form-section-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  min-height: 40px;
  border-radius: 10px;
}
.proc-field-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 9px;
  padding: 10px 12px;
  cursor: grab;
  transition: background 0.1s, border-color 0.1s, opacity 0.1s;
}
.proc-field-card:hover { background: rgba(255,255,255,0.06); }
.proc-field-card.dragging { opacity: 0.4; }
.proc-field-card.drop-before { border-left: 2px solid var(--primary, #22d3a0); }
.proc-field-card.drop-after { border-right: 2px solid var(--primary, #22d3a0); }
.proc-field-card-head { display: flex; align-items: center; gap: 10px; }
.proc-field-drag-handle { color: var(--muted); cursor: grab; flex-shrink: 0; font-size: 13px; }
@media (max-width: 720px) { .proc-form-section-grid { grid-template-columns: 1fr; } .proc-field-card { grid-column: span 1 !important; } }

body.light-theme .proc-field-card { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.07); }
body.light-theme .proc-field-card:hover { background: rgba(0,0,0,0.05); }

.proc-fields-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  gap: 6px;
}
.proc-form-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.proc-form-preview .field { margin: 0; }
.proc-form-preview input:disabled,
.proc-form-preview select:disabled,
.proc-form-preview textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Launch tab ─────────────────────────────────────────────── */
.proc-launch-layout {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  gap: 16px;
  height: 100%;
  min-height: 400px;
}
.proc-launch-info {
  padding: 20px;
  background: rgba(34,211,160,0.07);
  border: 1px solid rgba(34,211,160,0.18);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.proc-launch-process-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.proc-launch-process-key {
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}
.proc-launch-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.proc-launch-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.proc-launch-stat span {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}
.proc-launch-stat small {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.proc-launch-form-wrap {
  padding: 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  overflow-y: auto;
}
.proc-launch-instances {
  padding: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  overflow-y: auto;
}
.proc-instance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.proc-instance-row:last-child { border-bottom: none; }
.proc-instance-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}
.proc-instance-status-running { background: var(--primary); box-shadow: 0 0 6px rgba(34,211,160,0.5); }
.proc-instance-status-completed { background: #3b9eff; }
.proc-instance-status-failed { background: #f87171; }
.proc-instance-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  font-size: 12px;
  color: var(--text);
}

/* Shared helper */
.proc-no-selection {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   TASK VIEW TOGGLE (list / kanban / calendar)
   ══════════════════════════════════════════════════════════════ */
.view-toggle-group {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 9px;
}
.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.view-toggle-btn svg { width: 14px; height: 14px; }
.view-toggle-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.view-toggle-btn.active {
  background: rgba(34,211,160,0.15);
  color: var(--primary);
}

/* ══════════════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES — process builder
   ══════════════════════════════════════════════════════════════ */
body.light-theme .proc-tab-btn { color: #64748b; }
body.light-theme .proc-tab-btn:hover { background: rgba(0,0,0,0.05); color: #1e293b; }
body.light-theme .proc-tab-btn.active { background: rgba(34,211,160,0.12); color: #16a37a; }
body.light-theme .proc-tab-content { color: #1e293b; }
body.light-theme .process-def-card { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); }
body.light-theme .process-def-card:hover { background: rgba(0,0,0,0.06); }
body.light-theme .process-def-card.active { border-color: rgba(34,211,160,0.4); background: rgba(34,211,160,0.06); }
body.light-theme .proc-builder-sidebar,
body.light-theme .proc-fields-sidebar,
body.light-theme .proc-launch-form-wrap,
body.light-theme .proc-launch-instances { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.09); }
body.light-theme .proc-field-row { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.07); }
body.light-theme .proc-field-row:hover { background: rgba(0,0,0,0.05); }
body.light-theme .proc-launch-info { border-color: rgba(34,211,160,0.3); }
body.light-theme .view-toggle-group { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); }
body.light-theme .view-toggle-btn:hover { background: rgba(0,0,0,0.07); color: #1e293b; }

/* ══════════════════════════════════════════════════════════════
   ACTIVITY FEED (Dashboard)
   ══════════════════════════════════════════════════════════════ */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.activity-row:last-child { border-bottom: none; }
.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; }
.activity-text {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-time {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.news-post-row { padding: 8px 0; }
.news-post-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.news-post-body { font-size: 12px; color: var(--muted); line-height: 1.5; }
.news-post-meta { font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ══════════════════════════════════════════════════════════════
   TIME BADGE (Task list)
   ══════════════════════════════════════════════════════════════ */
.time-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(59,158,255,0.12);
  color: #3b9eff;
  border: 1px solid rgba(59,158,255,0.2);
  margin-left: 6px;
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════════
   PROJECT TEMPLATES
   ══════════════════════════════════════════════════════════════ */
.tmpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.tmpl-card {
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  transition: border-color 0.12s;
}
.tmpl-card:hover { border-color: rgba(34,211,160,0.3); }
.tmpl-card-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.tmpl-card-desc { font-size: 11px; color: var(--muted); margin-bottom: 6px; line-height: 1.4; }
.tmpl-card-meta { font-size: 10px; color: var(--muted); }

/* ══════════════════════════════════════════════════════════════
   FIELD CONDITIONS EDITOR
   ══════════════════════════════════════════════════════════════ */
.proc-field-conditions {
  background: rgba(59,158,255,0.05);
  border: 1px solid rgba(59,158,255,0.15);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 4px;
  flex-direction: column;
  gap: 6px;
}
.proc-field-conditions select,
.proc-field-conditions input {
  font-size: 12px;
  padding: 4px 8px;
  height: 30px;
}
.proc-launch-field-row { margin-bottom: 10px; }

/* ══════════════════════════════════════════════════════════════
   LIGHT THEME ADDITIONS
   ══════════════════════════════════════════════════════════════ */
body.light-theme .activity-row { border-bottom-color: rgba(0,0,0,0.06); }
body.light-theme .activity-icon { background: rgba(0,0,0,0.05); }
body.light-theme .activity-text { color: #1e293b; }
body.light-theme .time-badge { background: rgba(59,158,255,0.1); color: #1d6ea8; border-color: rgba(59,158,255,0.2); }
body.light-theme .tmpl-card { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.09); }
body.light-theme .proc-field-conditions { background: rgba(59,158,255,0.04); border-color: rgba(59,158,255,0.2); }

