/* 
 * Pasons Media Web — Warm Sand + Terracotta Design System
 * Palette: warm cream, terracotta, sand — light, airy, friendly
 */

:root {
  /* Brand — terracotta + warm earth */
  --navy: #B85C38;
  --navy-deep: #A04E2E;
  --royal: #C87941;
  --mid: #D4915E;
  --sky: #E8B98A;
  --teal: #C87941;
  --danger: #C0392B;
  --danger-tint: #FEF2F1;

  /* Warm sand surface palette */
  --bg: #FFFBF5;
  --card: #FFFFFF;
  --card-hover: #FFF8F0;
  --line: rgba(139, 90, 43, 0.07);
  --line-light: rgba(139, 90, 43, 0.03);

  /* Typography ink — warm brown */
  --ink: #2C1810;
  --ink-soft: #7A6B5D;
  --ink-faint: #B8A694;

  /* Liquid Glass (warm cream translucent material) */
  --glass-bg: rgba(255, 251, 245, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-inner-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(139, 90, 43, 0.06);

  /* Flat accents — no gradients */
  --grad: #B85C38;
  --grad-hover: #A04E2E;
  --grad-soft: rgba(184, 92, 56, 0.04);

  /* Apple superellipse curves */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  /* Shadows — warm-tinted, diffuse, layered (Apple style) */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  --shadow-card-hover: 0 16px 48px rgba(0, 0, 0, 0.1), 0 6px 16px rgba(0, 0, 0, 0.05);

  /* Spring physics transitions (Apple Fluid Interfaces) */
  --transition-spring: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);

  /* Typography — SF Pro Display / System UI, sentence case */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;

  /* Fixed top navbar height (content offset + board viewport math) */
  --app-header-h: 3.75rem;
}

/* Base resets & typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  background: var(--bg);
  font-family: var(--font);
  color: var(--ink);
  min-height: 100dvh;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  line-height: 1.45;
  letter-spacing: -0.015em;
}

/* Apple-style thin scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.22);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Links — Apple-style blue */
a {
  color: var(--mid);
  text-decoration: none;
  transition: var(--transition-fast);
}
a:hover {
  color: var(--navy-deep);
}

/* Base layout container */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Reserve space for fixed top navbar so content never slides under it */
  padding-top: calc(var(--app-header-h, 3.75rem) + env(safe-area-inset-top, 0px));
}

/* Glassmorphic Header — fixed navbar (never scrolls / swipes with board) */
.app-header {
  background: rgba(245, 245, 247, 0.92);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
  padding: 0.7rem 1.25rem;
  padding-top: calc(0.7rem + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 1rem;
  /* Fixed beats sticky when html/body use overflow-x: hidden */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  min-height: calc(var(--app-header-h) + env(safe-area-inset-top, 0px));
  height: auto;
  box-sizing: border-box;
  z-index: 200;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  /* Navbar is not a swipe surface — gestures stay on cards/board only */
  touch-action: manipulation;
  overscroll-behavior: none;
  pointer-events: auto;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  transition: var(--transition-fast);
}

.app-header .brand:hover {
  opacity: 0.9;
  transform: scale(0.98);
}

.app-header .brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: contain;
}

.app-header .meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

/* Apple-style pills — lightweight, precise */
.role-pill {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 0.5px solid rgba(0, 0, 0, 0.04);
  letter-spacing: -0.005em;
}

.pending-pill {
  background: var(--grad);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(184, 92, 56, 0.18);
  letter-spacing: -0.005em;
}

/* Content Container — scrolls under fixed header; header stays put */
.app-body {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem 7rem;
  min-width: 0;
}

/* Translucent Glass Bottom Bar — floating Mac OS Dock */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 100vw;
  background: rgba(245, 245, 247, 0.85);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border-top: 0.5px solid rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-around;
  padding: 0.45rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.03);
}

.bottom-nav a {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.4rem 0.15rem;
  border-radius: 12px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  transition: var(--transition-fast);
  position: relative;
}

/* Labels stay on one line and truncate instead of wrapping / overflowing */
.bottom-nav a > span:not(.ico):not(.badge-count) {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-nav a .ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  flex-shrink: 0;
  color: var(--ink-faint);
  transition: var(--transition-fast);
}

.bottom-nav a .ico svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.6;
  stroke: currentColor;
  fill: none;
  overflow: visible;
  shape-rendering: geometricPrecision;
}

.bottom-nav a:hover {
  color: var(--ink-soft);
  background: rgba(0, 0, 0, 0.03);
}

.bottom-nav a.active {
  color: var(--navy);
  font-weight: 600;
}

.bottom-nav a.active .ico {
  color: var(--navy);
  transform: translateY(-2px);
}

.bottom-nav a.active .ico svg {
  stroke-width: 2.0;
}

.bottom-nav a .badge-count {
  position: absolute;
  top: 3px;
  right: 20%;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-shadow: 0 2px 6px rgba(200, 30, 69, 0.25);
}

/* Premium Squircle Card Containers — Apple style diffuse depth */
.card {
  background: var(--card);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  transition: var(--transition-spring);
  position: relative;
  overflow: hidden;
  /* Apple-style inner highlight — catches light on top edge */
  border-top: 1px solid rgba(255, 255, 255, 0.8);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: rgba(0, 0, 0, 0.08);
}

/* Tactile scale-downs on active press for cards */
.card:active {
  transform: scale(0.998) translateY(0);
  box-shadow: var(--shadow-sm);
  transition-duration: 0.08s;
}

/* Attention required / hot pipeline cards — flat warm accent bar */
.card.hot {
  border-color: rgba(184, 92, 56, 0.15);
  background: var(--card);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(184, 92, 56, 0.04);
}

.card.hot:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(184, 92, 56, 0.08);
}

.card.hot::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3.5px;
  height: 100%;
  background: var(--navy);
  border-radius: 2px 0 0 2px;
}

/* Deterministic Typography */
h1, h2, h3, h4 {
  margin: 0 0 0.85rem;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.035em; /* tight tracking as it grows */
  line-height: 1.15;
}

h1 {
  font-size: 2.1rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

h4 {
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

p {
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.5;
  max-w: 65ch; /* readability limit */
}

.muted {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.faint {
  color: var(--ink-faint);
  font-size: 0.8rem;
}

/* Buttons — Apple-style tactile, weighted, physical */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 12px;
  padding: 0.6rem 1.15rem;
  transition: var(--transition-fast);
  text-decoration: none;
  font-family: inherit;
  user-select: none;
  letter-spacing: -0.01em;
  position: relative;
}

/* Apple-style tactile push — instant response on press */
.btn:active {
  transform: scale(0.96) translateY(1px);
  transition-duration: 0.06s;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--grad);
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.15), var(--shadow-inset);
  border: 0.5px solid rgba(255, 255, 255, 0.12);
}

.btn-primary:hover {
  background: var(--grad-hover);
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.22), var(--shadow-inset);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-outline {
  background: var(--card);
  color: var(--ink);
  border: 0.5px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
  background: var(--card-hover);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--card);
  color: var(--danger);
  border: 0.5px solid rgba(200, 30, 69, 0.12);
  box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
  background: var(--danger-tint);
  border-color: rgba(200, 30, 69, 0.25);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(200, 30, 69, 0.08);
}

/* Sign out — compact solid red button */
.btn-signout {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1.15rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: var(--danger);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn-signout:hover {
  background: #b01a3a;
  box-shadow: 0 4px 14px rgba(200, 30, 69, 0.3);
}

.btn-signout:active {
  transform: scale(0.97);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

/* Forms — Apple design: labels on top, spacious, clean focus */
.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.45rem;
  letter-spacing: -0.005em;
}

.input, select, textarea {
  width: 100%;
  border: 0.5px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 0.7rem 0.95rem;
  font-size: 0.92rem;
  color: var(--ink);
  font-family: inherit;
  transition: var(--transition-fast);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.input:hover, select:hover, textarea:hover {
  border-color: rgba(0, 0, 0, 0.12);
}

.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--mid);
  background: var(--card);
  box-shadow: 0 0 0 3.5px rgba(184, 92, 56, 0.1), 0 1px 2px rgba(0, 0, 0, 0.02);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* Login Card — Apple-style centered, clean */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  transition: var(--transition-spring);
  /* Apple light-catch top edge */
  border-top: 1px solid rgba(255, 255, 255, 0.8);
}

.login-card:hover {
  transform: translateY(-2px);
}

.login-card .logo {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  object-fit: contain;
  margin-bottom: 1.35rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition-spring);
}

.login-card .logo:hover {
  transform: scale(1.04) rotate(2deg);
}

.login-card h1 {
  margin-bottom: 0.35rem;
  font-size: 1.85rem;
  letter-spacing: -0.04em;
}

.login-card .sub {
  color: var(--ink-soft);
  margin-bottom: 1.85rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.login-card form {
  text-align: left;
}

.login-error {
  background: var(--danger-tint);
  color: var(--danger);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1.35rem;
  text-align: left;
  border: 0.5px solid rgba(200, 30, 69, 0.08);
}

/* Flash alerts — Apple Banner style */
.flash-wrap {
  margin-bottom: 1.35rem;
}

.flash {
  border-radius: 12px;
  padding: 0.8rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.65rem;
  border: 0.5px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-spring);
}

.flash.success {
  border-color: rgba(16, 185, 129, 0.12);
  background: #F0FDF4;
  color: #065F46;
}

.flash.error {
  border-color: rgba(200, 30, 69, 0.12);
  background: var(--danger-tint);
  color: #991B1B;
}

.flash.info {
  border-color: rgba(180, 83, 9, 0.12);
  background: #F0F9FF;
  color: #0369A1;
}

/* Branch Cards — Apple-style tactile squircle grid */
.branch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.25rem;
}

.branch-card {
  background: var(--card);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.65rem 1.25rem 1.4rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-spring);
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  /* Apple light-catch top edge */
  border-top: 1px solid rgba(255, 255, 255, 0.8);
}

