:root {
  --ink: #142033;
  --muted: #5c6b7a;
  --line: #d7e0e8;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --accent: #0b6f65;
  --accent-2: #0a5a52;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #067647;
  --bg: #eef3f6;
  --shadow: 0 18px 40px rgba(20, 32, 51, 0.08);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 70% 45% at 8% -10%, #cfe8e3 0%, transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, #d9e3f2 0%, transparent 50%),
    linear-gradient(180deg, #f7fafb 0%, var(--bg) 100%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 -1.25rem 1.5rem;
  padding: 0.65rem 1.25rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(20, 32, 51, 0.04);
  animation: rise 0.45s ease both;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
}

.brand {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.brand span { color: var(--accent); }

.nav-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  align-items: center;
  flex: 1;
}

.nav-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: center;
  padding-right: 0.85rem;
  border-right: 1px solid var(--line);
}
.nav-group:last-of-type { border-right: 0; }

.nav a,
.nav-dd-btn {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.35rem 0.15rem;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  background: none;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  font: inherit;
  cursor: pointer;
}

.nav a:hover,
.nav a.is-active,
.nav-dd-btn:hover,
.nav-dd-btn.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.nav-dd {
  position: relative;
}
.nav-dd-menu {
  display: block;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  left: 0;
  top: calc(100% - 2px);
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.35rem 0;
  z-index: 60;
  transition: opacity 80ms ease, visibility 0s linear 180ms;
}
.nav-dd-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 16px;
}
.nav-dd:hover .nav-dd-menu,
.nav-dd:focus-within .nav-dd-menu {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}
.nav-dd-menu a {
  display: block;
  padding: 0.55rem 0.9rem;
  border-bottom: 0 !important;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
}
.nav-dd-menu a:hover,
.nav-dd-menu a.is-active {
  background: #eef6f5;
  color: var(--accent);
}
.nav-dd-menu .nav-dd {
  display: block;
}
.nav-dd-menu .nav-dd-menu {
  left: calc(100% - 0.4rem);
  top: 0;
}
.nav-dd-menu .nav-dd-menu::before {
  left: -12px;
  right: auto;
  top: 0;
  width: 16px;
  height: 100%;
}
.nav-dd-menu .nav-dd-btn {
  display: block;
  width: 100%;
  text-align: left;
  border-bottom: 0 !important;
  padding: 0.55rem 0.9rem;
}

