/* ============================================================
   KATMA · CRM — Liquid Glass Pastel design system
   Visual layer only. No markup logic / field / text changes.
   ============================================================ */

:root {
  color-scheme: light;

  /* --- pastel page background --- */
  --lg-bg:
    radial-gradient(circle at 8% 8%, rgba(255, 209, 190, 0.72) 0%, rgba(255, 209, 190, 0) 34%),
    radial-gradient(circle at 84% 0%, rgba(159, 187, 255, 0.72) 0%, rgba(159, 187, 255, 0) 35%),
    radial-gradient(circle at 86% 80%, rgba(193, 246, 239, 0.55) 0%, rgba(193, 246, 239, 0) 34%),
    radial-gradient(circle at 18% 92%, rgba(204, 188, 255, 0.42) 0%, rgba(204, 188, 255, 0) 30%),
    linear-gradient(135deg, #f7ece5 0%, #eff4ff 44%, #f9f2f9 100%);

  /* --- text --- */
  --lg-text-primary: #11172e;
  --lg-text-secondary: #38425c;
  --lg-text-muted: #717a94;
  --lg-text-soft: #9aa2b8;

  /* --- glass surfaces --- */
  --lg-glass: rgba(255, 255, 255, 0.48);
  --lg-glass-strong: rgba(255, 255, 255, 0.62);
  --lg-glass-soft: rgba(255, 255, 255, 0.34);
  --lg-input: rgba(255, 255, 255, 0.38);
  --lg-input-hover: rgba(255, 255, 255, 0.54);
  --lg-input-focus: rgba(255, 255, 255, 0.64);

  /* --- borders / dividers --- */
  --lg-border: rgba(255, 255, 255, 0.70);
  --lg-border-strong: rgba(255, 255, 255, 0.84);
  --lg-border-soft: rgba(255, 255, 255, 0.46);
  --lg-divider: rgba(129, 143, 172, 0.26);

  /* --- accents --- */
  --lg-cyan: #17d6d1;
  --lg-teal: #13b8a7;
  --lg-blue: #4aa8ff;
  --lg-violet: #8b5cf6;
  --lg-lavender: #b891ff;
  --lg-pink: #ff8edb;
  --lg-success: #0fb989;
  --lg-warning: #b7791f;
  --lg-danger: #e0574f;

  /* --- gradients --- */
  --lg-card-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0.38) 48%, rgba(255, 255, 255, 0.52) 100%);
  --lg-input-glass: linear-gradient(180deg, rgba(255, 255, 255, 0.56) 0%, rgba(255, 255, 255, 0.30) 100%);
  --lg-active-glow: linear-gradient(135deg, rgba(23, 214, 209, 0.24) 0%, rgba(139, 92, 246, 0.18) 52%, rgba(255, 142, 219, 0.10) 100%);
  --lg-gradient-primary: linear-gradient(135deg, #10d5c2 0%, #4aa8ff 48%, #8b5cf6 100%);
  --lg-gradient-active-segment: linear-gradient(135deg, rgba(139, 92, 246, 0.28) 0%, rgba(23, 214, 209, 0.28) 100%);
  --lg-gradient-calendar: linear-gradient(135deg, #13b8a7 0%, #49d5c7 100%);
  --lg-bottom-hint: linear-gradient(135deg, rgba(139, 92, 246, 0.16) 0%, rgba(74, 168, 255, 0.10) 55%, rgba(255, 255, 255, 0.30) 100%);

  /* --- radii --- */
  --lg-radius-card: 28px;
  --lg-radius-side: 26px;
  --lg-radius-section: 18px;
  --lg-radius-control: 14px;
  --lg-radius-chip: 16px;
  --lg-radius-button: 15px;
  --lg-radius-day: 10px;

  /* --- shadows --- */
  --lg-shadow-card: 0 30px 90px rgba(45, 55, 90, 0.18), 0 10px 30px rgba(45, 55, 90, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(255, 255, 255, 0.34);
  --lg-shadow-side: 0 28px 80px rgba(45, 55, 90, 0.17), 0 8px 24px rgba(45, 55, 90, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.92), inset 0 -1px 0 rgba(255, 255, 255, 0.30);
  --lg-shadow-input: 0 10px 26px rgba(45, 55, 90, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.78), inset 0 -1px 0 rgba(255, 255, 255, 0.28);
  --lg-shadow-input-hover: 0 14px 34px rgba(45, 55, 90, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.88);
  --lg-shadow-active: 0 0 0 1px rgba(23, 214, 209, 0.55), 0 0 26px rgba(23, 214, 209, 0.34), 0 0 34px rgba(139, 92, 246, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --lg-shadow-primary: 0 14px 32px rgba(74, 168, 255, 0.30), 0 8px 22px rgba(139, 92, 246, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.50);

  --lg-transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);

  font-family: Inter, Manrope, "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--lg-bg) fixed;
  color: var(--lg-text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- floating background orbs ---------- */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  animation: orbFloat 16s ease-in-out infinite alternate;
}

.orb-1 {
  top: -160px;
  left: -120px;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(255, 196, 170, 0.55) 0%, rgba(255, 196, 170, 0) 66%);
  filter: blur(26px);
  animation-duration: 15s;
}

.orb-2 {
  top: -180px;
  right: -140px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, rgba(130, 170, 255, 0.46) 0%, rgba(130, 170, 255, 0) 66%);
  filter: blur(30px);
  animation-duration: 19s;
  animation-direction: alternate-reverse;
}

.orb-3 {
  right: -120px;
  bottom: -180px;
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, rgba(23, 214, 209, 0.30) 0%, rgba(23, 214, 209, 0) 66%);
  filter: blur(32px);
  animation-duration: 17s;
}