.branch-card:hover {
  border-color: rgba(0, 0, 0, 0.1);
  transform: translateY(-5px);
  box-shadow: var(--shadow-card-hover);
  text-decoration: none;
}

.branch-card:active {
  transform: scale(0.97) translateY(0);
  transition-duration: 0.08s;
}

/* External agency branch cards — flat warm accent */
.branch-card-external {
  border-color: rgba(184, 92, 56, 0.1);
  background: var(--card);
}

.branch-card-external:hover {
  border-color: rgba(184, 92, 56, 0.18);
  box-shadow: 0 16px 48px rgba(184, 92, 56, 0.1), 0 6px 16px rgba(184, 92, 56, 0.05);
}

.branch-avatar-external {
  background: #B85C38;
  box-shadow: 0 6px 16px rgba(184, 92, 56, 0.15);
}

.branch-card-external:hover .branch-avatar-external {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(184, 92, 56, 0.25);
}

.external-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  color: #A04E2E;
  background: rgba(184, 92, 56, 0.08);
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Kind badges — Apple-style lightweight labels */
.kind-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.kind-badge-internal {
  color: var(--ink-soft);
  background: rgba(0, 0, 0, 0.04);
}

.kind-badge-external {
  color: #A04E2E;
  background: rgba(184, 92, 56, 0.08);
}

.kind-badge-design {
  color: #7A5C8C;
  background: rgba(122, 92, 140, 0.08);
}

/* Drag & Drop — branch kind zones */
.branch-board {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.branch-drop-zone {
  padding: 0;
  margin: 0;
  min-height: 7.5rem;
  border: 1.5px dashed transparent;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.branch-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.5rem 0.7rem;
  flex-wrap: wrap;
}

.branch-zone-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.branch-zone-title h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  letter-spacing: -0.02em;
}

.branch-zone-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-faint, rgba(44, 24, 16, 0.4));
  letter-spacing: 0.01em;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.branch-board.is-dragging-active .branch-zone-hint {
  opacity: 1;
}

.branch-zone-list {
  display: flex;
  flex-direction: column;
  min-height: 3.5rem;
  padding-bottom: 0.5rem;
}

.branch-zone-empty {
  margin: 0.35rem 1.25rem 1rem;
  padding: 1.1rem 1rem;
  border: 1.5px dashed var(--line, rgba(139, 90, 43, 0.15));
  border-radius: 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-faint, rgba(44, 24, 16, 0.45));
  background: rgba(0, 0, 0, 0.015);
}

.branch-drop-zone.drag-over {
  border-color: var(--navy) !important;
  box-shadow: 0 0 0 2px rgba(184, 92, 56, 0.18), 0 8px 32px rgba(184, 92, 56, 0.1);
  background: rgba(184, 92, 56, 0.04);
}

.branch-drop-zone.drag-over .branch-zone-empty {
  border-color: var(--navy);
  color: var(--navy);
  background: rgba(184, 92, 56, 0.06);
}

.branch-drag-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.25rem;
  border-top: 1px solid var(--line-light);
  transition: opacity 0.15s ease, background 0.15s ease;
  cursor: grab;
  flex-wrap: wrap;
}

.branch-drag-row.is-dragging {
  opacity: 0.35;
}

.branch-drag-row:active {
  cursor: grabbing;
}

.branch-drag-row .drag-handle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  color: var(--ink-faint, rgba(44, 24, 16, 0.35));
  transition: color 0.15s ease;
  padding: 0.25rem;
}

.branch-drag-row:hover .drag-handle {
  color: var(--navy);
}

.branch-row-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 220px;
  min-width: 0;
  margin: 0;
  flex-wrap: wrap;
}

.branch-name-input {
  flex: 1;
  min-width: 120px;
  padding: 0.45rem 0.75rem !important;
  font-size: 0.9rem !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

.branch-kind-form,
.branch-archive-form {
  margin: 0;
  flex-shrink: 0;
}

.branch-kind-select {
  width: auto !important;
  min-width: 118px;
  padding: 0.4rem 0.55rem !important;
  font-size: 0.82rem !important;
  font-weight: 600;
  border-radius: 10px !important;
  box-shadow: none !important;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .branch-drag-row {
    align-items: flex-start;
  }
  .branch-zone-hint {
    display: none;
  }
}

/* Design branch cards */
.branch-card-design {
  border-color: rgba(122, 92, 140, 0.1);
  background: var(--card);
}

.branch-card-design:hover {
  border-color: rgba(122, 92, 140, 0.18);
  box-shadow: 0 16px 48px rgba(122, 92, 140, 0.1), 0 6px 16px rgba(122, 92, 140, 0.05);
}

.branch-avatar-design {
  background: #7A5C8C;
  box-shadow: 0 6px 16px rgba(122, 92, 140, 0.15);
}

.branch-card-design:hover .branch-avatar-design {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(122, 92, 140, 0.25);
}

.design-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  color: #7A5C8C;
  background: rgba(122, 92, 140, 0.08);
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Apple squircle (superellipse) avatar — refined depth */
.branch-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  background: var(--navy);
  box-shadow: 0 4px 12px rgba(184, 92, 56, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: var(--transition-fast);
  /* Inner highlight for Apple depth */
  border: 0.5px solid rgba(255, 255, 255, 0.12);
}

.branch-card:hover .branch-avatar {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 20px rgba(184, 92, 56, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.branch-card h3 {
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.025em;
  font-weight: 650;
  color: var(--ink);
}

.branch-stats {
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-weight: 500;
  letter-spacing: -0.005em;
}

/* Video Card — refined Apple-style layout */
.video-card {
  position: relative;
}

.video-card .top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.video-card .title {
  font-weight: 650;
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.video-card .client-line {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: -0.005em;
  flex-shrink: 0;
}

/* Pipeline indicators — colors inherit the palette selected on Profile */
.dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.9rem 0;
}

.dot {
  --dot-color: var(--royal);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--royal) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--royal) 12%, transparent);
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.dot-stage-1 { --dot-color: var(--navy-deep); }
.dot-stage-2 { --dot-color: var(--royal); }
.dot-stage-3 { --dot-color: var(--mid); }
.dot-stage-4 { --dot-color: var(--sky); }
.dot-stage-5 { --dot-color: var(--teal); }
.dot-stage-6 { --dot-color: var(--navy-deep); }

.dot-active {
  background: var(--dot-color);
  border-color: color-mix(in srgb, var(--dot-color) 70%, transparent);
  transform: scale(1.25);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot-color) 12%, transparent),
              0 0 9px color-mix(in srgb, var(--dot-color) 62%, transparent);
}

.dot-inactive {
  background: color-mix(in srgb, var(--royal) 10%, var(--card));
}

.task-stage-badge {
  background: color-mix(in srgb, var(--royal) 10%, var(--card));
  color: var(--navy-deep);
  border: 1px solid color-mix(in srgb, var(--royal) 24%, transparent);
}

.live-tag {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 0.5rem;
  background: color-mix(in srgb, var(--teal) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--teal) 20%, transparent);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.chip {
  background: color-mix(in srgb, var(--royal) 6%, var(--card));
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 500;
  border: 1px solid color-mix(in srgb, var(--royal) 12%, transparent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 0.5px solid var(--line-light);
}

.note-box {
  background: var(--danger-tint);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.9rem;
  border: 0.5px solid rgba(200, 30, 69, 0.06);
}

.concept {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0.5rem 0 0.9rem;
  white-space: pre-wrap;
  line-height: 1.55;
  letter-spacing: -0.005em;
}

/* Bento Grid Dashboard — Apple-style diffuse depth */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.bento-card {
  grid-column: span 12;
  background: var(--card);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-spring);
  position: relative;
  overflow: hidden;
  /* Apple light-catch top edge */
  border-top: 1px solid rgba(255, 255, 255, 0.8);
}

.bento-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.bento-card:active {
  transform: scale(0.998) translateY(0);
  transition-duration: 0.08s;
}

@media (min-width: 768px) {
  .bento-stat-main { grid-column: span 6; }
  .bento-stat-sub { grid-column: span 3; }
  .bento-pipeline { grid-column: span 7; }
  .bento-attention { grid-column: span 5; }
  .bento-team { grid-column: span 12; }
}

@media (min-width: 1024px) {
  .bento-stat-main { grid-column: span 3; }
  .bento-stat-sub { grid-column: span 3; }
  .bento-pipeline { grid-column: span 8; }
  .bento-attention { grid-column: span 4; }
  .bento-team { grid-column: span 4; }
  .bento-pipeline { grid-column: span 8; }
}

/* Stat formatting — Apple-style tabular figures */
.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
  font-family: var(--font);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: -0.015em;
}

/* Stage Bar Chart — Apple-style clean */
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.75rem;
}

.bar-row:last-child {
  margin-bottom: 0;
}

.bar-label {
  width: 100px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: -0.005em;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
  transition: var(--transition-spring);
}

.bar-n {
  width: 30px;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Dashboard — compact operations overview */
.dashboard-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-heading h1 {
  margin: 0.1rem 0 0.3rem;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.dashboard-heading .muted {
  margin: 0;
  max-width: 38rem;
  text-wrap: pretty;
}

.dashboard-eyebrow,
.dashboard-panel__kicker {
  margin: 0;
  color: var(--royal);
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-grid {
  gap: 1rem;
  margin-top: 1.25rem;
  align-items: start;
}

.dashboard-grid .bento-card {
  padding: 1.35rem;
  border-radius: var(--radius-lg);
}

.dashboard-stat {
  min-height: 7rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-top: 1px solid color-mix(in srgb, var(--royal) 14%, var(--line));
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--navy);
}

.dashboard-stat--live {
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--teal);
}

.dashboard-stat--attention {
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--danger);
}

.dashboard-stat--attention .stat-value {
  color: var(--danger);
}

.dashboard-stat--team {
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--royal);
}

