:root {
  --bg-cream: #f8f0e4;
  --bg-sky: #dceef2;
  --ink: #1f3440;
  --muted: #5b7077;
  --panel: #ffffffd9;
  --border: #d0dde1;
  --brand: #0f7f8d;
  --brand-soft: #d9f4f2;
  --accent: #f4b942;
  --danger: #d14a4a;
  --shadow: 0 20px 45px rgba(16, 42, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 10%, #ffffffab 0 16%, transparent 44%),
    radial-gradient(circle at 82% 18%, #f6d9a461 0 14%, transparent 45%),
    linear-gradient(160deg, var(--bg-cream) 0%, #edf9f3 52%, var(--bg-sky) 100%);
  min-height: 100vh;
}

body.theme-dark {
  --bg-cream: #0d1419;
  --bg-sky: #0f1a22;
  --ink: #e6f0f5;
  --muted: #98acb8;
  --panel: #111b22de;
  --border: #273946;
  --brand: #2ab8c6;
  --brand-soft: #15313b;
  --accent: #f2bd63;
  --danger: #e76464;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
  background:
    radial-gradient(circle at 12% 8%, #2bb9c81f 0 20%, transparent 52%),
    radial-gradient(circle at 86% 14%, #f2bd631c 0 16%, transparent 50%),
    linear-gradient(160deg, var(--bg-cream) 0%, #0d161d 50%, var(--bg-sky) 100%);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
}

p {
  margin: 0;
}

.sky-scene {
  position: fixed;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  --moon-x: -20%;
  --moon-y: 72%;
  --moon-rotation: 0deg;
  --star-rotation: 0deg;
  --moon-opacity: 0;
  --stars-opacity: 0;
  --glow-opacity: 0;
  --moon-phase-shadow-shift: 0%;
  --moon-phase-shadow-opacity: 0.85;
  transition: opacity 360ms ease;
}

body.theme-enhanced .sky-scene {
  opacity: 1;
  visibility: visible;
}

.sky-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 16%, #ffffff52 0, #ffffff00 54%);
  opacity: 0.5;
}

.sky-scene.is-visible::before {
  opacity: 0.8;
}

.sky-stars {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  transform: rotate(var(--star-rotation));
  opacity: var(--stars-opacity);
  transition: transform 88s ease, opacity 1.4s ease;
}

body:not(.theme-dark) .sky-stars {
  opacity: 0 !important;
}

.sky-star {
  position: absolute;
  border-radius: 999px;
  background: #fff9da;
  box-shadow: 0 0 8px #fff7be80;
  animation: sky-star-twinkle 20s ease-in-out infinite;
}

.sky-clouds {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.sky-cloud {
  position: absolute;
  left: -36vw;
  width: clamp(150px, 18vw, 340px);
  height: clamp(46px, 5.8vw, 112px);
  border-radius: 999px;
  opacity: var(--cloud-opacity, 0.2);
  transform: translateX(-30vw) scale(var(--cloud-scale, 1));
  animation: sky-cloud-drift var(--cloud-duration, 320s) linear infinite;
  animation-delay: var(--cloud-delay, 0s);
  background: linear-gradient(180deg, #ffffffad 0, #ffffff45 100%);
  box-shadow:
    inset 0 0 12px #ffffff4f,
    0 0 18px #ffffff38;
}

.sky-cloud::before,
.sky-cloud::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: inherit;
}

.sky-cloud::before {
  width: 36%;
  height: 72%;
  left: 14%;
  top: -32%;
}

.sky-cloud::after {
  width: 44%;
  height: 82%;
  right: 12%;
  top: -38%;
}

.sky-glow {
  position: absolute;
  width: 36vw;
  min-width: 240px;
  aspect-ratio: 1;
  border-radius: 50%;
  left: var(--moon-x);
  top: var(--moon-y);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #fff6be6e 0, #fff6be17 44%, #fff6be00 72%);
  opacity: var(--glow-opacity);
  transition: left 108s linear, top 108s linear, opacity 1.3s ease;
}


.sky-moon {
  position: absolute;
  left: var(--moon-x);
  top: var(--moon-y);
  width: clamp(82px, 9vw, 146px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  transform: translate(-50%, -50%) rotate(var(--moon-rotation));
  background:
    radial-gradient(circle at 34% 30%, #fff7c7 0, #ffd15f 52%, #f3a820 100%),
    radial-gradient(circle at 64% 63%, #ffd7725e 0, #ffd77200 46%);
  box-shadow:
    0 0 55px #ffc3538c,
    inset -8px -10px 18px #d07f1b7d,
    inset 9px 8px 14px #fff8df8a;
  opacity: var(--moon-opacity);
  transition:
    left 108s linear,
    top 108s linear,
    transform 88s ease,
    opacity 1.3s ease;
}

.sky-moon::before {
  content: "";
  position: absolute;
  width: 18%;
  height: 18%;
  top: 24%;
  left: 18%;
  border-radius: 50%;
  background: #ffd88a54;
  box-shadow: 34px 38px 0 -2px #ffd88a3f;
}

.sky-moon::after {
  content: "";
  display: none;
}

.sky-moon-shadow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 280ms ease;
}

body.theme-dark .sky-moon-shadow-canvas {
  opacity: 1;
}

.sky-fireflies {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.sky-firefly {
  position: absolute;
  width: var(--firefly-size, 3px);
  height: var(--firefly-size, 3px);
  border-radius: 999px;
  background: #ffe181;
  box-shadow:
    0 0 12px #ffd876a0,
    0 0 24px #ffd87658;
  animation:
    sky-firefly-float var(--firefly-duration, 13s) ease-in-out infinite,
    sky-firefly-pulse 2.6s ease-in-out infinite;
  animation-delay: var(--firefly-delay, 0s), var(--firefly-delay, 0s);
}

@keyframes sky-star-twinkle {
  0% {
    opacity: 0.5;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.84;
    transform: scale(1.04);
  }
  100% {
    opacity: 0.56;
    transform: scale(0.98);
  }
}

@keyframes sky-firefly-float {
  0% {
    transform: translate3d(0, 0, 0);
  }
  33% {
    transform: translate3d(6px, -12px, 0);
  }
  66% {
    transform: translate3d(-4px, -7px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes sky-firefly-pulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

@keyframes sky-cloud-drift {
  0% {
    transform: translateX(-38vw) scale(var(--cloud-scale, 1));
    opacity: 0;
  }
  18% {
    opacity: var(--cloud-opacity, 0.2);
  }
  82% {
    opacity: var(--cloud-opacity, 0.2);
  }
  100% {
    transform: translateX(146vw) scale(var(--cloud-scale, 1));
    opacity: 0;
  }
}

.app-shell,
.reporting-shell {
  max-width: 1760px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.eyebrow {
  color: var(--brand);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  margin-bottom: 5px;
}

.topbar h1 {
  font-size: clamp(1.4rem, 2.7vw, 2.1rem);
}

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

.button {
  border: 1px solid transparent;
  background: linear-gradient(120deg, #0f7f8d, #1fa8a0);
  color: #fff;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 127, 141, 0.24);
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button.ghost {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--border);
}

.button.ghost.is-active {
  background: #eaf7ff;
  border-color: #9cc4d8;
  color: #0f5664;
}

.button.danger {
  background: linear-gradient(120deg, #b52a2a, #d14a4a);
}

.button.small {
  padding: 0.4rem 0.78rem;
  font-size: 0.78rem;
}

.pill {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.35rem 0.72rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.profile-trigger {
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}

.profile-trigger:hover {
  background: #f3fbfe;
}

.pill.small {
  padding: 0.18rem 0.5rem;
  font-size: 0.73rem;
}

.tabs-wrap {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.demo-consult-cta {
  margin-top: 14px;
  border: 1px dashed #8bc2cd;
  border-radius: 16px;
  background: linear-gradient(130deg, #f9fffd, #e7f6f9);
  padding: 20px;
  display: grid;
  justify-items: center;
  gap: 8px;
}

html.public-demo-boot .demo-consult-cta {
  display: grid !important;
}

.consult-main {
  font-size: 1rem;
  padding: 0.7rem 1.4rem;
}

.consult-subline {
  font-size: 0.84rem;
  font-weight: 700;
  color: #517180;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-mode-pill {
  border: 1px solid #d7e4e9;
  border-radius: 999px;
  background: #fff;
  padding: 0.42rem 0.84rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.tab-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.tab-button.is-active {
  background: linear-gradient(120deg, #fffef5, #ffecc3);
  border-color: #f0cf80;
}

.sync-stamp {
  margin-top: 8px;
  font-size: 0.83rem;
  color: var(--muted);
}

.tasks-admin-controls {
  display: none;
  margin-top: 10px;
  border: 1px dashed #b8cbd2;
  border-radius: 10px;
  background: #f7fcfe;
  padding: 8px 10px;
}

.tasks-admin-controls.is-open {
  display: block;
}

.tasks-admin-title {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #4d6d77;
}

body.theme-dark .button.ghost {
  background: #182734;
  color: #d8e6ee;
  border-color: var(--border);
}

body.theme-dark .button.ghost.is-active {
  background: #173340;
  border-color: #2f6a7d;
  color: #cdf5ff;
}

body.theme-dark .pill {
  background: #182734;
  color: var(--ink);
}

body.theme-dark .profile-trigger:hover {
  background: #1b2f3b;
}

body.theme-dark .demo-consult-cta {
  border: 1px dashed #2c6676;
  background: linear-gradient(130deg, #112229, #132e38);
}

body.theme-dark .consult-subline {
  color: #9fbbc7;
}

body.theme-dark .tab-mode-pill {
  border-color: var(--border);
  background: #182734;
  color: #b3c3cd;
}

body.theme-dark .tab-button {
  background: #182734;
}

body.theme-dark .tab-button.is-active {
  background: linear-gradient(120deg, #173340, #24495a);
  border-color: #3d7285;
  color: #d9f7ff;
}

body.theme-dark .tasks-admin-controls {
  border-color: #35505e;
  background: #121f29;
}

body.theme-dark .tasks-admin-title {
  color: #9eb5c0;
}

.tasks-admin-options {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.tasks-admin-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.board-controls {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) repeat(2, minmax(140px, 1fr)) auto auto;
  gap: 8px;
  align-items: end;
}

.board-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.board-controls input,
.board-controls select {
  border: 1px solid #c5d4d9;
  background: #fff;
  border-radius: 9px;
  padding: 0.46rem 0.58rem;
  color: var(--ink);
  font-size: 0.84rem;
}

.board-controls select,
.priority-select,
.login-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(180deg, #ffffff, #f3f8fa),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%235b7077' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-size: auto, 14px;
  background-position: center, right 0.5rem center;
  padding-right: 1.7rem;
  border-color: #a9c0c8;
  box-shadow: inset 0 1px 2px rgba(16, 42, 51, 0.06);
}

.board-controls select:focus,
.priority-select:focus,
.login-form select:focus {
  outline: none;
  border-color: #0f7f8d;
  box-shadow: 0 0 0 3px rgba(15, 127, 141, 0.16);
}

.checkbox-control {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  margin-bottom: 5px;
}

.checkbox-control input {
  width: 16px;
  height: 16px;
}

.filter-summary {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  justify-self: end;
  align-self: center;
}

.layout {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.board-wrap {
  min-width: 0;
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.board-column {
  min-height: 68vh;
  background: linear-gradient(180deg, #fffdfaec 0%, #f7fbffea 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(26, 42, 55, 0.08);
  backdrop-filter: blur(9px) saturate(120%);
}

.column-header {
  border-bottom: 1px solid #d8e4e8;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.column-header h3 {
  font-size: 1.04rem;
}

.column-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.column-dropzone {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 10px;
  transition: background-color 100ms ease;
}

.column-dropzone.is-over {
  background: var(--brand-soft);
}

.opportunity-card {
  border: 1px solid #c5d8de;
  border-left: 6px solid var(--brand);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 10px 18px rgba(14, 48, 57, 0.09);
  cursor: grab;
}

.opportunity-card.is-dragging {
  opacity: 0.5;
}

.opportunity-card.is-stale {
  border-color: #df8f8f;
  border-left-color: var(--danger);
  box-shadow: 0 0 0 2px #df8f8f4d;
  animation: pulse-border 1.7s ease-in-out infinite;
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 1px #df8f8f4d;
  }
  50% {
    box-shadow: 0 0 0 4px #df8f8f80;
  }
  100% {
    box-shadow: 0 0 0 1px #df8f8f4d;
  }
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.card-head h4 {
  font-size: 1rem;
  line-height: 1.25;
}

.card-title-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 120ms ease, border-color 120ms ease;
}

.card-title-link:hover,
.card-title-link:focus-visible {
  color: #0b6a78;
  border-bottom-color: currentColor;
  outline: none;
}

.card-title-button {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lease-number {
  font-weight: 700;
  color: #0f606c;
  font-size: 0.84rem;
  white-space: nowrap;
}

.meta-row {
  margin-top: 5px;
  font-size: 0.83rem;
  color: var(--muted);
}

.priority-control {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.priority-select {
  border: 1px solid #a8c0c9;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff, #f3f8fa);
  color: var(--ink);
  padding: 0.34rem 1.72rem 0.34rem 0.5rem;
  font-weight: 700;
  font-size: 0.8rem;
}

.stale-warning {
  margin-top: 8px;
  padding: 0.26rem 0.5rem;
  border-radius: 8px;
  background: #fff0f0;
  color: #8b2b2b;
  font-size: 0.78rem;
  font-weight: 700;
}

.advance-button {
  width: 100%;
  margin-top: 9px;
  border: 1px solid #f0cf80;
  border-radius: 8px;
  background: #fff6df;
  color: #6c4a00;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.42rem 0.5rem;
  cursor: pointer;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px;
  backdrop-filter: blur(9px) saturate(120%);
}

.panel h2 {
  font-size: 1.06rem;
  margin-bottom: 8px;
}

.panel p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  margin-bottom: 8px;
}

.outbox-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 350px;
  overflow: auto;
}

.outbox-item {
  border: 1px solid #d4e1e5;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  font-size: 0.79rem;
  line-height: 1.35;
}

.outbox-item .timestamp {
  margin-top: 3px;
  color: #687d85;
  font-size: 0.73rem;
}

.empty-state {
  color: var(--muted);
  font-size: 0.8rem;
}

.settings-panel {
  display: none;
}

.settings-panel.is-open {
  display: block;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 700;
}

.settings-form input,
.login-form input,
.login-form select,
.login-form textarea {
  border: 1px solid #c5d4d9;
  background: #fff;
  border-radius: 10px;
  padding: 0.53rem 0.65rem;
  color: var(--ink);
  font-size: 0.87rem;
}

.login-form textarea {
  resize: vertical;
  min-height: 92px;
}

.modal {
  position: fixed;
  inset: 0;
  background: #0f303966;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  z-index: 30;
}

.modal.is-open {
  display: flex;
}

.modal-card {
  width: min(430px, 100%);
  border-radius: 16px;
  border: 1px solid #d5e3e8;
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin-bottom: 12px;
}

.hierarchy-modal-card {
  width: min(980px, 100%);
  max-height: min(86vh, 980px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hierarchy-modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hierarchy-modal-title-row h2 {
  margin-bottom: 0;
}

.hierarchy-tree-button {
  padding: 0.38rem 0.52rem;
  border-radius: 10px;
  min-width: 2.1rem;
}

.hierarchy-tree-button-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hierarchy-subtitle {
  margin-top: -6px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.hierarchy-sections {
  overflow: auto;
  max-height: calc(86vh - 220px);
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hierarchy-warning-list {
  border: 1px solid #f0d9a8;
  background: #fff8e8;
  color: #704f0f;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.35;
}

.hierarchy-warning-list p + p {
  margin-top: 4px;
}

.hierarchy-section {
  border: 1px solid #d9e7ec;
  border-radius: 12px;
  background: #fdfefe;
  padding: 10px;
}

.hierarchy-section.is-missing {
  border-style: dashed;
  border-color: #c8d6dc;
  background: #f7fbfd;
}

.hierarchy-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.hierarchy-section-header h3 {
  font-size: 0.96rem;
}

.hierarchy-record-link {
  color: #0b6a78;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}

.hierarchy-record-link:hover,
.hierarchy-record-link:focus-visible {
  color: #084f5a;
}

.hierarchy-record-missing {
  color: #5f7480;
  font-size: 0.78rem;
}

.hierarchy-section-note {
  margin-bottom: 8px;
  font-size: 0.78rem;
  color: #5f7480;
}

.hierarchy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hierarchy-field-group {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed #c8d8de;
}

.hierarchy-field-group-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5f7480;
}

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

.hierarchy-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.hierarchy-field input,
.hierarchy-field select {
  border: 1px solid #c5d4d9;
  background: #fff;
  border-radius: 9px;
  padding: 0.47rem 0.55rem;
  color: var(--ink);
  font-size: 0.84rem;
}

.hierarchy-field input[readonly] {
  background: #f2f6f8;
  color: #4f6975;
}

.hierarchy-tree-modal-card {
  width: min(860px, 100%);
  max-height: min(86vh, 960px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hierarchy-tree-content {
  overflow: auto;
  max-height: calc(86vh - 210px);
  padding-right: 4px;
}

.hierarchy-tree-warning-list {
  border: 1px solid #f0d9a8;
  background: #fff8e8;
  color: #704f0f;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.35;
  margin-bottom: 10px;
}

.hierarchy-tree-warning-list p + p {
  margin-top: 4px;
}

.hierarchy-tree-list,
.hierarchy-tree-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hierarchy-tree-node-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 0 4px calc(var(--tree-depth, 0) * 18px);
}

.hierarchy-tree-toggle {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid #c7d8de;
  background: #fff;
  color: #4a6672;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.hierarchy-tree-toggle:disabled {
  cursor: default;
  opacity: 0.5;
}

.hierarchy-tree-toggle-icon {
  font-size: 0.78rem;
  line-height: 1;
  transition: transform 120ms ease;
}

.hierarchy-tree-toggle.is-expanded .hierarchy-tree-toggle-icon {
  transform: rotate(90deg);
}

.hierarchy-tree-node-type {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #67808b;
  min-width: 26px;
}

.hierarchy-tree-node-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.hierarchy-tree-node-meta {
  font-size: 0.76rem;
  color: var(--muted);
}

.hierarchy-tree-opportunity-button {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: #0b6a78;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.hierarchy-tree-opportunity-button:hover,
.hierarchy-tree-opportunity-button:focus-visible {
  color: #084f5a;
  text-decoration: underline;
}

.hierarchy-tree-node-row.is-selected .hierarchy-tree-opportunity-button {
  color: #0a5561;
  text-decoration: underline;
}

.profile-grid {
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.profile-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.profile-modal-header h2 {
  margin-bottom: 0;
}

.profile-grid div {
  border: 1px solid #dbe9ee;
  border-radius: 10px;
  background: #f8fcff;
  padding: 10px 11px;
}

.profile-grid dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4f6a74;
  font-weight: 700;
}

.profile-grid dd {
  margin: 6px 0 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.profile-theme-field {
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.profile-theme-select {
  border: 1px solid #c5d4d9;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0.5rem 0.65rem;
  font-size: 0.86rem;
}

.profile-enhanced-theme {
  margin: 0 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.profile-enhanced-theme input {
  width: 16px;
  height: 16px;
}


.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.84rem;
  font-weight: 700;
}

.password-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-field input {
  flex: 1;
}

.password-toggle {
  min-width: 58px;
  padding: 0.45rem 0.6rem;
}

.login-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.error-text {
  color: #a12828;
  min-height: 1.1em;
  font-size: 0.78rem;
}

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

.app-shell.is-locked {
  filter: blur(2px);
  pointer-events: none;
}

body.mode-public-demo .app-shell.is-locked {
  filter: none;
  pointer-events: auto;
}

html.public-demo-boot #login-modal {
  display: none !important;
}

html.public-demo-boot .app-shell.is-locked {
  filter: none;
  pointer-events: auto;
}

html.public-demo-boot .layout {
  grid-template-columns: 1fr;
}

html.public-demo-boot .sidebar {
  display: none;
}

html.public-demo-boot #my-tasks-toggle,
html.public-demo-boot #settings-toggle,
html.public-demo-boot #sync-button,
html.public-demo-boot #logout-button {
  display: none;
}

body.mode-public-demo .layout {
  grid-template-columns: 1fr;
}

body.mode-public-demo .sidebar {
  display: none;
}

body.mode-public-demo #my-tasks-toggle,
body.mode-public-demo #settings-toggle,
body.mode-public-demo #sync-button,
body.mode-public-demo #logout-button {
  display: none;
}

body.mode-public-demo #current-user {
  background: #e8f9ef;
  border-color: #a9d8bb;
  color: #1f5d3a;
}

body.mode-public-demo .tabs-wrap {
  margin-bottom: 2px;
}

.consultation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}

.toast {
  background: #13353a;
  color: #fff;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-size: 0.82rem;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}

.toast.is-error {
  background: #9f2f2f;
}

.metric-grid {
  margin-top: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.metric-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(8px) saturate(115%);
}

.metric-card h2 {
  font-size: 1.02rem;
  color: var(--muted);
}

.metric-value {
  margin-top: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
}

.visual-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.visual-card {
  border: 1px solid #d5e3e8;
  border-radius: 12px;
  background: #fffffff0;
  padding: 12px;
  box-shadow: 0 10px 20px rgba(15, 46, 56, 0.08);
  backdrop-filter: blur(8px) saturate(115%);
}

.visual-card h3 {
  font-size: 0.98rem;
  margin-bottom: 10px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  align-items: center;
}

.donut-chart {
  width: 130px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid #d0dde1;
  position: relative;
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 26%;
  background: #fff;
  border-radius: 50%;
  border: 1px solid #e6eff2;
}

.donut-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.donut-legend li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.legend-label {
  flex: 1;
}

.legend-value {
  color: var(--ink);
  font-weight: 700;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}

.bar-label {
  color: var(--muted);
}

.bar-value {
  color: var(--ink);
  font-weight: 700;
}

.bar-track {
  width: 100%;
  height: 10px;
  background: #edf3f6;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(120deg, #0f7f8d, #31b3a9);
}

.bar-fill.is-danger {
  background: linear-gradient(120deg, #c44848, #df6a6a);
}

.chart-empty {
  font-size: 0.8rem;
  color: var(--muted);
}

.panel.full {
  margin-top: 14px;
}

.table-wrap {
  margin-top: 10px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  border-bottom: 1px solid #d8e5e9;
  text-align: left;
  padding: 0.52rem 0.4rem;
  font-size: 0.84rem;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.department-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.department-card {
  border: 1px solid #d4e2e7;
  border-radius: 12px;
  background: #fffffff0;
  padding: 12px;
  box-shadow: 0 10px 20px rgba(15, 46, 56, 0.08);
  backdrop-filter: blur(8px) saturate(115%);
}

.department-card h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.department-card p {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

body.theme-dark .board-controls input,
body.theme-dark .board-controls select {
  border-color: #314553;
  background: #101b23;
  color: var(--ink);
}

body.theme-dark .board-controls select,
body.theme-dark .priority-select,
body.theme-dark .login-form select {
  background-image:
    linear-gradient(180deg, #16242d, #101b23),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%23b3c7d2' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  border-color: #3a5563;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

body.theme-dark .board-column {
  background: linear-gradient(180deg, #111e27ec 0%, #0f1a22eb 100%);
  border-color: #2b404d;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

body.theme-dark .column-header {
  border-bottom-color: #2c3f4b;
}

body.theme-dark .opportunity-card {
  border-color: #324c59;
  background: #131f28;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
}

body.theme-dark .lease-number {
  color: #5bd3df;
}

body.theme-dark .card-title-link:hover,
body.theme-dark .card-title-link:focus-visible {
  color: #79e3ec;
}

body.theme-dark .card-title-button {
  color: inherit;
}

body.theme-dark .priority-select {
  border-color: #3a5563;
  background: linear-gradient(180deg, #16242d, #101b23);
  color: var(--ink);
}

body.theme-dark .stale-warning {
  background: #3b2222;
  color: #ffb8b8;
}

body.theme-dark .advance-button {
  border-color: #8b6a2f;
  background: #2b2416;
  color: #ffdba2;
}

body.theme-dark .outbox-item {
  border-color: #314553;
  background: #111d26;
}

body.theme-dark .outbox-item .timestamp {
  color: #9cb4bf;
}

body.theme-dark .settings-form input,
body.theme-dark .login-form input,
body.theme-dark .login-form select,
body.theme-dark .login-form textarea,
body.theme-dark .profile-theme-select {
  border-color: #314553;
  background: #101b23;
  color: var(--ink);
}

body.theme-dark .password-toggle {
  border-color: #3a5563;
  background: #1a2b37;
  color: #d8e6ee;
}

body.theme-dark .modal {
  background: #071218b8;
}

body.theme-dark .modal-card {
  border-color: #304753;
  background: #121f28;
}

body.theme-dark .hierarchy-section {
  border-color: #2f4451;
  background: #111e27;
}

body.theme-dark .hierarchy-section.is-missing {
  border-color: #354b58;
  background: #0f1a22;
}

body.theme-dark .hierarchy-warning-list {
  border-color: #8c6b2f;
  background: #2a2417;
  color: #e2c58c;
}

body.theme-dark .hierarchy-record-link {
  color: #7ddce4;
}

body.theme-dark .hierarchy-record-link:hover,
body.theme-dark .hierarchy-record-link:focus-visible {
  color: #b1f0f5;
}

body.theme-dark .hierarchy-record-missing,
body.theme-dark .hierarchy-section-note {
  color: #9cb4bf;
}

body.theme-dark .hierarchy-field input,
body.theme-dark .hierarchy-field select {
  border-color: #314553;
  background: #101b23;
  color: var(--ink);
}

body.theme-dark .hierarchy-field input[readonly] {
  background: #13222c;
  color: #a7bdc7;
}

body.theme-dark .hierarchy-field-group {
  border-top-color: #314553;
}

body.theme-dark .hierarchy-field-group-title {
  color: #9cb4bf;
}

body.theme-dark .hierarchy-tree-warning-list {
  border-color: #8c6b2f;
  background: #2a2417;
  color: #e2c58c;
}

body.theme-dark .hierarchy-tree-toggle {
  border-color: #314553;
  background: #101b23;
  color: #b5ccd8;
}

body.theme-dark .hierarchy-tree-node-type {
  color: #9ab2bd;
}

body.theme-dark .hierarchy-tree-node-label,
body.theme-dark .hierarchy-tree-node-meta {
  color: #cfe0e8;
}

body.theme-dark .hierarchy-tree-opportunity-button {
  color: #7ddce4;
}

body.theme-dark .hierarchy-tree-opportunity-button:hover,
body.theme-dark .hierarchy-tree-opportunity-button:focus-visible {
  color: #b1f0f5;
}

body.theme-dark .hierarchy-tree-node-row.is-selected .hierarchy-tree-opportunity-button {
  color: #c4f5fa;
}

body.theme-dark .profile-grid div {
  border-color: #314553;
  background: #101b23;
}

body.theme-dark .profile-grid dt {
  color: #9eb7c3;
}

body.theme-dark .toast {
  background: #17323b;
}

body.theme-dark .toast.is-error {
  background: #7a2525;
}

body.theme-dark .visual-card {
  border-color: #314553;
  background: #111e27ef;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.24);
}

body.theme-dark .donut-chart {
  border-color: #314553;
}

body.theme-dark .donut-chart::after {
  background: #111e27;
  border-color: #314553;
}

body.theme-dark .bar-track {
  background: #20313d;
}

body.theme-dark th,
body.theme-dark td {
  border-bottom-color: #304653;
}

body.theme-dark .department-card {
  border-color: #314553;
  background: #111e27ef;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.24);
}

body.theme-dark .sky-scene::before {
  background: radial-gradient(circle at 50% 16%, #83d3ff22 0, #83d3ff00 56%);
}

body.theme-dark .sky-star {
  background: #d5edff;
  box-shadow: 0 0 8px #d5edff80;
}

body.theme-dark .sky-cloud {
  background: linear-gradient(180deg, #d9edff40 0, #d9edff1a 100%);
  box-shadow:
    inset 0 0 12px #d9edff26,
    0 0 18px #9dd0ff1a;
}

body.theme-dark .sky-glow {
  background: radial-gradient(circle, #b7dff86f 0, #b7dff81c 45%, #b7dff800 72%);
}


body.theme-dark .sky-moon {
  background:
    radial-gradient(circle at 34% 30%, #f4f8ff 0, #d9e2ed 50%, #b8c2ce 100%),
    radial-gradient(circle at 64% 63%, #d2dbe7 0, #d2dbe700 45%);
  box-shadow:
    0 0 55px #a5d4ff59,
    inset -8px -10px 18px #8fa0b66b,
    inset 9px 8px 14px #f3f8ff61;
}

body.theme-dark .sky-moon::before {
  background: #9facc07d;
  box-shadow: 34px 38px 0 -2px #9facc05c;
}

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

  .board-column {
    min-height: 50vh;
  }

  .column-dropzone {
    min-height: 45vh;
  }

  .sidebar {
    order: -1;
  }

  .board-controls {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .filter-summary {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

@media (max-width: 700px) {
  .app-shell,
  .reporting-shell {
    padding: 12px;
  }

  .topbar {
    padding: 14px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .tabs-wrap {
    padding: 10px;
  }

  .board-controls {
    grid-template-columns: 1fr;
  }

  .filter-summary {
    justify-self: start;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .donut-legend {
    width: 100%;
  }

  .board {
    grid-auto-columns: minmax(240px, 1fr);
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .hierarchy-modal-card {
    width: min(98vw, 98vw);
    max-height: 92vh;
    padding: 14px;
  }

  .hierarchy-tree-modal-card {
    width: min(98vw, 98vw);
    max-height: 92vh;
    padding: 14px;
  }

  .hierarchy-sections {
    max-height: calc(92vh - 210px);
  }

  .hierarchy-tree-content {
    max-height: calc(92vh - 210px);
  }

  .hierarchy-tree-node-row {
    padding-left: calc(var(--tree-depth, 0) * 14px);
  }

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