.orb-4 {
  left: 12%;
  bottom: -200px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.24) 0%, rgba(139, 92, 246, 0) 62%);
  filter: blur(34px);
  animation-duration: 21s;
  animation-direction: alternate-reverse;
}

@keyframes orbFloat {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(14px, -12px, 0) scale(1.05);
  }
  100% {
    transform: translate3d(-10px, 10px, 0) scale(0.97);
  }
}

/* ---------- base form elements ---------- */
button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(23, 214, 209, 0.30);
  outline-offset: 2px;
}

/* ---------- shell / layout ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px 40px 40px;
  animation: shellIn 640ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding: 4px 4px 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--lg-text-secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lg-teal);
  box-shadow: 0 0 0 3px rgba(19, 184, 167, 0.18), 0 0 12px rgba(19, 184, 167, 0.55);
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 36px;
  font-weight: 780;
  letter-spacing: -0.035em;
  color: var(--lg-text-primary);
}

h2 {
  font-size: 18px;
  line-height: 24px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 15px;
  line-height: 22px;
  font-weight: 740;
  letter-spacing: -0.01em;
}

.section-head h2,
.summary h2,
.recurrence-head h3,
.stage-toolbar strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
  isolation: isolate;
}

/* ---------- glass cards ---------- */
.task-form,
.side-panel > section {
  position: relative;
  background: var(--lg-card-glass);
  -webkit-backdrop-filter: blur(24px) saturate(155%);
  backdrop-filter: blur(24px) saturate(155%);
  border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-card);
  box-shadow: var(--lg-shadow-card);
}

.task-form::before,
.side-panel > section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58) 0%, rgba(255, 255, 255, 0.04) 30%, rgba(23, 214, 209, 0.07) 72%, rgba(139, 92, 246, 0.10) 100%);
  opacity: 0.9;
}

.task-form > *,
.side-panel > section > * {
  position: relative;
  z-index: 1;
}

.task-form {
  padding: 26px 26px 24px;
  animation: cardIn 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow: visible;
}

.side-panel {
  display: grid;
  gap: 24px;
  position: sticky;
  top: 20px;
  z-index: 1;
}

.side-panel > section {
  padding: 24px;
  border-radius: var(--lg-radius-side);
  box-shadow: var(--lg-shadow-side);
  animation: sideIn 620ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 120ms;
}

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

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

.calendar-panel {
  display: grid;
  gap: 14px;
}

.task-form:has(.help-tip:hover),
.side-panel:has(.help-tip:hover),
.task-form:has(.range-control.is-interacting),
.task-form:has(.help-tip.open),
.side-panel:has(.help-tip.open) {
  z-index: 300;
}

.task-form > *:has(.help-tip:hover),
.side-panel > section:has(.help-tip:hover),
.field:has(.help-tip:hover),
.field-label:has(.help-tip:hover),
.stage-toolbar:has(.help-tip:hover),
.task-form > *:has(.range-control.is-interacting),
.field:has(.range-control.is-interacting),
.task-form > *:has(.help-tip.open),
.side-panel > section:has(.help-tip.open),
.field:has(.help-tip.open),
.field-label:has(.help-tip.open),
.stage-toolbar:has(.help-tip.open) {
  position: relative;
  z-index: 320;
  overflow: visible;
}

.calendar-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calendar-panel-body {
  display: grid;
  gap: 10px;
}

/* ---------- section separation ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--lg-divider);
}

.section-head:first-child {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.section-head h2 {
  color: var(--lg-text-primary);
}

.section-head span {
  color: var(--lg-text-muted);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- fields ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field.wide {
  grid-column: 1 / -1;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  color: var(--lg-text-secondary);
  font-size: 12px;
  font-weight: 650;
  line-height: 16px;
}

.field small {
  color: var(--lg-text-muted);
  font-size: 11px;
  font-weight: 550;
}

/* ---------- help tips ---------- */
.help-tip {
  position: relative;
  z-index: 5;
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(74, 168, 255, 0.30);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.48), rgba(74, 168, 255, 0.12));
  color: #3d6ee8;
  padding: 0;
  box-shadow: 0 0 14px rgba(74, 168, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: transform var(--lg-transition), box-shadow var(--lg-transition), background var(--lg-transition), border-color var(--lg-transition);
}