.dashboard-stat .stat-value {
  font-size: clamp(2rem, 3vw, 2.55rem);
}

.dashboard-panel {
  min-width: 0;
}

.dashboard-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}

.dashboard-panel__head h2 {
  margin: 0.15rem 0 0;
  font-size: 1.08rem;
  letter-spacing: -0.025em;
}

.dashboard-summary-chip,
.age-chip,
.workload-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--royal) 15%, transparent);
  background: color-mix(in srgb, var(--royal) 7%, var(--card));
  color: var(--navy-deep);
  font-variant-numeric: tabular-nums;
}

.dashboard-summary-chip {
  min-height: 1.55rem;
  padding: 0.2rem 0.55rem;
  border-radius: 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-summary-chip--alert {
  border-color: color-mix(in srgb, var(--danger) 20%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, var(--card));
  color: var(--danger);
}

.dashboard-bars {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dashboard-bars .bar-row {
  margin-bottom: 0;
  min-height: 2rem;
}

.dashboard-scroll-region {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--royal) 28%, transparent) transparent;
}

.attention-list,
.workload-list {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.attention-list {
  max-height: 20rem;
}

.attention-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.55rem;
  min-height: 3.35rem;
  padding: 0.55rem 0.1rem;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line-light);
  transition: background-color 180ms ease, padding 180ms ease;
}

.attention-item:last-child {
  border-bottom: 0;
}

.attention-item:hover,
.attention-item:focus-visible {
  padding-inline: 0.45rem;
  background: color-mix(in srgb, var(--royal) 5%, transparent);
  border-radius: var(--radius-sm);
  outline: none;
}

.attention-item:focus-visible {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--royal) 34%, transparent);
}

.attention-item__body,
.workload-person {
  min-width: 0;
}

.attention-item__body strong,
.attention-item__body span,
.workload-person strong,
.workload-person span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-item__body strong,
.workload-person strong {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.3;
}

.attention-item__body span,
.workload-person span {
  margin-top: 0.13rem;
  color: var(--ink-faint);
  font-size: 0.68rem;
  font-weight: 500;
}

.age-chip {
  min-width: 2.15rem;
  min-height: 1.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.4rem;
  font-size: 0.65rem;
  font-weight: 750;
}

.age-chip--overdue {
  border-color: color-mix(in srgb, var(--danger) 22%, transparent);
  background: color-mix(in srgb, var(--danger) 9%, var(--card));
  color: var(--danger);
}

.attention-item__arrow {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms ease, stroke 180ms ease;
}

.attention-item:hover .attention-item__arrow {
  transform: translateX(2px);
  stroke: var(--royal);
}

.dashboard-team-panel {
  grid-column: span 12;
}

.workload-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1.35rem;
  max-height: 22rem;
  padding-right: 0.2rem;
}

.workload-item {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  min-height: 3.25rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line-light);
}

.workload-avatar {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--royal) 16%, transparent);
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--royal) 10%, var(--card));
  color: var(--navy-deep);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.workload-chip {
  gap: 0.23rem;
  min-height: 1.45rem;
  padding: 0.12rem 0.43rem;
  border-radius: 0.45rem;
  font-size: 0.64rem;
  font-weight: 650;
  white-space: nowrap;
}

.workload-chip__count {
  font-weight: 800;
}

.workload-chip--clear {
  border-color: var(--line);
  background: var(--bg);
  color: var(--ink-faint);
}

.dashboard-empty-state {
  min-height: 13rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  padding: 1.25rem;
  color: var(--ink-faint);
  text-align: center;
}

.dashboard-empty-state svg {
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 0.25rem;
  fill: none;
  stroke: var(--teal);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-empty-state strong {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.dashboard-empty-state span {
  max-width: 17rem;
  font-size: 0.7rem;
  line-height: 1.45;
}

.dashboard-empty-state--compact {
  min-height: 7rem;
}

@media (min-width: 1024px) {
  .dashboard-grid .bento-pipeline {
    grid-column: span 8;
  }

  .dashboard-grid .bento-attention {
    grid-column: span 4;
  }
}

@media (max-width: 767px) {
  .dashboard-heading h1 {
    font-size: 1.65rem;
  }

  .dashboard-grid {
    gap: 0.75rem;
  }

  .dashboard-grid .bento-card {
    padding: 1.05rem;
  }

  .dashboard-stat {
    min-height: 6.25rem;
  }

  .workload-list {
    grid-template-columns: minmax(0, 1fr);
    max-height: 19rem;
  }

  .attention-list {
    max-height: 18rem;
  }
}

@media (max-width: 420px) {
  .dashboard-panel__head {
    align-items: flex-start;
  }

  .bar-label {
    width: 76px;
    font-size: 0.71rem;
  }

  .workload-chip__label {
    display: none;
  }

  .workload-chip {
    min-width: 1.55rem;
    padding-inline: 0.34rem;
  }
}

/* Tables — Apple style: clean, negative space, subtle hover */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 0.5px solid var(--line);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--card);
}

table.data th, table.data td {
  text-align: left;
  padding: 0.85rem 1.15rem;
  border-bottom: 0.5px solid var(--line-light);
}

table.data th {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 0.5px solid var(--line);
  background: rgba(0, 0, 0, 0.01);
}

table.data tr {
  transition: var(--transition-fast);
}

table.data tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}

/* Section headers — Apple-style clean */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.15rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.section-head .links {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

/* ── Team Page ────────────────────────────────────────── */

.team-page-title {
  font-size: 2.25rem;
  letter-spacing: -0.05em;
  font-weight: 800;
  color: var(--navy-deep);
  margin-bottom: 0.4rem;
}

.team-page-subtitle {
  font-size: 1rem;
  font-weight: 500;
}

/* ========================================
   TEAM PAGE — Card-Based Responsive Design
   ======================================== */

/* Page header */
.team-page-title {
  font-size: 2.25rem;
  letter-spacing: -0.05em;
  font-weight: 800;
  color: var(--navy-deep);
  margin-bottom: 0.4rem;
}

.team-page-subtitle {
  font-size: 1rem;
  font-weight: 500;
}

/* Grid: 2 columns desktop, 1 column mobile */
.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1.5rem;
}

@media (min-width: 640px) {
  .team-grid {
    padding: 1.5rem 0;
    gap: 1.25rem;
  }
}

@media (min-width: 768px) {
  .team-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}

/* ---- Card ---- */
.team-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
}

/* Alternating card backgrounds */
.team-card:nth-child(odd) {
  background: #FFFBF7;
  border-color: rgba(139, 90, 43, 0.08);
}

.team-card:nth-child(even) {
  background: #FFFFFF;
  border-color: rgba(139, 90, 43, 0.06);
}

/* Admin/leader cards get a subtle left accent */
.team-card:nth-child(1),
.team-card:nth-child(2) {
  border-left: 3px solid var(--navy);
  padding-left: calc(1.5rem - 2px);
}

.team-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  border-color: rgba(139, 90, 43, 0.15);
  transform: translateY(-1px);
}

