:root {
  --ink: #10161c;
  --ink-soft: #1b242e;
  --canvas: #e7ecef;
  --panel: #f7f9fa;
  --line: rgba(16, 22, 28, 0.08);
  --muted: #5d6a75;
  --text: #182028;
  --accent: #d9772f;
  --accent-deep: #b85a1a;
  --sea: #1f7a6c;
  --sea-soft: #d7efe9;
  --warn: #c45c26;
  --shadow: 0 18px 40px rgba(16, 22, 28, 0.12);
  --radius: 14px;
  --font-ui: "Figtree", sans-serif;
  --font-display: "Syne", sans-serif;
  --sidebar: 248px;
  --detail: 360px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(217, 119, 47, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(31, 122, 108, 0.16), transparent 50%),
    linear-gradient(160deg, #dfe7ea 0%, var(--canvas) 45%, #d5dde3 100%);
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  gap: 0;
  animation: appIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: grid-template-columns 0.25s ease;
}

.app.has-detail {
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--detail);
}

@keyframes appIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1rem 1rem;
  color: #f3f6f8;
  background:
    linear-gradient(180deg, rgba(217, 119, 47, 0.12), transparent 28%),
    linear-gradient(165deg, #121920 0%, var(--ink) 55%, #0c1218 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.55rem 1.4rem;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background:
    linear-gradient(135deg, var(--accent) 0%, #f0b27a 45%, var(--sea) 100%);
  box-shadow: 0 0 0 4px rgba(217, 119, 47, 0.15);
  position: relative;
  animation: markPulse 3.2s ease-in-out infinite;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px 6px 7px 11px;
  border-right: 2px solid rgba(16, 22, 28, 0.85);
  border-bottom: 2px solid rgba(16, 22, 28, 0.85);
  transform: rotate(-45deg);
}

@keyframes markPulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(217, 119, 47, 0.12);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(217, 119, 47, 0.2);
  }
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0.78rem 0.85rem;
  color: rgba(243, 246, 248, 0.72);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.is-active {
  background: rgba(217, 119, 47, 0.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 47, 0.35);
}

.nav-badge {
  margin-left: auto;
  min-width: 1.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #111;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.owner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem;
}

.owner-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--sea), #2ea090);
  font-weight: 700;
  font-size: 0.78rem;
}

.owner strong {
  display: block;
  font-size: 0.92rem;
}