.help-tip-icon {
  display: block;
  font-family: Manrope, Inter, system-ui, sans-serif;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  transform: translateY(-0.5px);
}

.help-tip::before,
.help-tip::after {
  display: none;
}

.help-tip::before {
  content: "";
  top: calc(100% + 4px);
  left: 50%;
  width: 12px;
  height: 12px;
  border-left: 1px solid var(--lg-border);
  border-top: 1px solid var(--lg-border);
  background: rgba(255, 255, 255, 0.92);
  transform: translate(-50%, -2px) rotate(45deg);
}

.help-tip::after {
  content: attr(data-tooltip);
  top: calc(100% + 10px);
  left: 50%;
  width: 262px;
  max-width: calc(100vw - 48px);
  border: 1px solid var(--lg-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.90);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
  color: var(--lg-text-primary);
  padding: 12px 14px;
  box-shadow: 0 24px 60px rgba(45, 55, 90, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  transform: translate(-50%, -4px);
}

.help-tip:hover,
.help-tip.open {
  z-index: 1000;
  border-color: rgba(23, 214, 209, 0.48);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(23, 214, 209, 0.16));
  box-shadow: 0 0 20px rgba(23, 214, 209, 0.24), 0 0 18px rgba(139, 92, 246, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.90);
  color: #087e7d;
  transform: translateY(-1px);
}

.help-tip:hover::before,
.help-tip.open::before {
  display: none;
}

.help-tip:hover::after,
.help-tip.open::after {
  display: none;
}

.help-tooltip-layer {
  position: fixed;
  z-index: 10000;
  width: 262px;
  max-width: calc(100vw - 28px);
  border: 1px solid var(--lg-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
  color: var(--lg-text-primary);
  padding: 12px 14px;
  box-shadow: 0 24px 60px rgba(45, 55, 90, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.help-tooltip-layer::before {
  content: "";
  position: absolute;
  top: -6px;
  left: var(--tooltip-arrow-left, 50%);
  width: 12px;
  height: 12px;
  border-left: 1px solid var(--lg-border);
  border-top: 1px solid var(--lg-border);
  background: rgba(255, 255, 255, 0.92);
  transform: translateX(-50%) rotate(45deg);
}

.help-tooltip-layer.visible {
  opacity: 1;
  transform: translateY(0);
}

.duplicate-warning {
  border: 1px solid rgba(183, 121, 31, 0.28);
  border-radius: 12px;
  background: rgba(255, 244, 214, 0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--lg-warning);
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- inputs / selects / textareas ---------- */
input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--lg-border-soft);
  border-radius: var(--lg-radius-control);
  background: var(--lg-input-glass);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  color: var(--lg-text-primary);
  outline: none;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--lg-shadow-input);
  transition: background var(--lg-transition), border-color var(--lg-transition), box-shadow var(--lg-transition), transform var(--lg-transition);
}

textarea {
  min-height: 120px;
  padding: 14px 16px;
  line-height: 20px;
  resize: vertical;
}

#binaryResultDescription,
#recurrenceCustomRule {
  min-height: 96px;
}

input::placeholder,
textarea::placeholder {
  color: var(--lg-text-soft);
  font-weight: 500;
}

input:hover,
select:hover,
textarea:hover {
  background: var(--lg-input-hover);
  border-color: var(--lg-border-strong);
  box-shadow: var(--lg-shadow-input-hover);
}

input:focus,
select:focus,
textarea:focus {
  background: var(--lg-input-focus);
  border-color: rgba(23, 214, 209, 0.78);
  box-shadow: 0 0 0 4px rgba(23, 214, 209, 0.14), 0 0 28px rgba(23, 214, 209, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- weight range slider ---------- */
.range-control {
  position: relative;
  display: grid;
  align-items: center;
  border: 1px solid var(--lg-border-soft);
  border-radius: var(--lg-radius-section);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.40), rgba(74, 168, 255, 0.10));
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  min-height: 46px;
  height: 46px;
  padding: 0 14px;
  box-shadow: var(--lg-shadow-input);
}

.range-control.is-interacting {
  z-index: 1200;
}

.range-bubble {
  position: absolute;
  left: var(--range-progress, 44.444%);
  bottom: calc(100% + 10px);
  z-index: 1201;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 28px;
  border: 1px solid rgba(23, 214, 209, 0.32);
  border-radius: 999px;
  background: var(--lg-gradient-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(74, 168, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.46);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px) scale(0.96);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.range-control.is-interacting .range-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.range-slider {
  --range-progress: 44.444%;
  width: 100%;
  min-height: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.range-slider:hover,
.range-slider:focus {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.range-slider::-webkit-slider-runnable-track {
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(16, 213, 194, 0.92) 0%, rgba(74, 168, 255, 0.86) var(--range-progress), rgba(255, 255, 255, 0.38) var(--range-progress), rgba(255, 255, 255, 0.38) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74), 0 8px 18px rgba(45, 55, 90, 0.08);
}

.range-slider::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #d9faf4 42%, #b891ff 100%);
  box-shadow: 0 10px 24px rgba(74, 168, 255, 0.28), 0 0 20px rgba(23, 214, 209, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  margin-top: -8px;
  transition: transform var(--lg-transition), box-shadow var(--lg-transition);
  -webkit-appearance: none;
}

.range-slider:active::-webkit-slider-thumb {
  transform: scale(0.94);
  box-shadow: 0 8px 18px rgba(74, 168, 255, 0.24), 0 0 28px rgba(23, 214, 209, 0.34);
}

.range-slider::-moz-range-track {
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74), 0 8px 18px rgba(45, 55, 90, 0.08);
}

.range-slider::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(16, 213, 194, 0.92), rgba(74, 168, 255, 0.86));
}