/* ---- Card Header: Avatar + Info ---- */
.team-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.team-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.team-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* Role-specific avatar colors */
.team-avatar--admin       { background: #B85C38; }
.team-avatar--leader      { background: #C87941; }
.team-avatar--designer_head { background: #7A5C8C; }
.team-avatar--designer    { background: #9B7DB8; }
.team-avatar--creator     { background: #D4915E; }
.team-avatar--videographer { background: #6B8E6B; }
.team-avatar--editor      { background: #5B7EA8; }
.team-avatar--poster      { background: #A87B5B; }

.team-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.team-email {
  font-size: 0.8rem;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

/* Role badge for read-only users */
.team-role-badge {
  flex-shrink: 0;
  align-self: center;
}

/* ---- Card Actions: Role + Action Button ---- */
.team-card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-light);
  flex-wrap: wrap;
}

.team-role-form {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.team-action-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.team-role-select {
  width: auto;
  min-width: 140px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  flex: 1;
  background-color: var(--bg);
}

.team-action-form {
  margin: 0;
  flex-shrink: 0;
}

.team-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  transition: var(--transition-fast);
}

.team-action-btn:active {
  transform: scale(0.97);
}

.team-action-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.team-deactivate {
  background: rgba(192, 57, 43, 0.06);
  color: #C0392B;
  border-color: rgba(192, 57, 43, 0.15);
}

.team-deactivate:hover {
  background: rgba(192, 57, 43, 0.12);
}

.team-activate {
  background: rgba(5, 150, 105, 0.06);
  color: #059669;
  border-color: rgba(5, 150, 105, 0.15);
}

.team-activate:hover {
  background: rgba(5, 150, 105, 0.12);
}

/* ---- Team — Tablet (≤640px) ---- */
@media (max-width: 640px) {
  .team-page-title {
    font-size: 1.75rem;
  }

  .team-grid {
    padding: 1rem;
    gap: 1rem;
  }

  .team-card {
    padding: 1.15rem;
    border-radius: 12px;
    gap: 0.9rem;
  }

  .team-card:nth-child(1),
  .team-card:nth-child(2) {
    border-left-width: 2px;
    padding-left: calc(1.15rem - 1px);
  }

  .team-card-header {
    gap: 0.75rem;
  }

  .team-avatar {
    width: 44px;
    height: 44px;
    font-size: 0.9rem;
    border-radius: 13px;
  }

  .team-name {
    font-size: 0.95rem;
  }

  .team-email {
    font-size: 0.78rem;
  }

  .team-card-actions {
    gap: 0.6rem;
    padding-top: 0.9rem;
  }

  .team-role-select {
    min-width: 110px;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }

  .team-action-btn {
    font-size: 0.78rem;
    padding: 0.45rem 0.85rem;
  }

  .team-action-btn svg {
    width: 13px;
    height: 13px;
  }
}

/* ---- Team — Small phones (≤380px) ---- */
@media (max-width: 380px) {
  .team-grid {
    padding: 0.75rem;
    gap: 0.85rem;
  }

  .team-card {
    padding: 1rem;
    border-radius: 11px;
    gap: 0.8rem;
  }

  .team-card:nth-child(1),
  .team-card:nth-child(2) {
    border-left-width: 2px;
    padding-left: calc(1rem - 1px);
  }

  .team-avatar {
    width: 40px;
    height: 40px;
    font-size: 0.82rem;
    border-radius: 11px;
  }

  .team-name {
    font-size: 0.88rem;
  }

  .team-email {
    font-size: 0.73rem;
  }

  .team-card-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .team-role-form {
    width: 100%;
  }

  .team-role-select {
    width: 100%;
    min-width: 0;
    font-size: 0.78rem;
    padding: 0.4rem 0.6rem;
  }

  .team-action-form {
    width: 100%;
  }

  .team-action-btn {
    width: 100%;
    justify-content: center;
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
  }
}

/* History List — clean timeline */
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-list li {
  padding: 0.75rem 0;
  border-bottom: 0.5px solid var(--line-light);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.15rem;
}

.history-list li:last-child {
  border-bottom: none;
}

/* Utility classes */
.row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}

.spacer {
  flex: 1;
}

.mt-0 { margin-top: 0; }
.mb-1 { margin-bottom: 1rem; }

.empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--ink-soft);
  background: var(--card);
  border: 1.5px dashed rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  font-weight: 500;
}

/* Compact single-line dock on small phones — 8 tabs must never wrap or overflow */
@media (max-width: 640px) {
  :root {
    --app-header-h: 3.5rem;
  }
  .app-header {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }
  .app-header .brand {
    font-size: 1.05rem;
    min-width: 0;
  }
  .app-header .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 52vw;
  }
  .app-body {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 1rem;
  }
  .bottom-nav {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }
  .bottom-nav a {
    font-size: 0.62rem;
    padding: 0.35rem 0.1rem;
    gap: 0.15rem;
  }
  .bottom-nav a .ico {
    width: 20px;
    height: 20px;
    min-width: 20px;
  }
  .bottom-nav a .ico svg {
    width: 20px;
    height: 20px;
  }
}

/* Floating Mac OS Dock — desktop refinement.
   Center with ONE method only (left:50% + translateX); right:auto stops the
   old left/right/margin fight that pushed the dock off-center on wide screens. */
@media (min-width: 900px) {
  .bottom-nav {
    max-width: 720px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 1.25rem;
    border-radius: var(--radius-xl);
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.03);
    background: rgba(245, 245, 247, 0.88);
  }
  .app-body {
    padding-bottom: 8.5rem;
  }
}

/* ================================================================
   Pagination — single-line centered pill bar
   ================================================================ */

.pagination {
  width: 100%;
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.pgn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  text-decoration: none;
  background: transparent;
  border: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  user-select: none;
  cursor: pointer;
}

.pgn-btn:hover {
  background: rgba(184, 92, 56, 0.08);
  color: var(--ink);
  text-decoration: none;
}

.pgn-btn:active {
  transform: scale(0.93);
}

.pgn-cur {
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(184, 92, 56, 0.25);
  cursor: default;
  pointer-events: none;
}

.pgn-off {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.pgn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.pgn-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 38px;
  font-size: 0.85rem;
  color: var(--ink-faint);
  font-weight: 500;
  user-select: none;
}

/* ────────────────────────────────────────────────────────
   Report page
   ──────────────────────────────────────────────────────── */

.report-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 5rem;
}

/* Header */
.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.report-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.25rem;
}

.report-subtitle {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0;
  letter-spacing: -0.005em;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 180ms ease, transform 100ms ease;
  letter-spacing: -0.005em;
}
.btn-export:hover {
  background: var(--navy-deep);
  transform: translateY(-1px);
}
.btn-export:active {
  transform: scale(0.97);
}

/* Period pills */
.period-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.period-pill {
  display: inline-flex;
  padding: 0.45rem 0.95rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--line);
  transition: all 180ms ease;
  letter-spacing: -0.005em;
}
.period-pill:hover {
  border-color: var(--mid);
  color: var(--ink);
}
.period-pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

/* Totals cards */
.report-totals {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.total-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.65rem 1.2rem;
  min-width: 72px;
}

.total-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.total-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Table */
.report-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 700px;
}

.report-table thead th {
  padding: 0.7rem 0.75rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.report-table thead th.sticky-left {
  text-align: left;
  left: 0;
  z-index: 2;
  min-width: 140px;
}

.report-table tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line-light);
  text-align: center;
  white-space: nowrap;
}

.report-table tbody td.sticky-left {
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 1;
  text-align: left;
}

.report-table tbody tr.row-external td.sticky-left {
  background: #FFF8F0;
}

.report-table tbody tr.row-external td {
  background: #FFF8F0;
}

.report-table tbody tr.row-design td.sticky-left {
  background: #F9F5FF;
}

.report-table tbody tr.row-design td {
  background: #F9F5FF;
}

.report-table tbody tr:last-child td {
  border-bottom: none;
}

.branch-name {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.kind-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 0.3rem;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.kind-tag.internal {
  background: var(--grad-soft);
  color: var(--navy);
}
.kind-tag.external {
  background: #FFF0EA;
  color: #B85C38;
}
.kind-tag.design {
  background: #F3EEFF;
  color: #7C3AED;
}

.stage-count,
.count-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-soft);
}

.posted-cell {
  color: #059669;
}