.owner span {
  color: rgba(243, 246, 248, 0.55);
  font-size: 0.78rem;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.25rem 1.35rem 1rem;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  animation: rise 0.65s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 2.4vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.topbar-hint {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: min(260px, 42vw);
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.search svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.seg {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.seg-btn.is-active {
  background: var(--ink);
  color: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 10px 24px rgba(184, 90, 26, 0.28);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: rgba(16, 22, 28, 0.05);
  color: var(--text);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  animation: rise 0.65s 0.14s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.metric {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.metric-accent {
  background: linear-gradient(145deg, rgba(217, 119, 47, 0.16), rgba(255, 255, 255, 0.55));
  border-color: rgba(217, 119, 47, 0.28);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.filters {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  animation: rise 0.65s 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chip:hover {
  color: var(--text);
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 0.75rem;
  overflow: auto;
  padding-bottom: 0.5rem;
  flex: 1;
  animation: rise 0.7s 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.board.is-dragging {
  cursor: grabbing;
}

.column {
  min-width: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.55rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.column.is-drop-target {
  background: rgba(31, 122, 108, 0.08);
  border-color: rgba(31, 122, 108, 0.35);
  box-shadow: inset 0 0 0 1px rgba(31, 122, 108, 0.12);
}

.column.is-drop-active {
  background: rgba(217, 119, 47, 0.12);
  border-color: rgba(217, 119, 47, 0.55);
  box-shadow: inset 0 0 0 1px rgba(217, 119, 47, 0.18), 0 12px 28px rgba(184, 90, 26, 0.12);
  transform: translateY(-2px);
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.2rem 0.35rem;
}

.column-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.92rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.column-count {
  min-width: 1.5rem;
  height: 1.5rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(16, 22, 28, 0.06);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.column-dropzone {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 180px;
  padding: 0.15rem;
  border-radius: 14px;
  transition: background 0.2s ease;
}

.column.is-drop-active .column-dropzone {
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(217, 119, 47, 0.05),
      rgba(217, 119, 47, 0.05) 8px,
      rgba(217, 119, 47, 0.1) 8px,
      rgba(217, 119, 47, 0.1) 16px
    );
}

.column-empty {
  margin: auto 0;
  padding: 1.1rem 0.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1.5px dashed rgba(16, 22, 28, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.column.is-drop-active .column-empty {
  border-color: rgba(217, 119, 47, 0.55);
  color: var(--accent-deep);
  background: rgba(255, 255, 255, 0.55);
}

.lead {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 0.85rem 0.9rem 0.9rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
  animation: cardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.lead:active {
  cursor: grabbing;
}

.lead:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(217, 119, 47, 0.35);
}

.lead.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 47, 0.18);
}

.lead.is-dragging {
  opacity: 0.35;
  transform: scale(0.97);
  box-shadow: none;
  border-style: dashed;
}

.lead-ghost {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  width: 230px;
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(217, 119, 47, 0.45);
  box-shadow: 0 22px 48px rgba(16, 22, 28, 0.22);
  transform: rotate(2deg) scale(1.03);
  opacity: 0.96;
}

.drop-indicator {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--sea));
  box-shadow: 0 0 0 3px rgba(217, 119, 47, 0.15);
  margin: -0.15rem 0;
  animation: indicatorPulse 0.9s ease-in-out infinite;
}

@keyframes indicatorPulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.lead-handle {
  display: flex;
  gap: 3px;
  margin-bottom: 0.45rem;
  opacity: 0.35;
}

.lead-handle span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 6px 0 0 var(--muted), 12px 0 0 var(--muted), 0 6px 0 var(--muted), 6px 6px 0 var(--muted), 12px 6px 0 var(--muted);
}

.lead:hover .lead-handle {
  opacity: 0.7;
}

.lead-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.lead-company {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.lead-value {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--sea);
  font-size: 0.9rem;
  white-space: nowrap;
}

.lead-name {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.lead-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--sea-soft);
  color: var(--sea);
  font-size: 0.72rem;
  font-weight: 700;
}

.tag.is-outbound {
  background: rgba(217, 119, 47, 0.14);
  color: var(--accent-deep);
}

.tag.is-partner {
  background: rgba(27, 36, 46, 0.08);
  color: var(--ink-soft);
}

.tag.is-event {
  background: #efe4d8;
  color: #8a4b1f;
}

.lead-due {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.lead-due.is-late {
  color: var(--warn);
}

.list {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  animation: rise 0.5s ease both;
}

.list-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.7fr 0.7fr 0.9fr;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.list-row:hover,
.list-row.is-selected {
  background: rgba(217, 119, 47, 0.08);
}

.list-select {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.stage-select select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.stage-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.stage-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.stage-pill:hover {
  color: var(--text);
  border-color: rgba(217, 119, 47, 0.35);
}

.stage-pill.is-current {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.stage-rail-hint {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.7fr 0.7fr 0.9fr;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: rgba(247, 249, 250, 0.95);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.is-hidden {
  display: none !important;
}

.detail {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 249, 250, 0.95)),
    var(--panel);
  border-left: 1px solid var(--line);
  padding: 1.25rem;
  overflow: auto;
  min-width: 0;
}

.detail.is-empty {
  display: none;
}

.detail-empty {
  display: none;
}

.detail-empty-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.5rem;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(217, 119, 47, 0.35), rgba(31, 122, 108, 0.35));
  animation: markPulse 3.2s ease-in-out infinite;
}

.detail-empty h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.detail-empty p {
  margin: 0;
  max-width: 24ch;
  line-height: 1.45;
  justify-self: center;
}

.detail-body {
  animation: panelIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.detail-head h2 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.detail-head p {
  margin: 0;
  color: var(--muted);
}

.close-detail {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  color: var(--muted);
}

.detail-block {
  margin-bottom: 1.1rem;
}

.detail-block h3 {
  margin: 0 0 0.55rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.kv {
  display: grid;
  gap: 0.45rem;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.kv span {
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 0.7rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 0.65rem;
}

.timeline-item i {
  width: 10px;
  height: 10px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(217, 119, 47, 0.15);
}

.timeline-item strong {
  display: block;
  font-size: 0.9rem;
}

.timeline-item span {
  color: var(--muted);
  font-size: 0.8rem;
}

.detail-actions {
  display: grid;
  gap: 0.5rem;
}

.detail-actions .btn {
  justify-content: center;
}

.btn-secondary {
  background: var(--ink);
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 40;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

.modal {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(520px, calc(100vw - 2rem));
  box-shadow: var(--shadow);
  background: #fff;
}

.modal::backdrop {
  background: rgba(16, 22, 28, 0.45);
  backdrop-filter: blur(4px);
}

.modal form {
  padding: 1.25rem;
}

.modal header h2 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.modal header p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-grid label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.form-grid input,
.form-grid select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #f8fafb;
  color: var(--text);
}

.modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

@media (max-width: 1180px) {
  :root {
    --sidebar: 220px;
    --detail: 320px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-row,
  .list-head {
    grid-template-columns: 1.2fr 1fr 0.7fr;
  }

  .list-row > :nth-child(n + 4),
  .list-head > :nth-child(n + 4) {
    display: none;
  }
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    min-height: 100dvh;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    overflow-x: auto;
  }

  .brand {
    padding: 0;
  }

  .nav {
    flex-direction: row;
    flex: 1;
  }

  .nav-item span.nav-badge {
    margin-left: 0.35rem;
  }

  .sidebar-foot {
    border: 0;
    padding: 0;
    margin: 0;
  }

  .owner div {
    display: none;
  }

  .main {
    min-height: 70vh;
  }

  .detail {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 320px;
  }

  .detail.is-empty {
    display: none;
    min-height: 0;
  }

  .board {
    grid-auto-flow: column;
    grid-template-columns: repeat(5, minmax(230px, 80vw));
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .search {
    min-width: 0;
    flex: 1;
  }
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .seg {
    display: none;
  }
}

.logout-form {
  margin-top: 0.65rem;
  padding: 0 0.55rem;
}

.btn-logout {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(243, 246, 248, 0.8);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 1.5rem;
}

.auth-shell {
  width: min(420px, 100%);
}

.auth-card {
  padding: 1.6rem 1.45rem 1.35rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.auth-brand {
  padding: 0 0 1rem;
  color: var(--ink);
}

.auth-brand .brand-name {
  color: var(--ink);
}

.auth-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}

.auth-copy {
  margin: 0.4rem 0 1rem;
  color: var(--muted);
  line-height: 1.45;
}

.auth-error {
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: rgba(196, 92, 38, 0.12);
  color: var(--warn);
  font-weight: 600;
  font-size: 0.9rem;
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.auth-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: #fff;
  color: var(--text);
}

.auth-remember {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  grid-template-columns: none !important;
  font-weight: 500 !important;
}

.auth-submit {
  justify-content: center;
  margin-top: 0.25rem;
}

.auth-roles {
  margin: 1rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.form-span {
  grid-column: 1 / -1;
}

.form-grid textarea,
.activity-form textarea,
.activity-form input,
.activity-form select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #f8fafb;
  color: var(--text);
  width: 100%;
  font: inherit;
}

.activity-form {
  display: grid;
  gap: 0.5rem;
}

.act-type {
  color: var(--sea);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.act-body {
  margin: 0.25rem 0;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.4;
}

.timeline-item i.type-call {
  background: #2f6fed;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.15);
}

.timeline-item i.type-task {
  background: var(--accent);
}

.btn-danger {
  background: #b42318;
  color: #fff;
}

.btn-ghost-danger {
  background: transparent;
  color: #b42318;
  border: 1px solid rgba(180, 35, 24, 0.25);
}

.btn-ghost-danger:hover {
  background: rgba(180, 35, 24, 0.08);
}

.chip-archive.is-active {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.field-label {
  display: inline-block;
  line-height: 1.2;
}

.req {
  display: inline;
  color: #b42318;
  font-weight: 700;
  margin-left: 0.2rem;
}

.form-grid label.is-invalid-label {
  color: #b42318;
}

.form-grid input.is-invalid,
.form-grid select.is-invalid,
.form-grid textarea.is-invalid {
  border-color: #b42318 !important;
  background: #fff5f5 !important;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.15);
}

.form-error {
  margin: 0.75rem 0 0;
  color: #b42318;
  font-size: 0.86rem;
  font-weight: 600;
}