.range-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #d9faf4 42%, #b891ff 100%);
  box-shadow: 0 10px 24px rgba(74, 168, 255, 0.28), 0 0 20px rgba(23, 214, 209, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.native-control-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ---------- custom select ---------- */
.custom-select,
.date-picker {
  position: relative;
}

.custom-select-trigger,
.date-picker-trigger {
  position: relative;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--lg-border-soft);
  border-radius: var(--lg-radius-control);
  background: var(--lg-input-glass);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  color: var(--lg-text-primary);
  padding: 0 44px 0 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
  box-shadow: var(--lg-shadow-input);
  transition: background var(--lg-transition), border-color var(--lg-transition), box-shadow var(--lg-transition), transform var(--lg-transition);
}

.custom-select-trigger {
  display: block;
  overflow: hidden;
  line-height: 44px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-picker-trigger {
  display: flex;
  align-items: center;
  line-height: 1.2;
}

.custom-select-trigger:hover,
.date-picker-trigger:hover {
  background: var(--lg-input-hover);
  border-color: var(--lg-border-strong);
  box-shadow: var(--lg-shadow-input-hover);
  transform: translateY(-1px);
}

.custom-select-trigger::after,
.date-picker-trigger::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--lg-text-muted);
  border-bottom: 2px solid var(--lg-text-muted);
  transform: translateY(-60%) rotate(45deg);
  transition: transform var(--lg-transition);
}

.custom-select.open .custom-select-trigger::after,
.date-picker.open .date-picker-trigger::after {
  transform: translateY(-20%) rotate(225deg);
}