.date-cell {
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.empty-row {
  text-align: center;
  padding: 2.5rem 1rem !important;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-faint);
}
.empty-state p {
  margin: 0;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.empty-state span {
  font-size: 0.78rem;
}

/* Mobile responsiveness for report */
@media (max-width: 768px) {
  .report-header {
    flex-direction: column;
  }
  .report-title {
    font-size: 1.25rem;
  }
  .report-totals {
    gap: 0.4rem;
  }
  .total-card {
    padding: 0.45rem 0.7rem;
    min-width: 56px;
  }
  .total-num {
    font-size: 1.05rem;
  }
  .total-label {
    font-size: 0.6rem;
  }
}

/* ================================================================
   Color Theme Palettes — light mode, user-selectable
   ================================================================ */

/* Ocean Mist — cool blue, slate */
[data-theme="ocean-mist"] {
  --navy: #2563EB;
  --navy-deep: #1D4ED8;
  --royal: #3B82F6;
  --mid: #60A5FA;
  --sky: #93C5FD;
  --teal: #2563EB;
  --bg: #F0F4F8;
  --card: #FFFFFF;
  --card-hover: #F8FAFC;
  --line: rgba(37, 99, 235, 0.07);
  --line-light: rgba(37, 99, 235, 0.03);
  --ink: #0F172A;
  --ink-soft: #475569;
  --ink-faint: #94A3B8;
  --glass-bg: rgba(240, 244, 248, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #2563EB;
  --grad-hover: #1D4ED8;
  --grad-soft: rgba(37, 99, 235, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(15, 23, 42, 0.1), 0 6px 16px rgba(15, 23, 42, 0.05);
}

/* Forest Sage — green, warm neutral */
[data-theme="forest-sage"] {
  --navy: #16A34A;
  --navy-deep: #15803D;
  --royal: #22C55E;
  --mid: #4ADE80;
  --sky: #86EFAC;
  --teal: #16A34A;
  --bg: #F6F8F4;
  --card: #FFFFFF;
  --card-hover: #FAFDF7;
  --line: rgba(22, 163, 74, 0.07);
  --line-light: rgba(22, 163, 74, 0.03);
  --ink: #14210D;
  --ink-soft: #4A5D3E;
  --ink-faint: #94A88A;
  --glass-bg: rgba(246, 248, 244, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #16A34A;
  --grad-hover: #15803D;
  --grad-soft: rgba(22, 163, 74, 0.04);
  --shadow-sm: 0 1px 3px rgba(20, 33, 13, 0.04), 0 1px 2px rgba(20, 33, 13, 0.02);
  --shadow-md: 0 4px 16px rgba(20, 33, 13, 0.06), 0 2px 4px rgba(20, 33, 13, 0.03);
  --shadow-lg: 0 12px 40px rgba(20, 33, 13, 0.08), 0 4px 12px rgba(20, 33, 13, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(20, 33, 13, 0.1), 0 6px 16px rgba(20, 33, 13, 0.05);
}

/* Lavender Dusk — soft purple, cream */
[data-theme="lavender-dusk"] {
  --navy: #7C3AED;
  --navy-deep: #6D28D9;
  --royal: #8B5CF6;
  --mid: #A78BFA;
  --sky: #C4B5FD;
  --teal: #7C3AED;
  --bg: #FAF5FF;
  --card: #FFFFFF;
  --card-hover: #F5F0FF;
  --line: rgba(124, 58, 237, 0.07);
  --line-light: rgba(124, 58, 237, 0.03);
  --ink: #1E1033;
  --ink-soft: #5B4A72;
  --ink-faint: #A094B8;
  --glass-bg: rgba(250, 245, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #7C3AED;
  --grad-hover: #6D28D9;
  --grad-soft: rgba(124, 58, 237, 0.04);
  --shadow-sm: 0 1px 3px rgba(30, 16, 51, 0.04), 0 1px 2px rgba(30, 16, 51, 0.02);
  --shadow-md: 0 4px 16px rgba(30, 16, 51, 0.06), 0 2px 4px rgba(30, 16, 51, 0.03);
  --shadow-lg: 0 12px 40px rgba(30, 16, 51, 0.08), 0 4px 12px rgba(30, 16, 51, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(30, 16, 51, 0.1), 0 6px 16px rgba(30, 16, 51, 0.05);
}

/* Rose Quartz — soft pink, warm gray */
[data-theme="rose-quartz"] {
  --navy: #E11D48;
  --navy-deep: #BE123C;
  --royal: #F43F5E;
  --mid: #FB7185;
  --sky: #FDA4AF;
  --teal: #E11D48;
  --bg: #FFF1F2;
  --card: #FFFFFF;
  --card-hover: #FFF5F6;
  --line: rgba(225, 29, 72, 0.07);
  --line-light: rgba(225, 29, 72, 0.03);
  --ink: #2D1218;
  --ink-soft: #7A4A56;
  --ink-faint: #BC9AA3;
  --glass-bg: rgba(255, 241, 242, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #E11D48;
  --grad-hover: #BE123C;
  --grad-soft: rgba(225, 29, 72, 0.04);
  --shadow-sm: 0 1px 3px rgba(45, 18, 24, 0.04), 0 1px 2px rgba(45, 18, 24, 0.02);
  --shadow-md: 0 4px 16px rgba(45, 18, 24, 0.06), 0 2px 4px rgba(45, 18, 24, 0.03);
  --shadow-lg: 0 12px 40px rgba(45, 18, 24, 0.08), 0 4px 12px rgba(45, 18, 24, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(45, 18, 24, 0.1), 0 6px 16px rgba(45, 18, 24, 0.05);
}

/* Midnight Ink — dark navy accents, light gray surface */
[data-theme="midnight-ink"] {
  --navy: #1E3A5F;
  --navy-deep: #15294A;
  --royal: #2D5F8A;
  --mid: #4A90C4;
  --sky: #7AB8E0;
  --teal: #1E3A5F;
  --bg: #F1F3F5;
  --card: #FFFFFF;
  --card-hover: #F5F6F8;
  --line: rgba(30, 58, 95, 0.08);
  --line-light: rgba(30, 58, 95, 0.04);
  --ink: #111827;
  --ink-soft: #4B5563;
  --ink-faint: #9CA3AF;
  --glass-bg: rgba(241, 243, 245, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #1E3A5F;
  --grad-hover: #15294A;
  --grad-soft: rgba(30, 58, 95, 0.04);
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.06), 0 1px 2px rgba(17, 24, 39, 0.03);
  --shadow-md: 0 4px 16px rgba(17, 24, 39, 0.08), 0 2px 4px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 12px 40px rgba(17, 24, 39, 0.1), 0 4px 12px rgba(17, 24, 39, 0.05);
  --shadow-card-hover: 0 16px 48px rgba(17, 24, 39, 0.12), 0 6px 16px rgba(17, 24, 39, 0.06);
}

/* Arctic Frost — cool white, icy blue-gray */
[data-theme="arctic-frost"] {
  --navy: #0EA5E9;
  --navy-deep: #0284C7;
  --royal: #38BDF8;
  --mid: #7DD3FC;
  --sky: #BAE6FD;
  --teal: #0EA5E9;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --card-hover: #F1F5F9;
  --line: rgba(14, 165, 233, 0.07);
  --line-light: rgba(14, 165, 233, 0.03);
  --ink: #0F172A;
  --ink-soft: #64748B;
  --ink-faint: #94A3B8;
  --glass-bg: rgba(248, 250, 252, 0.82);
  --glass-border: rgba(255, 255, 255, 0.8);
  --grad: #0EA5E9;
  --grad-hover: #0284C7;
  --grad-soft: rgba(14, 165, 233, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.03), 0 1px 2px rgba(15, 23, 42, 0.015);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.05), 0 2px 4px rgba(15, 23, 42, 0.025);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.07), 0 4px 12px rgba(15, 23, 42, 0.035);
  --shadow-card-hover: 0 16px 48px rgba(15, 23, 42, 0.09), 0 6px 16px rgba(15, 23, 42, 0.045);
}

/* Amber Gold — golden, warm yellow */
[data-theme="amber-gold"] {
  --navy: #D97706;
  --navy-deep: #B45309;
  --royal: #F59E0B;
  --mid: #FBBF24;
  --sky: #FCD34D;
  --teal: #D97706;
  --bg: #FFFBEB;
  --card: #FFFFFF;
  --card-hover: #FFF8E1;
  --line: rgba(217, 119, 6, 0.08);
  --line-light: rgba(217, 119, 6, 0.04);
  --ink: #1C1104;
  --ink-soft: #78643E;
  --ink-faint: #BCA77E;
  --glass-bg: rgba(255, 251, 235, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #D97706;
  --grad-hover: #B45309;
  --grad-soft: rgba(217, 119, 6, 0.04);
  --shadow-sm: 0 1px 3px rgba(28, 17, 4, 0.04), 0 1px 2px rgba(28, 17, 4, 0.02);
  --shadow-md: 0 4px 16px rgba(28, 17, 4, 0.06), 0 2px 4px rgba(28, 17, 4, 0.03);
  --shadow-lg: 0 12px 40px rgba(28, 17, 4, 0.08), 0 4px 12px rgba(28, 17, 4, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(28, 17, 4, 0.1), 0 6px 16px rgba(28, 17, 4, 0.05);
}

/* Copper Blush — warm copper/bronze */
[data-theme="copper-blush"] {
  --navy: #C2703E;
  --navy-deep: #A35D30;
  --royal: #D4895A;
  --mid: #E0A87E;
  --sky: #E8C4A8;
  --teal: #C2703E;
  --bg: #FDF7F2;
  --card: #FFFFFF;
  --card-hover: #FAF0E8;
  --line: rgba(194, 112, 62, 0.07);
  --line-light: rgba(194, 112, 62, 0.03);
  --ink: #2C1A0E;
  --ink-soft: #7A6250;
  --ink-faint: #B8A08E;
  --glass-bg: rgba(253, 247, 242, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #C2703E;
  --grad-hover: #A35D30;
  --grad-soft: rgba(194, 112, 62, 0.04);
  --shadow-sm: 0 1px 3px rgba(44, 26, 14, 0.04), 0 1px 2px rgba(44, 26, 14, 0.02);
  --shadow-md: 0 4px 16px rgba(44, 26, 14, 0.06), 0 2px 4px rgba(44, 26, 14, 0.03);
  --shadow-lg: 0 12px 40px rgba(44, 26, 14, 0.08), 0 4px 12px rgba(44, 26, 14, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(44, 26, 14, 0.1), 0 6px 16px rgba(44, 26, 14, 0.05);
}

/* Slate Storm — cool professional slate/gray-blue */
[data-theme="slate-storm"] {
  --navy: #475569;
  --navy-deep: #334155;
  --royal: #64748B;
  --mid: #94A3B8;
  --sky: #CBD5E1;
  --teal: #475569;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --card-hover: #F1F5F9;
  --line: rgba(71, 85, 105, 0.08);
  --line-light: rgba(71, 85, 105, 0.03);
  --ink: #0F172A;
  --ink-soft: #64748B;
  --ink-faint: #94A3B8;
  --glass-bg: rgba(248, 250, 252, 0.82);
  --glass-border: rgba(255, 255, 255, 0.75);
  --grad: #475569;
  --grad-hover: #334155;
  --grad-soft: rgba(71, 85, 105, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(15, 23, 42, 0.1), 0 6px 16px rgba(15, 23, 42, 0.05);
}

/* Mint Dew — fresh teal/mint green */
[data-theme="mint-dew"] {
  --navy: #0D9488;
  --navy-deep: #0F766E;
  --royal: #14B8A6;
  --mid: #2DD4BF;
  --sky: #5EEAD4;
  --teal: #0D9488;
  --bg: #F0FDFA;
  --card: #FFFFFF;
  --card-hover: #E6FBF5;
  --line: rgba(13, 148, 136, 0.07);
  --line-light: rgba(13, 148, 136, 0.03);
  --ink: #042F2E;
  --ink-soft: #5A7D7A;
  --ink-faint: #8FB8B4;
  --glass-bg: rgba(240, 253, 250, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #0D9488;
  --grad-hover: #0F766E;
  --grad-soft: rgba(13, 148, 136, 0.04);
  --shadow-sm: 0 1px 3px rgba(4, 47, 46, 0.04), 0 1px 2px rgba(4, 47, 46, 0.02);
  --shadow-md: 0 4px 16px rgba(4, 47, 46, 0.06), 0 2px 4px rgba(4, 47, 46, 0.03);
  --shadow-lg: 0 12px 40px rgba(4, 47, 46, 0.08), 0 4px 12px rgba(4, 47, 46, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(4, 47, 46, 0.1), 0 6px 16px rgba(4, 47, 46, 0.05);
}

/* Sunset Peach — warm coral/peach */
[data-theme="sunset-peach"] {
  --navy: #E85D3A;
  --navy-deep: #D14A28;
  --royal: #F4845F;
  --mid: #F9A88A;
  --sky: #FBB4A0;
  --teal: #E85D3A;
  --bg: #FFF5F2;
  --card: #FFFFFF;
  --card-hover: #FFF0EB;
  --line: rgba(232, 93, 58, 0.07);
  --line-light: rgba(232, 93, 58, 0.03);
  --ink: #2C1208;
  --ink-soft: #8A5A44;
  --ink-faint: #C49A86;
  --glass-bg: rgba(255, 245, 242, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #E85D3A;
  --grad-hover: #D14A28;
  --grad-soft: rgba(232, 93, 58, 0.04);
  --shadow-sm: 0 1px 3px rgba(44, 18, 8, 0.04), 0 1px 2px rgba(44, 18, 8, 0.02);
  --shadow-md: 0 4px 16px rgba(44, 18, 8, 0.06), 0 2px 4px rgba(44, 18, 8, 0.03);
  --shadow-lg: 0 12px 40px rgba(44, 18, 8, 0.08), 0 4px 12px rgba(44, 18, 8, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(44, 18, 8, 0.1), 0 6px 16px rgba(44, 18, 8, 0.05);
}

/* --- #13 Royal Amethyst --- deep violet-purple, regal & luxurious --- */
[data-theme="royal-amethyst"] {
  --navy: #6D28D9;
  --navy-deep: #5B21B6;
  --royal: #7C3AED;
  --mid: #A78BFA;
  --sky: #C4B5FD;
  --teal: #6D28D9;
  --bg: #FAF5FF;
  --card: #FFFFFF;
  --card-hover: #F3EEFF;
  --line: rgba(109, 40, 217, 0.07);
  --line-light: rgba(109, 40, 217, 0.03);
  --ink: #1E0A3C;
  --ink-soft: #6B5B8A;
  --ink-faint: #A99BC4;
  --glass-bg: rgba(250, 245, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #6D28D9;
  --grad-hover: #5B21B6;
  --grad-soft: rgba(109, 40, 217, 0.04);
  --shadow-sm: 0 1px 3px rgba(30, 10, 60, 0.04), 0 1px 2px rgba(30, 10, 60, 0.02);
  --shadow-md: 0 4px 16px rgba(30, 10, 60, 0.06), 0 2px 4px rgba(30, 10, 60, 0.03);
  --shadow-lg: 0 12px 40px rgba(30, 10, 60, 0.08), 0 4px 12px rgba(30, 10, 60, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(30, 10, 60, 0.1), 0 6px 16px rgba(30, 10, 60, 0.05);
}

/* --- #14 Ocean Breeze --- cool cyan-teal, fresh & airy --- */
[data-theme="ocean-breeze"] {
  --navy: #0891B2;
  --navy-deep: #0E7490;
  --royal: #06B6D4;
  --mid: #67E8F9;
  --sky: #A5F3FC;
  --teal: #0891B2;
  --bg: #ECFEFF;
  --card: #FFFFFF;
  --card-hover: #E0FAFF;
  --line: rgba(8, 145, 178, 0.07);
  --line-light: rgba(8, 145, 178, 0.03);
  --ink: #083344;
  --ink-soft: #5A8A9A;
  --ink-faint: #99D5E5;
  --glass-bg: rgba(236, 254, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);
  --grad: #0891B2;
  --grad-hover: #0E7490;
  --grad-soft: rgba(8, 145, 178, 0.04);
  --shadow-sm: 0 1px 3px rgba(8, 51, 68, 0.04), 0 1px 2px rgba(8, 51, 68, 0.02);
  --shadow-md: 0 4px 16px rgba(8, 51, 68, 0.06), 0 2px 4px rgba(8, 51, 68, 0.03);
  --shadow-lg: 0 12px 40px rgba(8, 51, 68, 0.08), 0 4px 12px rgba(8, 51, 68, 0.04);
  --shadow-card-hover: 0 16px 48px rgba(8, 51, 68, 0.1), 0 6px 16px rgba(8, 51, 68, 0.05);
}

/* ================================================================
   Palette Picker — profile page
   ================================================================ */

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
}

.palette-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 1rem 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--card);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
}

.palette-card:hover {
  border-color: var(--mid);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.palette-card:active {
  transform: scale(0.97);
  transition-duration: 0.06s;
}

.palette-card.selected {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--grad-soft), var(--shadow-md);
}

.palette-card .check-mark {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: var(--transition-fast);
}

.palette-card.selected .check-mark {
  opacity: 1;
  transform: scale(1);
}

.palette-card .check-mark svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.palette-swatches {
  display: flex;
  gap: 3px;
  margin-bottom: 0.25rem;
}

.palette-swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.palette-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
  line-height: 1.2;
}

.palette-card.selected .palette-name {
  color: var(--navy);
  font-weight: 700;
}

/* Hidden radio for accessibility */
.palette-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Mobile palette grid */
@media (max-width: 480px) {
  .palette-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }
  .palette-card {
    padding: 0.85rem 0.5rem 0.7rem;
  }
  .palette-swatch {
    width: 18px;
    height: 18px;
  }
}

/* ================================================================
   WORK BOARD — Stage Tabs + Branch Accordion
   ================================================================ */

/* ----- Stage Tab Navigation ----- */
.board-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.25rem 0 0.75rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
}
.board-tabs::-webkit-scrollbar { display: none; }

.board-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.05rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
}
.board-tab:hover {
  background: var(--grad-soft);
  color: var(--navy);
}
.board-tab--active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  font-weight: 700;
}
.board-tab--active:hover {
  background: var(--navy-deep);
  color: #fff;
}

.board-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(0,0,0,0.06);
  color: var(--ink-faint);
  transition: all 0.2s ease;
}
.board-tab__count.has-items {
  background: var(--danger-tint);
  color: var(--danger);
}
.board-tab--active .board-tab__count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.board-tab--active .board-tab__count.has-items {
  background: rgba(255,255,255,0.3);
  color: #fff;
}

/* ----- Stats Strip ----- */
.board-stats {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.board-stat {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}
.board-stat__value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  line-height: 1;
}
.board-stat__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.board-stat.live .board-stat__value { color: #16A34A; }
.board-stat.attention .board-stat__value { color: var(--royal); }

/* ----- Board Header (Expand/Collapse) ----- */
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}
.board-header__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.02em;
}
.board-header__actions {
  display: flex;
  gap: 0.75rem;
}
.board-header__actions .btn-link {
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.board-header__actions .btn-link:hover {
  background: var(--grad-soft);
}

/* ----- Branch Accordion ----- */
.branch-groups {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.branch-group details {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}
.branch-group details[open] {
  box-shadow: var(--shadow-md);
}
.branch-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background 0.15s;
}
.branch-group__head::-webkit-details-marker { display: none; }
.branch-group__head:hover {
  background: var(--card-hover);
}
.branch-group__info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.branch-group__avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--grad-soft);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.branch-group__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.branch-group__tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.12rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(160, 78, 46, 0.08);
  color: #A04E2E;
  vertical-align: middle;
}
.branch-group__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.branch-group__count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-faint);
}
.branch-group__chevron {
  width: 18px;
  height: 18px;
  stroke: var(--ink-faint);
  transition: transform 0.25s ease;
}
.branch-group details[open] .branch-group__chevron {
  transform: rotate(180deg);
}
.branch-group__body {
  padding: 0 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Responsive: single-column tabs, smaller stats */
@media (max-width: 640px) {
  .board-tabs {
    gap: 0.2rem;
  }
  .board-tab {
    padding: 0.5rem 0.7rem;
    font-size: 0.74rem;
  }
  .board-stats {
    gap: 0.85rem;
  }
  .board-stat__value {
    font-size: 1.2rem;
  }
  .branch-group__head {
    padding: 0.7rem 0.9rem;
  }
  .branch-group__body {
    padding: 0 0.9rem 0.75rem;
  }
}

/* ── Priority Badges ─────────────────────────────────────────────────── */
.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  line-height: 1;
}

.priority-high {
  background: #FEF2F1;
  color: #C0392B;
  border: 1px solid rgba(192, 57, 43, 0.12);
}

.priority-medium {
  background: #FEF3E8;
  color: #C87941;
  border: 1px solid rgba(200, 121, 65, 0.12);
}

.priority-low {
  background: #F0F7F4;
  color: #5A8A6C;
  border: 1px solid rgba(90, 138, 108, 0.12);
}

/* ── Pin Button (Star Toggle) ────────────────────────────────────────── */
.pin-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  transition: all 0.2s ease;
  border-radius: 8px;
  flex-shrink: 0;
}

.pin-btn:hover {
  background: rgba(184, 92, 56, 0.06);
  color: var(--navy);
  transform: scale(1.1);
}

.pin-btn:active {
  transform: scale(0.95);
}

.pin-btn.is-pinned {
  color: var(--navy);
}

.pin-btn.is-pinned svg {
  fill: var(--navy);
}

/* ── Pinned Card Indicator ───────────────────────────────────────────── */
.video-card.is-pinned {
  border-left: 3px solid var(--navy);
  background: linear-gradient(135deg, rgba(184, 92, 56, 0.015) 0%, #FFFFFF 100%);
}

/* ── Priority Select in Forms ────────────────────────────────────────── */
.priority-select {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.priority-option {
  flex: 1;
  min-width: 80px;
}

.priority-option input[type="radio"] {
  display: none;
}

.priority-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--line);
  transition: all 0.2s ease;
  text-align: center;
}

.priority-option label:hover {
  border-color: var(--mid);
}

.priority-option input:checked + label {
  border-color: var(--navy);
  background: rgba(184, 92, 56, 0.06);
  color: var(--navy-deep);
}

.priority-option.high label { color: #C0392B; }
.priority-option.high input:checked + label { border-color: #C0392B; background: #FEF2F1; }
.priority-option.medium label { color: #C87941; }
.priority-option.medium input:checked + label { border-color: #C87941; background: #FEF3E8; }
.priority-option.low label { color: #5A8A6C; }
.priority-option.low input:checked + label { border-color: #5A8A6C; background: #F0F7F4; }

/* ── Priority in Detail Page ─────────────────────────────────────────── */
.priority-display {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.priority-display.high {
  background: #FEF2F1;
  color: #C0392B;
  border: 1px solid rgba(192, 57, 43, 0.15);
}

.priority-display.medium {
  background: #FEF3E8;
  color: #C87941;
  border: 1px solid rgba(200, 121, 65, 0.15);
}

.priority-display.low {
  background: #F0F7F4;
  color: #5A8A6C;
  border: 1px solid rgba(90, 138, 108, 0.15);
}

/* ── Task organization controls: priority + pinning ─────────────── */
.task-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.priority-control,
.pin-control-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.priority-control { position: relative; }

.priority-control__dot {
  position: absolute;
  left: 0.7rem;
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 12%, transparent);
  pointer-events: none;
  z-index: 1;
}

.priority-dropdown {
  min-height: 2.1rem;
  max-width: 10.5rem;
  border-radius: 10px;
  padding: 0.4rem 0.55rem 0.4rem 1.55rem;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 120ms ease;
}

.priority-dropdown:hover {
  border-color: color-mix(in srgb, var(--navy) 38%, transparent);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--navy) 12%, transparent);
}

.priority-dropdown:active { transform: translateY(1px); }

.priority-dropdown:focus-visible,
.pin-toggle:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 22%, transparent);
  outline: 2px solid transparent;
}

.priority-dropdown.priority-high {
  background: color-mix(in srgb, var(--navy-deep) 12%, var(--card));
  color: var(--navy-deep);
  border: 1px solid color-mix(in srgb, var(--navy-deep) 32%, transparent);
}

.priority-dropdown.priority-medium {
  background: color-mix(in srgb, var(--royal) 10%, var(--card));
  color: var(--navy);
  border: 1px solid color-mix(in srgb, var(--royal) 28%, transparent);
}

.priority-dropdown.priority-low {
  background: color-mix(in srgb, var(--sky) 18%, var(--card));
  color: var(--ink-soft);
  border: 1px solid color-mix(in srgb, var(--mid) 28%, transparent);
}

.task-stage-badge {
  min-height: 2.1rem;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  background: color-mix(in srgb, var(--royal) 10%, var(--card));
  color: var(--navy-deep);
  border: 1px solid color-mix(in srgb, var(--royal) 24%, transparent);
  border-radius: 9px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.pin-toggle {
  min-height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.38rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(49, 37, 31, 0.04);
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease,
    box-shadow 180ms ease, transform 120ms ease;
}

.pin-toggle__icon {
  width: 0.95rem;
  height: 0.95rem;
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  transition: fill 180ms ease, transform 180ms ease;
}

.pin-toggle:hover {
  color: var(--navy-deep);
  border-color: color-mix(in srgb, var(--navy) 32%, transparent);
  background: color-mix(in srgb, var(--royal) 8%, var(--card));
  box-shadow: 0 3px 10px color-mix(in srgb, var(--navy) 12%, transparent);
  transform: translateY(-1px);
}

.pin-toggle:active { transform: scale(0.97) translateY(1px); }

.pin-toggle.pinned {
  color: var(--navy-deep);
  border-color: color-mix(in srgb, var(--navy) 34%, transparent);
  background: color-mix(in srgb, var(--sky) 24%, var(--card));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 3px 10px color-mix(in srgb, var(--navy) 12%, transparent);
}

.pin-toggle.pinned .pin-toggle__icon {
  fill: var(--royal);
  stroke: var(--navy-deep);
  transform: rotate(-5deg) scale(1.04);
}

.pin-indicator {
  color: var(--royal);
  font-size: 0.85em;
  margin-right: 0.18rem;
}

.video-card.pinned-card {
  border-left: 3px solid var(--navy);
  background: linear-gradient(
    105deg,
    color-mix(in srgb, var(--sky) 18%, var(--card)) 0%,
    var(--card) 28%
  );
}

@media (max-width: 720px) {
  .video-card .top {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .priority-control { flex: 1 1 9rem; }

  .priority-dropdown {
    width: 100%;
    max-width: none;
  }
}

/* ================================================================
   PWA Install Banner — ported from the Logic Practice implementation
   ================================================================ */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-top: 1px solid rgba(184, 92, 56, 0.35);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  z-index: 10000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font);
}

.pwa-install-banner.show {
  transform: translateY(0);
}

/* The tab dock is fixed to the bottom too — lift the bar above it. */
.pwa-install-banner.above-nav {
  bottom: calc(4.6rem + env(safe-area-inset-bottom));
}

.pwa-install-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-install-banner-icon img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
}

.pwa-install-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-install-banner-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.pwa-install-banner-desc {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.3;
}

.pwa-install-btn {
  background: var(--grad);
  color: #fff;
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: var(--font);
}

.pwa-install-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(184, 92, 56, 0.35);
}

.pwa-install-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.pwa-install-close:hover {
  color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 480px) {
  .pwa-install-banner { padding: 0.7rem 0.8rem; gap: 0.6rem; }
  .pwa-install-banner-icon { width: 38px; height: 38px; }
  .pwa-install-banner-icon img { width: 28px; height: 28px; }
  .pwa-install-banner-title { font-size: 0.78rem; }
  .pwa-install-banner-desc { font-size: 0.65rem; }
  .pwa-install-btn { padding: 0.45rem 0.9rem; font-size: 0.72rem; }
}

/* iOS has no install API — Safari needs the Share-menu instructions. */
.pwa-ios-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(20, 12, 8, 0.45);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pwa-ios-backdrop.show { opacity: 1; }

.pwa-ios-sheet {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.4rem;
  margin-bottom: env(safe-area-inset-bottom);
}

.pwa-ios-sheet h2 { font-size: 1.1rem; margin: 0 0 0.25rem; letter-spacing: -0.02em; }
.pwa-ios-sheet ol { margin: 1rem 0; padding-left: 1.1rem; }
.pwa-ios-sheet li { font-size: 0.85rem; line-height: 1.6; margin-bottom: 0.5rem; }

/* Offline placeholder */
.offline-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  text-align: center;
  padding: 2rem 1.5rem;
}

.offline-mark {
  width: 76px;
  height: 76px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #fff;
  border: 0.5px solid var(--line);
  box-shadow: var(--shadow-sm);
  opacity: 0.85;
}

.offline-page h1 { font-size: 1.4rem; margin: 0.35rem 0 0; letter-spacing: -0.025em; }
.offline-page p { max-width: 34ch; font-size: 0.86rem; line-height: 1.55; margin: 0 0 0.5rem; }

/* ================================================================
   PENDING JOBS BOARD — multi-task kanban + mobile create sheet
   ================================================================ */

.jobs-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

/* ----- Sticky toolbar (title + Add Job always visible) ----- */
.jobs-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.jobs-toolbar-text h1 {
  margin: 0.1rem 0 0.25rem;
}
.jobs-toolbar-stats {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
  align-items: center;
}
.jobs-stat-sep { opacity: 0.55; }
.jobs-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.jobs-add-btn svg {
  width: 16px;
  height: 16px;
}

/* Mobile FAB — sits above bottom nav, always tappable */
.jobs-fab {
  display: none;
  position: fixed;
  right: 1rem;
  bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--navy, #1e2a4a);
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28), 0 2px 6px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.jobs-fab svg {
  width: 24px;
  height: 24px;
}
.jobs-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.32);
}
.jobs-fab:active {
  transform: scale(0.96);
}

/* ----- Create Job: backdrop + panel ----- */
.job-create-backdrop {
  display: none;
}
.job-create-panel[hidden],
.job-create-backdrop[hidden] {
  display: none !important;
}

/* Desktop / tablet: inline collapsible card */
.job-create-panel:not([hidden]) {
  display: block;
  margin-bottom: 1.25rem;
}
.job-create-sheet {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem 1.35rem;
  box-shadow: var(--shadow-md);
}
.job-create-sheet-handle {
  display: none;
}
.job-create-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.job-create-sheet-head h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.job-create-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
}
.job-create-close svg {
  width: 16px;
  height: 16px;
}
.job-create-close:hover {
  background: var(--card-hover);
  color: var(--ink);
}
.job-create-form {
  margin: 0;
}
.job-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1rem;
}
.job-form-full {
  grid-column: 1 / -1;
}
.job-create-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.1rem;
}
.job-create-form .form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}
.job-create-form textarea {
  width: 100%;
  min-height: 5rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
  font: inherit;
  background: var(--card);
  color: var(--ink);
}
.job-create-form textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30, 42, 74, 0.12);
}