.nav-user {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-left: auto;
}
.nav-who {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.nav-admin { color: var(--accent) !important; }
.nav-logout { display: inline; margin: 0; }
.nav-logout button {
  background: none;
  border: 0;
  padding: 0.35rem 0.15rem;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.nav-logout button:hover {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.people-row summary {
  cursor: pointer;
  list-style: none;
}
.people-row summary::-webkit-details-marker { display: none; }
.people-row .sub { display: block; margin-top: 0.2rem; }

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .nav.is-open { display: flex; }
  .nav-group {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 0.65rem;
  }
  .nav-user { margin-left: 0; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(11, 111, 101, 0.28);
}
.btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: #fff; }

.hero {
  display: grid;
  gap: 1rem;
  padding: 2.5rem 0 1rem;
  max-width: 38rem;
  animation: rise 0.55s ease both;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(215, 224, 232, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
  animation: rise 0.5s ease both;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.panel .sub {
  margin: 0 0 1rem;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 1rem;
}
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 860px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}

.stat {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
}

.stat .label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.stat .value {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin-top: 0.2rem;
}

.list {
  display: grid;
  gap: 0.65rem;
}

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.item:hover {
  border-color: #b9cdd0;
  transform: translateY(-1px);
}

.item h3 {
  margin: 0;
  font-size: 1.02rem;
}

.item p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-pending { background: #eef6f5; color: var(--accent); }
.badge-overdue {
  background: #fef3f2;
  color: var(--danger);
  animation: overdue-flash 1.1s ease-in-out infinite;
}
.item-overdue {
  border-color: rgba(180, 35, 24, 0.45) !important;
  background: rgba(254, 243, 242, 0.65);
  animation: overdue-row-flash 1.4s ease-in-out infinite;
}
.stat-overdue .value {
  color: var(--danger);
  animation: overdue-flash 1.1s ease-in-out infinite;
}
@keyframes overdue-flash {
  0%, 100% {
    opacity: 1;
    background: #fef3f2;
    box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.35);
  }
  50% {
    opacity: 0.55;
    background: #fecaca;
    box-shadow: 0 0 0 6px rgba(180, 35, 24, 0);
  }
}
@keyframes overdue-row-flash {
  0%, 100% { background: rgba(254, 243, 242, 0.45); }
  50% { background: rgba(254, 202, 202, 0.85); }
}
@media (prefers-reduced-motion: reduce) {
  .badge-overdue,
  .item-overdue,
  .stat-overdue .value {
    animation: none;
    opacity: 1;
  }
}

.empty {
  padding: 1.4rem 0.2rem;
  color: var(--muted);
  text-align: left;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.75rem 1.6rem 1.5rem;
  animation: rise 0.45s ease both;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.auth-card p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.field { margin-bottom: 0.95rem; }
.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.field .hint,
.hint {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 400;
  margin: 0.25rem 0 0;
}
.field .req { color: var(--danger); }
.field-subject input {
  font-size: 1.05rem;
  font-weight: 600;
}
.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  box-sizing: border-box;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(11, 111, 101, 0.25);
  border-color: var(--accent);
}
  display: block;
  font-weight: 650;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  background: #fff;
}
.field input:focus {
  outline: 2px solid rgba(11, 111, 101, 0.25);
  border-color: var(--accent);
}

.error {
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #fecdca;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.messages {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.msg {
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
}
.msg-success { background: #ecfdf3; color: var(--ok); }
.msg-error { background: #fef3f2; color: var(--danger); }
.msg-info { background: #eef6f5; color: var(--accent); }

.footer-note {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.letterhead {
  display: grid;
  gap: 1rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.letterhead-org,
.letterhead-dept {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}
.letterhead-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.letterhead-logo-sm {
  width: 52px;
  height: 52px;
}
.letterhead-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.letterhead-dept-name {
  font-weight: 700;
  font-size: 1.05rem;
}
.letterhead-meta {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  margin-top: 0.15rem;
}

.org-tree {
  list-style: none;
  margin: 0;
  padding-left: 1.1rem;
  border-left: 2px solid #c5d8d4;
}
.org-tree-root {
  padding-left: 0;
  border-left: none;
  margin-top: 1rem;
}
.org-tree > .org-node:first-child { margin-top: 0.35rem; }
.org-node { margin: 0.65rem 0 0.65rem 0.25rem; position: relative; }
.org-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}
.org-card-office { display: grid; gap: 0.55rem; }
.org-card-title { font-weight: 700; }
.org-card-meta { color: var(--muted); font-size: 0.9rem; margin-top: 0.15rem; }

.hc-crumbs {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  line-height: 1.55;
}
.hc-crumbs a { font-weight: 650; }
.outline-panel { overflow: hidden; }
.hc-scroll {
  overflow: hidden;
  padding: 0;
  margin-top: 0.5rem;
  position: relative;
  min-height: 28rem;
  height: min(72vh, 46rem);
  cursor: grab;
  touch-action: none;
  background: #f7fbfa;
  border: 1px solid #e4eeec;
  border-radius: 12px;
}
.hc-scroll.is-panning { cursor: grabbing; user-select: none; }
.hc-scale-wrap {
  position: relative;
  transform-origin: 0 0;
  width: max-content;
  margin: 0;
  padding: 2rem 2.5rem;
}
.hc-wires {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}
.hc-tree,
.hc-children {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
}
.hc-tree { flex-direction: column; align-items: center; min-width: max-content; }
.hc-tree > .hc-node { padding-top: 0; }
.hc-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 1.15rem 0.55rem 0;
  text-align: center;
}
.hc-card {
  position: relative;
  z-index: 2;
  background: #fff;
  border: 1.5px solid #0b6f65;
  border-radius: 10px;
  padding: 0.85rem 0.95rem 0.65rem;
  min-width: clamp(5.5rem, 11vw, 10rem);
  max-width: 11rem;
  width: max-content;
  box-shadow: 0 6px 18px rgba(20, 32, 51, 0.06);
  cursor: grab;
  user-select: none;
}
.hc-card.is-editable { user-select: text; }
.hc-children:has(> .hc-node:nth-child(5)) .hc-card {
  min-width: 5.2rem;
  max-width: 8.2rem;
  padding: 0.55rem 0.5rem 0.45rem;
}
.hc-children:has(> .hc-node:nth-child(5)) .hc-title-input,
.hc-children:has(> .hc-node:nth-child(5)) .hc-title { font-size: 0.82rem; }
.hc-children:has(> .hc-node:nth-child(8)) .hc-card {
  min-width: 4.5rem;
  max-width: 6.8rem;
  padding: 0.4rem 0.35rem 0.3rem;
}
.hc-children:has(> .hc-node:nth-child(8)) .hc-title-input,
.hc-children:has(> .hc-node:nth-child(8)) .hc-title { font-size: 0.74rem; }
.hc-children:has(> .hc-node:nth-child(8)) .hc-person { display: block; }
.hc-node.is-root > .hc-card,
.hc-node.is-focus > .hc-card {
  border-width: 2px;
  border-bottom-width: 4px;
  background: linear-gradient(180deg, #f2faf8 0%, #fff 70%);
}
.hc-title {
  font-weight: 750;
  font-size: 0.95rem;
  line-height: 1.25;
  color: var(--ink);
}
.hc-title-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.2rem 0.3rem;
  font: inherit;
  font-weight: 750;
  font-size: 0.95rem;
  text-align: center;
  background: transparent;
  color: var(--ink);
  cursor: text;
}
.hc-title-input:focus {
  outline: none;
  border-color: #0b6f65;
  background: #fff;
  cursor: text;
}
.hc-status {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0b6f65;
}
.hc-edit {
  margin-top: 0.45rem;
  text-align: left;
  border-top: 1px dashed #c5d8d4;
  padding-top: 0.35rem;
}
.hc-edit > summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0b6f65;
  list-style: none;
}
.hc-edit > summary::-webkit-details-marker { display: none; }
.hc-edit-bar {
  display: flex;
  justify-content: flex-end;
  margin: 0.35rem 0 0.15rem;
}
.hc-edit-close {
  border: 1px solid #0b6f65;
  background: #0b6f65;
  color: #fff;
  border-radius: 999px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.7rem;
  cursor: pointer;
}
.hc-edit-form {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.hc-edit-form label {
  display: grid;
  gap: 0.15rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.hc-edit-form input,
.hc-edit-form select {
  width: 100%;
  font-size: 0.8rem;
}
.hc-card:has(.hc-edit[open]) {
  min-width: 12.5rem;
  max-width: 16rem;
  z-index: 5;
}
.hc-person {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.hc-vacant { font-style: italic; opacity: 0.75; }
.hc-code {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.hc-handle {
  position: absolute;
  z-index: 3;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 1.5px solid #0b6f65;
  background: #fff;
  color: #0b6f65;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: 0 2px 8px rgba(20, 32, 51, 0.08);
}
.hc-card:hover .hc-handle,
.hc-card:focus-within .hc-handle,
.hc-node.is-focus > .hc-card .hc-handle,
.hc-node.is-group > .hc-card .hc-handle {
  opacity: 1;
}
.hc-node.is-group > .hc-card {
  cursor: pointer;
  background: #f2faf8;
  min-width: 9.5rem;
}
.hc-toggle {
  margin-top: 0.35rem;
  border: 1px solid #0b6f65;
  background: #fff;
  color: #0b6f65;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  cursor: pointer;
}
.hc-node.is-collapsed > .hc-children,
.hc-node.is-collapsed > .hc-stem {
  display: none;
}
.hc-children.hc-stagger + .hc-children.hc-stagger {
  padding-top: 1.7rem;
}
.hc-handle:hover { background: #0b6f65; color: #fff; transform: scale(1.08); }
.hc-handle-top { top: -0.7rem; left: 50%; transform: translateX(-50%); }
.hc-handle-top:hover { transform: translateX(-50%) scale(1.08); }
.hc-handle-bottom { bottom: -0.7rem; left: 50%; transform: translateX(-50%); }
.hc-handle-bottom:hover { transform: translateX(-50%) scale(1.08); }
.hc-handle-left { left: -0.7rem; top: 50%; transform: translateY(-50%); }
.hc-handle-left:hover { transform: translateY(-50%) scale(1.08); }
.hc-handle-right { right: -0.7rem; top: 50%; transform: translateY(-50%); }
.hc-handle-right:hover { transform: translateY(-50%) scale(1.08); }
.hc-handle-delete {
  top: -0.55rem;
  right: -0.55rem;
  left: auto;
  transform: none;
  border-color: #b42318;
  color: #b42318;
  font-size: 1rem;
  line-height: 1;
}
.hc-card.is-dragging { opacity: 0.45; }
.hc-card.is-drop-target {
  outline: 2px solid #0b6f65;
  outline-offset: 3px;
  background: #e7f5f2;
}
.hc-handle.is-drop-target {
  opacity: 1 !important;
  background: #0b6f65;
  color: #fff;
  transform: scale(1.25);
}
.hc-handle-left.is-drop-target,
.hc-handle-right.is-drop-target { transform: translateY(-50%) scale(1.25); }
.hc-handle-bottom.is-drop-target,
.hc-handle-top.is-drop-target { transform: translateX(-50%) scale(1.25); }

/* Side staff off the vertical stem:  |---PA  (into the left side of the box) */
.hc-stem {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.55rem 0 0.35rem;
  min-height: 2.8rem;
}
.hc-stem::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-left: 1.5px solid #0b6f65;
  z-index: 1;
}
.hc-staff {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  width: 50%;
  margin-left: 50%;
  padding: 0.4rem 0;
  box-sizing: border-box;
}
.hc-staff-line {
  width: 2.75rem;
  height: 0;
  border-top: 1.5px solid #0b6f65;
  flex-shrink: 0;
  margin: 1.35rem 0 0;
}
.hc-staff-tree {
  flex: 0 1 auto;
  align-items: flex-start;
  min-width: 0;
}
.hc-staff-tree > .hc-node {
  padding-top: 0;
  align-items: flex-start;
}
.hc-staff-tree > .hc-node::before { display: none; }
.hc-card-side {
  min-width: 7.2rem;
  max-width: 10rem;
  padding: 0.45rem 0.65rem;
  border-style: dashed;
  background: #f7fbfa;
  margin: 0;
}
.hc-card-side .hc-title-input,
.hc-card-side .hc-title {
  font-size: 0.88rem;
}
/* Side boxes need visible handles on hover too */
.hc-card-side .hc-handle { opacity: 0; }
.hc-card-side:hover .hc-handle,
.hc-card-side:focus-within .hc-handle { opacity: 1; }
/* When line children follow, keep the stem line continuous into the fork */
.hc-node:has(> .hc-stem):has(> .hc-children) > .hc-stem {
  padding-bottom: 0;
}
.hc-node:has(> .hc-stem):has(> .hc-children) > .hc-children {
  padding-top: 1.15rem;
}

/* SVG overlay draws parent→child forks (including wrapped rows). */
.hc-children {
  position: relative;
  padding-top: 1.15rem;
}

@media (max-width: 720px) {
  .hc-card { min-width: 8.2rem; max-width: 10.5rem; padding: 0.55rem 0.65rem; }
  .hc-title { font-size: 0.88rem; }
  .hc-node { padding-left: 0.3rem; padding-right: 0.3rem; }
}
.org-people {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.org-people li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.92rem;
}
.org-people-edit li {
  background: #f7fbfa;
  border: 1px solid #e4eeec;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
}
.org-inline-form,
.org-add-form,
.org-add-child,
.org-office-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.org-add-form { margin-top: 0.75rem; }
.org-add-form input[type=text],
.org-add-form select,
.org-inline-form input[type=text],
.org-inline-form select,
.org-add-child input[type=text],
.org-name-input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  background: #fff;
  min-width: 10rem;
}
.org-code-input {
  width: 5.5rem;
  min-width: 4.5rem !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.org-code-hint {
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.org-name-input { font-weight: 700; min-width: 14rem; flex: 1; }
.btn-small {
  padding: 0.4rem 0.7rem;
  font-size: 0.88rem;
  border-radius: 10px;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.org-extra { margin-top: 1rem; }
.org-extra summary {
  cursor: pointer;
  list-style: none;
}
.org-extra summary::-webkit-details-marker { display: none; }
.muted { color: var(--muted); }
.people-multi {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.35rem;
}
.people-multi-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.people-multi-item:hover { background: #eef6f5; }
.people-multi-item input {
  margin-top: 0.15rem;
  width: auto;
}
.people-multi-item span { color: var(--ink); font-size: 0.95rem; }

.fill-form .fill-field { margin-bottom: 1.05rem; }
.fill-form label { display:block; font-weight:700; margin-bottom:0.3rem; }
.fill-form .hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.35rem; }
.fill-form .req { color: var(--danger); }
.fill-form input[type=text],
.fill-form input[type=email],
.fill-form input[type=number],
.fill-form input[type=date],
.fill-form select,
.fill-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  background: #fff;
}
.choice-list { display:grid; gap:0.4rem; }
.choice { font-weight: 600; color: var(--ink); }
.sig-wrap { display:grid; gap:0.5rem; justify-items:start; }
.sig-pad {
  width: min(100%, 520px);
  height: 160px;
  border: 1px dashed #9bb5b1;
  border-radius: 12px;
  background: #fff;
  touch-action: none;
}
.setup-steps { display:grid; gap:1rem; }
.setup-step {
  display: block;
  padding: 0;
  overflow: hidden;
}
.setup-step > .setup-summary {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.15rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.setup-step > .setup-summary::-webkit-details-marker { display: none; }
.setup-step > .setup-summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
  font-size: 0.95rem;
  transition: transform 0.15s ease;
}
.setup-step:not([open]) > .setup-summary::after { transform: rotate(-90deg); }
.setup-summary-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.setup-summary-text .sub { margin: 0; }
.setup-step > .setup-body {
  padding: 0 1.15rem 1.15rem 1.15rem;
  margin-left: 3.2rem;
}
.builder-sub {
  margin: 0.5rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.65);
  padding: 0.35rem 0.75rem 0.75rem;
}
.builder-sub > summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.5rem 0.15rem;
  list-style: none;
}
.builder-sub > summary::-webkit-details-marker { display: none; }
.builder-sub > summary::after {
  content: " ▾";
  color: var(--muted);
  font-weight: 500;
}
.builder-sub:not([open]) > summary::after { content: " ▸"; }
.builder-field {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.builder-field-summary {
  cursor: pointer;
  padding: 0.7rem 0.85rem;
  list-style: none;
  font-size: 0.95rem;
}
.builder-field-summary::-webkit-details-marker { display: none; }
.builder-field-summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
}
.builder-field:not([open]) > .builder-field-summary::after { content: "▸"; }
.builder-field-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0 0.85rem 0.85rem;
}
.builder-add-wrap { background: #f7fbfa; border-style: dashed; border-color: #9bb5b1; }
.builder-invite,
.builder-flow-settings {
  display: grid;
  gap: 0.65rem;
  margin: 0.5rem 0 0;
}
.builder-invite input,
.builder-invite select {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  box-sizing: border-box;
}
.flow-blocks { display: grid; gap: 0.35rem; margin: 0.75rem 0; }
.flow-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0;
}
.flow-block-summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  padding: 0.7rem 0.85rem;
  list-style: none;
}
.flow-block-summary::-webkit-details-marker { display: none; }
.flow-order {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: #eef6f5;
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.flow-arrow {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.15rem 0;
}
.people-contact-list { display: grid; gap: 0.75rem; margin-top: 0.5rem; }
.people-contact-row {
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.people-contact-name { margin-bottom: 0.35rem; font-size: 0.95rem; }
.step-num {
  width: 2.2rem; height: 2.2rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display:grid; place-items:center;
  font-weight: 800;
  flex-shrink: 0;
}
.simple-list { margin:0; padding-left:1.1rem; }
.simple-list li { margin: 0.35rem 0; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.panel-head h2 { margin: 0; }
.item-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.inline-form select {
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
}
.builder-create {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.55);
}
.builder-create-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.builder-create-row input[type=text],
.builder-create-row select,
.builder-desc-input,
.builder-meta input,
.builder-meta textarea,
.builder-meta select,
.builder-field-form input,
.builder-field-form textarea,
.builder-field-form select,
.builder-add-field input,
.builder-add-field textarea,
.builder-add-field select,
.builder-receiver input,
.builder-receiver select {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  box-sizing: border-box;
}
.builder-create-row input[type=text] { flex: 1 1 12rem; width: auto; }
.builder-create-row select { width: auto; min-width: 10rem; }
.builder-desc-input { margin-top: 0.5rem; }
.builder-meta,
.builder-add-field,
.builder-receiver {
  display: grid;
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
}
.builder-meta label,
.builder-field-form label,
.builder-add-field label,
.builder-receiver label {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.builder-fields { display: grid; gap: 0.75rem; margin: 0.75rem 0; }
.builder-field-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
}
.builder-check {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  padding-bottom: 0.35rem;
}
.builder-check input { width: auto !important; }
.builder-field-side {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.builder-field-actions { margin-top: 0.35rem; }
.builder-add-field {
  margin: 0.5rem 0 0;
  padding: 0;
  border: none;
  background: transparent;
}
.builder-add-field h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.setup-body { min-width: 0; }
.hint { color: var(--muted); font-weight: 400; font-size: 0.88rem; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}
@media (max-width: 720px) {
  .setup-step > .setup-body { margin-left: 0; }
  .builder-field-inner { grid-template-columns: 1fr; }
  .builder-field-side { flex-direction: row; }
  .builder-field-grid { grid-template-columns: 1fr; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Menu manager */
.menu-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.menu-add-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}
.menu-add-grid .field label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
}
.menu-add-grid .input,
.menu-add-grid input,
.menu-add-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}
.menu-add-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.menu-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
}
.menu-chip {
  display: inline-flex;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.menu-chip.is-on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.menu-reset { margin-left: auto; }
.table-wrap { overflow-x: auto; }
.menu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.menu-table th,
.menu-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.menu-table th {
  background: #f7fafb;
  font-weight: 700;
}
.menu-table th a { color: inherit; text-decoration: none; }
.menu-table .font-med { font-weight: 700; }
.menu-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--muted);
}
.menu-main-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}
.menu-table .ok { color: var(--ok); font-weight: 700; }
.menu-table .nowrap { white-space: nowrap; }
.menu-table .inline-form { display: inline; margin-left: 0.65rem; }
.menu-depth-1 { padding-left: 1.1rem; }
.menu-depth-2 { padding-left: 2.2rem; }
.menu-depth-3 { padding-left: 3.3rem; }
.menu-reparent select { max-width: 16rem; }
.menu-table .link-danger {
  background: none;
  border: 0;
  padding: 0;
  color: var(--danger);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
@media (max-width: 900px) {
  .menu-add-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .menu-add-grid { grid-template-columns: 1fr; }
  .nav-dd-menu {
    position: static;
    display: block;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    box-shadow: none;
    border: 0;
    padding-left: 0.5rem;
  }
  .nav-dd-menu::before { display: none; }
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}
.gallery-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.05rem 1.1rem;
  background: #fff;
}
.gallery-card h3 { margin: 0.15rem 0 0.4rem; font-size: 1.08rem; }
.gallery-card p { margin: 0 0 0.55rem; color: var(--muted); font-size: 0.92rem; }
.gallery-cat {
  margin: 0 0 0.25rem !important;
  font-size: 0.72rem !important;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent) !important;
}
.share-box {
  margin-top: 0.85rem;
  padding: 0.85rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f7fafb;
}
.share-box code {
  display: block;
  word-break: break-all;
  font-size: 0.82rem;
}
.embed-snippet {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
}
.is-cond-hidden,
.is-page-hidden { display: none !important; }
.wizard-status {
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.embed-body {
  margin: 0;
  padding: 0.75rem;
  background: #f4f7f9;
  min-height: 100vh;
}
.embed-panel { margin: 0; box-shadow: none; }

.mail-status {
  display: inline-block;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.mail-status-ok {
  background: #ecfdf3;
  color: var(--ok);
}
.mail-status-queued {
  background: #fff7ed;
  color: var(--warn);
}
.sla-form { margin-top: 0.75rem; }