.custom-select.open .custom-select-trigger,
.date-picker.open .date-picker-trigger {
  background: var(--lg-input-focus);
  border-color: rgba(23, 214, 209, 0.78);
  box-shadow: 0 0 0 4px rgba(23, 214, 209, 0.14), 0 0 28px rgba(23, 214, 209, 0.20);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: none;
  max-height: 272px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--lg-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
  box-shadow: 0 26px 60px rgba(45, 55, 90, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.custom-select.open .custom-select-menu {
  display: block;
  animation: menuIn 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.custom-select-option {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--lg-text-primary);
  padding: 0 12px;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
  transition: background var(--lg-transition), color var(--lg-transition);
}

.custom-select-option:hover {
  background: rgba(255, 255, 255, 0.6);
}

.custom-select-option.active {
  background: var(--lg-active-glow);
  color: #087e7d;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(23, 214, 209, 0.32);
}

/* ---------- calendar (rendered into side panel) ---------- */
.date-picker-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.date-picker-head strong {
  text-align: center;
  text-transform: capitalize;
  font-size: 14px;
  font-weight: 760;
  color: var(--lg-text-primary);
}

.date-picker-head button {
  min-height: 34px;
  border: 1px solid var(--lg-border-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--lg-text-primary);
  font-size: 20px;
  line-height: 1;
  transition: background var(--lg-transition), transform var(--lg-transition), border-color var(--lg-transition);
}

.date-picker-head button:hover {
  background: rgba(255, 255, 255, 0.62);
  border-color: var(--lg-border);
  transform: translateY(-1px);
}

.date-picker-week,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.date-picker-week {
  margin-bottom: 6px;
}

.date-picker-week span {
  color: var(--lg-text-muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.date-picker-grid span,
.date-picker-grid button {
  min-height: 36px;
}

.date-picker-grid button {
  border: 0;
  border-radius: var(--lg-radius-day);
  background: transparent;
  color: var(--lg-text-primary);
  font-size: 13px;
  font-weight: 700;
  transition: background var(--lg-transition), transform var(--lg-transition), box-shadow var(--lg-transition);
}

.date-picker-grid button:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.date-picker-grid button.today {
  color: #4c55c7;
  background: rgba(139, 92, 246, 0.16);
}

.date-picker-grid button.active {
  color: #fff;
  background: var(--lg-gradient-calendar);
  box-shadow: 0 12px 26px rgba(19, 184, 167, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.date-picker-grid button:disabled {
  cursor: not-allowed;
  color: var(--lg-text-soft);
  background: transparent;
  transform: none;
  opacity: 0.6;
}

/* ---------- segmented acceptance control ---------- */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.segment {
  min-height: 48px;
  border: 1px solid var(--lg-border-soft);
  border-radius: var(--lg-radius-button);
  background: rgba(255, 255, 255, 0.36);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  color: var(--lg-text-primary);
  font-size: 13px;
  font-weight: 760;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 8px 20px rgba(45, 55, 90, 0.06);
  transition: background var(--lg-transition), border-color var(--lg-transition), color var(--lg-transition), transform var(--lg-transition), box-shadow var(--lg-transition);
}

.segment:hover,
.choice-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(45, 55, 90, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.segment.active {
  background: var(--lg-gradient-active-segment);
  border-color: rgba(139, 92, 246, 0.8);
  color: #087e7d;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0 34px rgba(139, 92, 246, 0.30), 0 0 36px rgba(23, 214, 209, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  animation: selectionPulse 320ms ease;
}

/* ---------- business direction chips ---------- */
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.business-choice-row {
  padding-bottom: 2px;
}

.choice-button {
  min-height: 50px;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--lg-border-soft);
  border-radius: var(--lg-radius-chip);
  background: rgba(255, 255, 255, 0.38);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  color: var(--lg-text-primary);
  padding: 0 18px;
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(45, 55, 90, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.76);
  transition: background var(--lg-transition), border-color var(--lg-transition), color var(--lg-transition), transform var(--lg-transition), box-shadow var(--lg-transition);
}

.choice-button.active {
  background: linear-gradient(135deg, rgba(23, 214, 209, 0.24), rgba(139, 92, 246, 0.14));
  border-color: rgba(23, 214, 209, 0.85);
  color: #087e7d;
  box-shadow: 0 0 0 1px rgba(23, 214, 209, 0.35), 0 0 30px rgba(23, 214, 209, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  animation: selectionPulse 320ms ease;
}

@keyframes selectionPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(23, 214, 209, 0.28), 0 0 0 rgba(139, 92, 246, 0.24);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(23, 214, 209, 0.12), 0 0 34px rgba(139, 92, 246, 0.26);
  }
}

/* ---------- cyclic toggle ---------- */
.toggle-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--lg-border-soft);
  border-radius: var(--lg-radius-control);
  background: var(--lg-input-glass);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  padding: 0 16px;
  box-shadow: var(--lg-shadow-input);
  cursor: pointer;
  transition: background var(--lg-transition), border-color var(--lg-transition), box-shadow var(--lg-transition);
}

.toggle-row:hover {
  background: var(--lg-input-hover);
  border-color: var(--lg-border-strong);
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-control {
  width: 40px;
  height: 22px;
  position: relative;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(129, 143, 172, 0.32);
  box-shadow: inset 0 1px 3px rgba(45, 55, 90, 0.2);
  transition: background var(--lg-transition);
}

.toggle-control::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(45, 55, 90, 0.28);
  transition: transform var(--lg-transition);
}

.toggle-row input:checked + .toggle-control {
  background: var(--lg-gradient-primary);
  box-shadow: 0 0 18px rgba(74, 168, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.toggle-row input:checked + .toggle-control::after {
  transform: translateX(18px);
}

.toggle-text {
  color: var(--lg-text-primary);
  font-size: 13px;
  font-weight: 800;
}

/* ---------- nested glass panels ---------- */
.dynamic-panel {
  border: 1px solid var(--lg-border-soft);
  border-radius: var(--lg-radius-section);
  background: rgba(255, 255, 255, 0.24);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 10px 28px rgba(45, 55, 90, 0.07);
}

#recurrencePanel {
  margin-top: 24px;
}

.hidden {
  display: none !important;
}

/* ---------- stages ---------- */
.stage-toolbar,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stage-toolbar strong {
  font-size: 15px;
  font-weight: 740;
  color: var(--lg-text-primary);
}

.stages {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.stage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 92px;
  gap: 10px;
}

.percent-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  border: 1px solid var(--lg-border-soft);
  border-radius: var(--lg-radius-control);
  background: var(--lg-input-glass);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  box-shadow: var(--lg-shadow-input);
  overflow: hidden;
}

.percent-input:focus-within {
  border-color: rgba(23, 214, 209, 0.78);
  box-shadow: 0 0 0 4px rgba(23, 214, 209, 0.14), 0 0 24px rgba(23, 214, 209, 0.18);
}

.percent-input input {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding-right: 4px;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.percent-input input:hover {
  background: transparent;
  box-shadow: none;
}

.percent-input span {
  color: var(--lg-text-muted);
  font-size: 13px;
  font-weight: 750;
}

.stage-total {
  width: fit-content;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 0 auto;
  border: 1px solid rgba(15, 185, 137, 0.28);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.52), rgba(15, 185, 137, 0.12));
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  color: #087e68;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 24px rgba(15, 185, 137, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.stage-total.danger {
  border-color: rgba(224, 87, 79, 0.34);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.52), rgba(224, 87, 79, 0.12));
  color: var(--lg-danger);
  box-shadow: 0 10px 24px rgba(224, 87, 79, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

/* ---------- recurrence ---------- */
.recurrence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.recurrence-head h3 {
  color: var(--lg-text-primary);
}

.reset-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--lg-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  color: var(--lg-text-secondary);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 800;
  transition: background var(--lg-transition), border-color var(--lg-transition), color var(--lg-transition), transform var(--lg-transition), box-shadow var(--lg-transition);
}

.reset-link:hover {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(23, 214, 209, 0.5);
  color: #087e7d;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(23, 214, 209, 0.18);
}

.recurrence-preview-box {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  border: 1px solid rgba(139, 92, 246, 0.24);
  border-radius: var(--lg-radius-control);
  background: var(--lg-bottom-hint);
  color: #4c55c7;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.recurrence-preview-box strong {
  color: var(--lg-text-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.recurrence-preview-box span {
  line-height: 1.45;
}

/* ---------- form error ---------- */
.form-error {
  min-height: 0;
  margin: 10px 0 0;
  color: var(--lg-danger);
  font-size: 14px;
  font-weight: 650;
}

.form-error:empty {
  display: none;
}

/* ---------- actions / buttons ---------- */
.actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 2px;
}

.primary,
.secondary,
.ghost,
.icon-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--lg-radius-button);
  border: 1px solid transparent;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 780;
  transition: transform var(--lg-transition), box-shadow var(--lg-transition), background var(--lg-transition), border-color var(--lg-transition);
}