/* ----- Category Tabs ----- */
.job-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.15rem 0 0.85rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.job-tabs::-webkit-scrollbar { display: none; }

.job-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  background: transparent;
  border: 1.5px solid transparent;
  flex-shrink: 0;
}
.job-tab:hover {
  background: var(--grad-soft);
  color: var(--navy);
}
.job-tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  font-weight: 700;
}
.job-tab.active:hover {
  background: var(--navy-deep);
  color: #fff;
}
.job-tab-icon {
  display: flex;
  align-items: center;
}
.job-tab-icon svg {
  width: 16px;
  height: 16px;
}
.job-tab-label {
  letter-spacing: -0.01em;
}
.job-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(0,0,0,0.06);
  color: var(--ink-faint);
}
.job-tab.active .job-tab-badge {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* ----- Board: single active status panel + responsive card grid ----- */

/* ----- Status tabs: segmented switcher with sliding pill ----- */
.job-status-tabs {
  --i: 0;
  --glide-dot: #C87941;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 30rem);
  padding: 0.28rem;
  margin: 0 0 1.1rem;
  background: color-mix(in srgb, var(--card-hover) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  touch-action: manipulation;
}
.job-status-glide {
  position: absolute;
  top: 0.28rem;
  bottom: 0.28rem;
  left: 0.28rem;
  width: calc((100% - 0.56rem) / 4);
  border-radius: 0.7rem;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--glide-dot) 38%, var(--line));
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.09);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
  pointer-events: none;
}
.job-status-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.4rem 0.5rem;
  border: none;
  background: transparent;
  border-radius: 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.job-status-tab:hover { color: var(--ink); }
.job-status-tab.is-active { color: var(--ink); font-weight: 700; }
.job-status-tab:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: -2px;
  border-radius: 0.7rem;
}
.job-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--col-dot);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.job-status-tab.is-active .job-status-dot { transform: scale(1.3); }
.job-status-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-status-count {
  min-width: 1.35rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink-faint);
  transition: background 0.25s ease, color 0.25s ease;
}
.job-status-tab.is-active .job-status-count {
  background: color-mix(in srgb, var(--col-dot) 16%, transparent);
  color: color-mix(in srgb, var(--col-dot) 78%, var(--ink));
}
@media (prefers-reduced-motion: reduce) {
  .job-status-glide { transition: none; }
}

.job-board {
  outline: none;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.job-board:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 6px;
  border-radius: 0.75rem;
}
.job-board a, .job-board button, .job-board input, .job-board form {
  user-select: text;
  -webkit-user-select: text;
}

.job-panel[hidden] { display: none; }
.job-panel.enter-right { animation: jobPanelInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.job-panel.enter-left { animation: jobPanelInLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes jobPanelInRight {
  from { opacity: 0; transform: translateX(2.2rem); }
  to { opacity: 1; transform: none; }
}
@keyframes jobPanelInLeft {
  from { opacity: 0; transform: translateX(-2.2rem); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .job-panel.enter-right, .job-panel.enter-left { animation: none; }
}

.job-panel-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.8rem;
  padding: 0 0.15rem;
}
.job-panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-panel-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 16%, transparent);
  flex-shrink: 0;
}
.job-panel-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-faint);
  background: rgba(0,0,0,0.05);
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 0.75rem;
  align-items: start;
}