.primary {
  background: var(--lg-gradient-primary);
  background-size: 160% 160%;
  background-position: 0% 50%;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: var(--lg-shadow-primary);
}

.primary:hover {
  transform: translateY(-2px);
  background-position: 100% 50%;
  box-shadow: 0 18px 40px rgba(74, 168, 255, 0.36), 0 10px 26px rgba(139, 92, 246, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.primary:active {
  transform: translateY(0) scale(0.99);
}

.secondary {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.28));
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border-color: var(--lg-border-soft);
  color: var(--lg-text-primary);
  box-shadow: 0 10px 24px rgba(45, 55, 90, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.secondary:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.36));
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(45, 55, 90, 0.12), 0 0 18px rgba(139, 92, 246, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.ghost {
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--lg-border-soft);
  color: var(--lg-text-secondary);
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.42);
  color: var(--lg-text-primary);
  transform: translateY(-2px);
}

.secondary.small,
.small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 12px;
}

.icon-button {
  min-height: 44px;
  padding: 0 12px;
  color: var(--lg-text-secondary);
  background: rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-color: var(--lg-border-soft);
  font-size: 12px;
  font-weight: 700;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

/* ---------- status pill (header) ---------- */
.status-pill {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--lg-border-soft);
  background: rgba(255, 255, 255, 0.36);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  color: var(--lg-text-secondary);
  padding: 0 18px;
  font-size: 13px;
  font-weight: 760;
  box-shadow: 0 14px 34px rgba(45, 55, 90, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: border-color var(--lg-transition), box-shadow var(--lg-transition), transform var(--lg-transition);
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lg-text-soft);
  box-shadow: 0 0 10px rgba(129, 143, 172, 0.4);
}

.status-pill.ok {
  color: #087e7d;
  border-color: rgba(23, 214, 209, 0.4);
}

.status-pill.ok::before {
  background: var(--lg-teal);
  box-shadow: 0 0 0 3px rgba(19, 184, 167, 0.16), 0 0 12px rgba(19, 184, 167, 0.55);
}

.status-pill.danger {
  color: var(--lg-danger);
  border-color: rgba(224, 87, 79, 0.4);
}

.status-pill.danger::before {
  background: var(--lg-danger);
  box-shadow: 0 0 12px rgba(224, 87, 79, 0.5);
}

/* ---------- preview / summary ---------- */
.summary h2 {
  color: var(--lg-text-primary);
}

.summary dl {
  display: grid;
  gap: 0;
  margin: 14px 0 0;
}

.summary dl > div {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--lg-divider);
  padding: 14px 0;
}

.summary dl > div:first-child {
  padding-top: 4px;
}

.summary dl > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

dt {
  color: var(--lg-text-muted);
  font-size: 12px;
  font-weight: 600;
}

dd {
  display: grid;
  gap: 2px;
  margin: 0;
}

dd strong {
  font-size: 14px;
  font-weight: 760;
  color: var(--lg-text-primary);
}

dd span {
  color: #8b93aa;
  font-size: 11px;
  font-weight: 550;
  line-height: 1.4;
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .app-shell {
    padding: 24px;
  }

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

  .side-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 16px;
  }

  .topbar,
  .section-head,
  .stage-toolbar,
  .recurrence-head {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .segmented {
    grid-template-columns: 1fr;
  }

  .choice-button {
    flex: 1 1 44%;
  }

  .stage-row {
    grid-template-columns: 1fr;
  }

  .actions > button {
    width: 100%;
  }
}

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