/* ----- Job Card ----- */
.job-panel--pending { --panel-accent: #C87941; }
.job-panel--progress { --panel-accent: #2563EB; }
.job-panel--done { --panel-accent: #059669; }

.job-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.8rem 0.85rem;
  box-shadow: inset 3px 0 0 var(--panel-accent, transparent), var(--shadow-md);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  -webkit-user-drag: none;
}
.job-card:hover {
  box-shadow: inset 3px 0 0 var(--panel-accent, transparent), var(--shadow-lg);
  border-color: color-mix(in srgb, var(--navy) 22%, var(--line));
  transform: translateY(-1px);
}
/* Completed cards: same white card surface as everyone else */
.job-card--done {
  background: var(--card);
}
.job-card--cancelled {
  background: color-mix(in srgb, #FEE2E2 55%, var(--card));
  border-color: color-mix(in srgb, #DC2626 22%, var(--line));
  opacity: 0.9;
}
.job-card--cancelled .job-card-title {
  color: color-mix(in srgb, #991B1B 70%, var(--ink));
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, #DC2626 45%, transparent);
}
.job-card-cancel-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #B91C1C;
  background: color-mix(in srgb, #DC2626 12%, transparent);
  border: 1px solid color-mix(in srgb, #DC2626 28%, transparent);
}
.job-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}
.job-card-title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.35;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}
.job-card--done .job-card-title::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: #059669;
  box-shadow: 0 0 0 3px color-mix(in srgb, #059669 18%, transparent);
  vertical-align: middle;
  transform: translateY(-1px);
}

.job-card-desc {
  margin: 0 0 0.5rem;
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.job-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.55rem;
}
.job-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 600;
  max-width: 100%;
  min-width: 0;
}
.job-meta-item svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}
.job-meta-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 11rem;
}

.job-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line-light, var(--line));
}
.job-action-form {
  display: inline-flex;
  margin: 0;
}
.job-action-form--cancel {
  margin-left: auto;
}
.job-action-form--delete {
  margin-left: auto;
}
/* On a cancelled card the Delete button is the only action, so keep it left. */
.job-card-actions--cleanup .job-action-form--delete {
  margin-left: 0;
}
.job-advance-btn {
  font-size: 0.76rem !important;
  padding: 0.4rem 0.75rem !important;
  gap: 0.28rem !important;
  display: inline-flex !important;
  align-items: center;
}
.job-advance-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}
/* Cancel / Delete are labelled, clearly-visible outline buttons, not bare icons. */
.job-cancel-btn,
.job-delete-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  padding: 0.38rem 0.7rem !important;
}
.job-cancel-btn svg,
.job-delete-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}
.btn-danger-outline {
  background: var(--card);
  color: var(--danger);
  border: 0.5px solid color-mix(in srgb, var(--danger) 26%, transparent);
  box-shadow: var(--shadow-sm);
}
.btn-danger-outline:hover {
  background: var(--danger-tint);
  border-color: color-mix(in srgb, var(--danger) 42%, transparent);
  text-decoration: none;
  transform: translateY(-1px);
}
.job-delete-btn:hover {
  color: var(--danger) !important;
  background: var(--danger-tint) !important;
}

.btn-success {
  background: #059669;
  border-color: #059669;
  color: #fff;
}
.btn-success:hover {
  background: #047857;
  border-color: #047857;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}
.btn-ghost:hover {
  background: var(--grad-soft);
  color: var(--navy);
}

.job-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 3.2rem 1.25rem;
  border: 1.5px dashed var(--line);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--card) 60%, transparent);
  color: var(--ink-faint);
  text-align: center;
}
.job-empty svg {
  width: 30px;
  height: 30px;
  stroke: var(--ink-faint);
  fill: none;
  opacity: 0.5;
}
.job-empty p {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.job-empty-hint {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink-faint);
}

/* ----- Meeting job block ----- */
.job-meeting-fields-box {
  border: 1.5px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem 0.85rem;
  background: color-mix(in srgb, var(--card) 55%, transparent);
}
.job-meeting-fields-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}
.job-meeting-fields-label svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
}
.job-meeting-grid {
  gap: 0.85rem 0.9rem;
}
.job-mtg-full {
  grid-column: 1 / -1;
}

/* ----- Meeting card block ----- */
.job-meeting-block {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
  color: var(--ink-soft);
}
.job-meeting-line {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-soft);
  min-width: 0;
}
.job-meeting-line svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}
.job-meeting-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- Meeting participants ----- */
.job-meeting-participants {
  margin-bottom: 0.6rem;
}
.job-participants-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin-bottom: 0.32rem;
}
.job-participant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
}
.job-participant-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--panel-accent, #7C3AED) 12%, transparent);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--panel-accent, #7C3AED) 28%, transparent);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- Tablet: two-up card grid ----- */
@media (max-width: 1100px) and (min-width: 641px) {
  .job-grid {
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  }
  .job-card {
    padding: 0.7rem 0.75rem;
  }
}

/* ----- Mobile / small tablet: horizontal snap board + FAB + sheet ----- */
@media (max-width: 900px) {
  .jobs-toolbar {
    margin-bottom: 0.75rem;
  }
  .jobs-toolbar-text h1 {
    font-size: 1.45rem;
  }
  /* Keep toolbar Add Job visible; FAB is extra insurance */
  .jobs-add-btn {
    min-height: 44px;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .jobs-fab {
    display: inline-flex;
  }

  .job-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    overflow-x: visible;
    padding-bottom: 0.7rem;
    margin-bottom: 0.85rem;
  }
  .job-tab {
    flex: 0 0 calc((100% - 0.8rem) / 3);
    justify-content: center;
    padding: 0.52rem 0.4rem;
    font-size: 0.76rem;
  }
  .job-tab-icon svg {
    width: 14px;
    height: 14px;
  }

  /* Create form becomes a bottom sheet above the nav */
  .job-create-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 120;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  .job-create-panel:not([hidden]) {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 130;
    margin: 0;
    max-height: min(92dvh, 720px);
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  .job-create-sheet {
    border-radius: 1.1rem 1.1rem 0 0;
    border: 1px solid var(--line);
    border-bottom: none;
    max-height: min(92dvh, 720px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.55rem 1rem calc(1.15rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
  }
  .job-create-sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(0,0,0,0.14);
    margin: 0.15rem auto 0.65rem;
  }
  .job-form-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
  .job-create-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, var(--card) 70%, transparent);
    padding-top: 0.75rem;
    padding-bottom: 0.15rem;
  }
  .job-create-actions .btn {
    min-height: 44px;
    flex: 1 1 auto;
  }
  body.jobs-create-open {
    overflow: hidden;
  }
  body.jobs-create-open .jobs-fab {
    display: none;
  }
}

@media (max-width: 640px) {
  .jobs-toolbar {
    gap: 0.65rem;
  }
  .jobs-toolbar-stats {
    font-size: 0.8rem;
  }
  .job-grid {
    grid-template-columns: 1fr;
  }
  .job-status-tab {
    font-size: 0.76rem;
    gap: 0.35rem;
    min-height: 2.2rem;
  }
  .job-status-count {
    min-width: 1.2rem;
    padding: 0.06rem 0.36rem;
  }
  .job-card {
    padding: 0.72rem 0.78rem;
  }
  .job-card-title {
    font-size: 0.84rem;
  }
  .job-meta-text {
    max-width: 9.5rem;
  }
  /* Extra bottom space so last cards clear FAB + bottom nav */
  .jobs-page {
    padding-bottom: 5.5rem;
  }
}

@media (min-width: 901px) {
  .jobs-fab { display: none !important; }
}

/* ── Notification Bell ─────────────────────────────────────────────────────── */
.bell-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.bell-btn:hover {
  background: var(--card-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}
.bell-btn svg {
  width: 19px;
  height: 19px;
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #E02B2B;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card);
}

/* Dropdown panel */
.bell-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: bellPanelIn 0.18s ease;
}
/* The hidden attribute must win over the flex display above */
.bell-panel[hidden] {
  display: none;
}
@keyframes bellPanelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bell-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.bell-panel-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
}
.bell-mark-all {
  background: none;
  border: none;
  color: var(--navy);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.bell-mark-all:hover {
  background: var(--line-light);
}

.bell-list {
  overflow-y: auto;
  max-height: 340px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.bell-list::-webkit-scrollbar {
  width: 6px;
}
.bell-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}
.bell-list::-webkit-scrollbar-track {
  background: transparent;
}

.bell-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line-light);
  transition: background 0.15s;
}
.bell-item:last-child {
  border-bottom: none;
}
.bell-item:hover {
  background: var(--card-hover);
}
.bell-item.unread {
  background: color-mix(in srgb, var(--navy) 5%, transparent);
}
.bell-item.unread .bell-item-title {
  font-weight: 700;
}

.bell-item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1.4;
}
.bell-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.bell-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.bell-item-text {
  font-size: 0.74rem;
  color: var(--ink-soft, #6b5b4a);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.bell-item-time {
  font-size: 0.66rem;
  color: var(--ink-muted, #9a8a78);
  margin-top: 0.1rem;
}

.bell-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-muted, #9a8a78);
}

/* Mobile: full-width panel */
@media (max-width: 480px) {
  .bell-panel {
    position: fixed;
    top: auto;
    bottom: 70px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
}