/* ============================================================
   TASKS PAGE — toolbar, cards, list view
   ============================================================ */

/* --- page nav link (header area) --- */
.page-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--lg-border-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  color: var(--lg-text-secondary);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(45, 55, 90, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.76);
  transition: background var(--lg-transition), color var(--lg-transition), border-color var(--lg-transition), transform var(--lg-transition), box-shadow var(--lg-transition);
}

.page-nav-link:hover {
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(23, 214, 209, 0.44);
  color: #087e7d;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(23, 214, 209, 0.14);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* --- tasks toolbar --- */
.tasks-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

/* --- tabs --- */
.tasks-tabs {
  display: flex;
  gap: 5px;
  background: rgba(255, 255, 255, 0.30);
  border: 1px solid var(--lg-border-soft);
  border-radius: 999px;
  padding: 5px;
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 8px 20px rgba(45, 55, 90, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.tasks-tab {
  min-height: 34px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--lg-text-secondary);
  font-size: 13px;
  font-weight: 760;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background var(--lg-transition), color var(--lg-transition), box-shadow var(--lg-transition);
}

.tasks-tab.active {
  background: var(--lg-gradient-primary);
  color: #fff;
  box-shadow: 0 8px 22px rgba(74, 168, 255, 0.30), 0 4px 12px rgba(139, 92, 246, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.tasks-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.48);
  color: var(--lg-text-primary);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  font-size: 10px;
  font-weight: 800;
}

.tasks-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.24);
}

/* --- view toggle --- */
.view-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.30);
  border: 1px solid var(--lg-border-soft);
  border-radius: 999px;
  padding: 5px;
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 8px 20px rgba(45, 55, 90, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.view-btn {
  width: 36px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--lg-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--lg-transition), color var(--lg-transition), box-shadow var(--lg-transition);
}

.view-btn.active {
  background: rgba(255, 255, 255, 0.72);
  color: var(--lg-text-primary);
  box-shadow: 0 4px 12px rgba(45, 55, 90, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.90);
}

.view-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.44);
  color: var(--lg-text-secondary);
}

/* --- loading state --- */
.tasks-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--lg-text-muted);
  font-size: 14px;
  font-weight: 650;
}

/* --- empty state --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 72px 32px;
  text-align: center;
  background: var(--lg-card-glass);
  -webkit-backdrop-filter: blur(24px) saturate(155%);
  backdrop-filter: blur(24px) saturate(155%);
  border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-card);
  box-shadow: var(--lg-shadow-card);
}

.empty-state__icon {
  font-size: 44px;
  opacity: 0.50;
  line-height: 1;
}

.empty-state__text {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--lg-text-muted);
  max-width: 280px;
  line-height: 1.55;
}

/* --- tasks grid (cards view) --- */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
  gap: 18px;
}

/* --- task card --- */
.task-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--lg-card-glass);
  -webkit-backdrop-filter: blur(24px) saturate(155%);
  backdrop-filter: blur(24px) saturate(155%);
  border: 1px solid var(--lg-border);
  border-radius: 22px;
  box-shadow: var(--lg-shadow-card);
  padding: 18px 20px 16px;
  transition: transform var(--lg-transition), box-shadow var(--lg-transition);
  overflow: hidden;
}

.task-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.58) 0%, rgba(255, 255, 255, 0.04) 30%, rgba(23, 214, 209, 0.07) 72%, rgba(139, 92, 246, 0.10) 100%);
  opacity: 0.8;
}

.task-card > * {
  position: relative;
  z-index: 1;
}

.task-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 36px 100px rgba(45, 55, 90, 0.20), 0 12px 34px rgba(45, 55, 90, 0.12), 0 0 28px rgba(23, 214, 209, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.task-card--draft {
  border-color: rgba(183, 121, 31, 0.26);
}

.task-card--draft::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.56) 0%, rgba(255, 244, 200, 0.22) 100%);
}

/* --- card header: type pill + status badge --- */
.task-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- task type pill --- */
.task-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.tt-strategic {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(74, 168, 255, 0.12));
  border: 1px solid rgba(139, 92, 246, 0.32);
  color: #5b33cc;
}

.tt-operational {
  background: linear-gradient(135deg, rgba(23, 214, 209, 0.14), rgba(74, 168, 255, 0.10));
  border: 1px solid rgba(23, 214, 209, 0.28);
  color: #087e7d;
}

/* --- status badge --- */
.task-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.st-planned    { background: rgba(74, 168, 255, 0.12);  border: 1px solid rgba(74, 168, 255, 0.26);  color: #2562cc; }
.st-done       { background: rgba(15, 185, 137, 0.12);  border: 1px solid rgba(15, 185, 137, 0.28);  color: #087e68; }
.st-progress   { background: rgba(23, 214, 209, 0.12);  border: 1px solid rgba(23, 214, 209, 0.28);  color: #087e7d; }
.st-fail       { background: rgba(224, 87, 79, 0.11);   border: 1px solid rgba(224, 87, 79, 0.26);   color: #b83028; }
.st-cancel     { background: rgba(129, 143, 172, 0.11); border: 1px solid rgba(129, 143, 172, 0.22); color: #4a5270; }
.st-frozen     { background: rgba(100, 130, 200, 0.11); border: 1px solid rgba(100, 130, 200, 0.22); color: #3a5490; }
.st-wait       { background: rgba(255, 180, 50, 0.12);  border: 1px solid rgba(255, 180, 50, 0.26);  color: #8a5e00; }
.st-approval   { background: rgba(139, 92, 246, 0.12);  border: 1px solid rgba(139, 92, 246, 0.26);  color: #5b33cc; }
.st-draft      { background: rgba(183, 121, 31, 0.12);  border: 1px solid rgba(183, 121, 31, 0.26);  color: var(--lg-warning); }

/* --- card title --- */
.task-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.32;
  color: var(--lg-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- card meta (employee + period) --- */
.task-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: var(--lg-text-muted);
  font-weight: 600;
  flex-wrap: wrap;
}

.task-card__sep {
  opacity: 0.38;
}

/* --- direction chip --- */
.direction-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--lg-border-soft);
  color: var(--lg-text-secondary);
  font-size: 11px;
  font-weight: 700;
}

/* --- card divider --- */
.task-card__divider {
  height: 1px;
  background: var(--lg-divider);
  margin: 1px 0;
}

/* --- weight row --- */
.task-card__weight {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weight-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--lg-text-muted);
  flex: 0 0 auto;
  width: 28px;
}

.weight-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--lg-text-secondary);
  flex: 0 0 auto;
  min-width: 14px;
}

/* --- weight dots --- */
.weight-dots {
  display: flex;
  gap: 3.5px;
  align-items: center;
  flex: 1 1 auto;
}

.wd {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(129, 143, 172, 0.20);
  border: 1px solid rgba(129, 143, 172, 0.14);
  flex: 0 0 auto;
  transition: background var(--lg-transition);
}

.wd--on {
  background: linear-gradient(135deg, #10d5c2 0%, #4aa8ff 100%);
  border-color: transparent;
  box-shadow: 0 0 5px rgba(23, 214, 209, 0.36);
}

/* --- completion bar --- */
.completion-wrap {
  display: grid;
  gap: 5px;
}

.completion-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.completion-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--lg-text-muted);
}

.completion-pct {
  font-size: 11px;
  font-weight: 800;
  color: var(--lg-text-secondary);
}

.completion-bar {
  height: 5px;
  background: rgba(129, 143, 172, 0.16);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(129, 143, 172, 0.08);
}

.completion-fill {
  height: 100%;
  background: var(--lg-gradient-primary);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* --- card footer --- */
.task-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 1px;
}

.task-card__code {
  font-size: 11px;
  font-weight: 700;
  color: var(--lg-text-soft);
  letter-spacing: 0.03em;
}

.task-card__continue {
  font-size: 12px;
  font-weight: 800;
  color: #087e7d;
  text-decoration: none;
  transition: color var(--lg-transition);
}

.task-card__continue:hover {
  color: var(--lg-violet);
}

/* --- list view --- */
.tasks-list {
  display: grid;
  gap: 8px;
}

.task-row {
  display: grid;
  grid-template-columns: 28px 48px minmax(0, 1fr) 130px auto auto;
  align-items: center;
  gap: 14px;
  background: var(--lg-card-glass);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--lg-border);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(45, 55, 90, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  padding: 12px 18px;
  transition: transform var(--lg-transition), box-shadow var(--lg-transition);
}

.task-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(45, 55, 90, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.task-row--draft {
  border-color: rgba(183, 121, 31, 0.22);
}

.task-row__type {
  font-size: 17px;
  text-align: center;
  line-height: 1;
}

.task-row__code {
  font-size: 11px;
  font-weight: 800;
  color: var(--lg-text-soft);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.task-row__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-row__title {
  font-size: 14px;
  font-weight: 760;
  color: var(--lg-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row__sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--lg-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row__direction {
  font-size: 11px;
  font-weight: 700;
  color: var(--lg-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row__weight {
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-row__status {
  display: flex;
  justify-content: flex-end;
}

.task-row__continue {
  font-size: 12px;
  font-weight: 800;
  color: #087e7d;
  text-decoration: none;
  white-space: nowrap;
}

/* --- drafts section labels --- */
.drafts-section-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--lg-text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-left: 4px;
}

.drafts-section-label--server {
  margin-top: 28px;
}

/* --- tasks page responsive --- */
@media (max-width: 900px) {
  .task-row {
    grid-template-columns: 28px 44px minmax(0, 1fr) auto auto;
  }
  .task-row__direction {
    display: none;
  }
}

@media (max-width: 640px) {
  .tasks-toolbar {
    gap: 10px;
  }
  .tasks-grid {
    grid-template-columns: 1fr;
  }
  .task-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 10px;
  }
  .task-row__code,
  .task-row__direction,
  .task-row__weight {
    display: none;
  }
}
