:root {
  --background: #f5f8fc;
  --foreground: #123b64;
  --card: #ffffff;
  --card-foreground: #123b64;
  --popover: #ffffff;
  --popover-foreground: #123b64;
  --primary: #155c96;
  --primary-foreground: #ffffff;
  --secondary: #e8f0f7;
  --secondary-foreground: #123b64;
  --muted: #e8eef5;
  --muted-foreground: #5b7087;
  --accent: #0d8d8a;
  --accent-foreground: #ffffff;
  --border: #c7d7e6;
  --ring: #d69b2d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 32px 20px;
  background: var(--background);
  color: var(--foreground);
  font-family: Arial, Helvetica, sans-serif;
}

.card { font: inherit; background: var(--card); }

.btn {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  font: inherit;
  cursor: pointer;
}

#org-structure .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

#org-structure .avatar {
  overflow: hidden;
}

#org-structure .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  transform: scale(1.12);
  transform-origin: center;
  border-radius: 50%;
}

#org-structure .org-card {
  animation: org-card-enter 420ms ease both;
}

#org-structure .leader-row .org-card {
  animation-delay: 80ms;
}

#org-structure .secretary-row .org-card {
  animation-delay: 160ms;
}

#org-structure .support-row .org-card:nth-child(1) {
  animation-delay: 230ms;
}

#org-structure .support-row .org-card:nth-child(2) {
  animation-delay: 300ms;
}

#org-structure .divisions .org-card:nth-child(1) {
  animation-delay: 350ms;
}

#org-structure .divisions .org-card:nth-child(2) {
  animation-delay: 420ms;
}

#org-structure .divisions .org-card:nth-child(3) {
  animation-delay: 490ms;
}

#org-structure .unit-row .org-card {
  animation-delay: 560ms;
}

#org-structure dialog {
  overflow: hidden;
  background: linear-gradient(145deg, #eaf5ff, #ffffff);
}

#org-structure dialog::backdrop {
  backdrop-filter: blur(4px);
  background: rgba(18, 59, 100, 0.42);
}

#org-structure .profile {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 4%, rgba(13, 141, 138, 0.18), transparent 32%),
    radial-gradient(circle at 2% 96%, rgba(21, 92, 150, 0.16), transparent 34%);
}

#org-structure .profile::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  top: -112px;
  right: -72px;
  border: 1px solid rgba(21, 92, 150, 0.25);
  border-radius: 50%;
}

#org-structure .profile > * {
  position: relative;
  z-index: 1;
}

#org-structure .top-actions {
  max-width: 720px;
  margin: 0 auto 18px;
  display: flex;
  justify-content: flex-start;
}

#org-structure .home-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-foreground);
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
}

#org-structure .home-btn:hover,
#org-structure .home-btn:focus {
  background: #124768;
}

#org-structure .org-heading {
  max-width: 720px;
  margin: 0 auto 32px;
  padding: 20px 24px;
  border: 1px solid rgba(21, 92, 150, 0.22);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 30px rgba(18, 59, 100, 0.1);
  text-align: center;
}

#org-structure .org-heading h1 {
  margin: 0;
  color: #155c96;
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: 0.07em;
}

#org-structure .org-heading p {
  margin: 8px 0 0;
  color: #123b64;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.025em;
}

#org-structure .org-heading .region {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  color: #b8862c;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

#org-structure .org-heading .region::before,
#org-structure .org-heading .region::after {
  content: "";
  width: min(12vw, 76px);
  height: 2px;
  background: #b8862c;
}

#org-structure .org-heading {
  max-width: 760px;
  margin: 0 auto 32px;
  padding: 6px 12px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#org-structure .org-heading h1 {
  color: transparent;
  font-size: clamp(1.6rem, 5vw, 2.45rem);
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
}

#org-structure .org-heading p {
  margin-top: 6px;
  color: var(--muted-foreground);
  font-size: 0.84rem;
  letter-spacing: 0.01em;
}

#org-structure .org-heading .region {
  width: max-content;
  margin: 14px auto 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(13, 141, 138, 0.14);
  color: #0d8d8a;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

#org-structure .org-heading .region::before,
#org-structure .org-heading .region::after {
  display: none;
}

@keyframes org-card-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#org-structure { --line: var(--foreground); --blue: var(--primary); --green: var(--accent); position: relative; isolation: isolate; overflow: hidden; padding: 30px 18px; border-radius: 26px; background: radial-gradient(circle at 8% 8%, color-mix(in srgb, var(--primary) 20%, transparent), transparent 31%), radial-gradient(circle at 92% 22%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 27%), linear-gradient(140deg, color-mix(in srgb, var(--background) 90%, var(--primary)), var(--background)); color: var(--foreground); font-family: inherit; }
#org-structure::before { content: ''; position: absolute; z-index: 0; width: 340px; height: 340px; right: -160px; bottom: -180px; border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); border-radius: 50%; box-shadow: 0 0 0 30px color-mix(in srgb, var(--primary) 6%, transparent), 0 0 0 60px color-mix(in srgb, var(--accent) 5%, transparent); }
#org-structure > * { position: relative; z-index: 1; }
#org-structure .org-heading { max-width: 720px; margin: 0 auto 32px; padding: 20px 24px; border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); border-radius: 20px; background: color-mix(in srgb, var(--card) 82%, transparent); box-shadow: 0 12px 30px color-mix(in srgb, var(--foreground) 10%, transparent); text-align: center; }
#org-structure .org-heading h1 { margin: 0; color: var(--primary); font-size: clamp(1.4rem, 4vw, 2rem); letter-spacing: .07em; }
#org-structure .org-heading p { margin: 8px 0 0; color: var(--foreground); font-size: .78rem; font-weight: 500; letter-spacing: .025em; }
#org-structure .org-heading .region { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; color: var(--ring); font-size: .9rem; font-weight: 500; letter-spacing: .04em; }
#org-structure .org-heading .region::before, #org-structure .org-heading .region::after { content: ''; width: min(12vw, 76px); height: 2px; background: var(--ring); }
    #org-structure .org-chart { position: relative; isolation: isolate; display: grid; gap: 24px; max-width: 1050px; margin: 0 auto; padding: 14px 6px 22px; }
    #org-structure .connector-layer { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; opacity: .72; }
    #org-structure .org-level, #org-structure .support-row, #org-structure .divisions, #org-structure .unit-row { z-index: 1; }
    #org-structure .org-level { display: flex; gap: 20px; flex-wrap: wrap; position: relative; }
    #org-structure .leader-row { justify-content: center; padding-right: 18%; }
    #org-structure .secretary-row { width: 38%; margin-left: auto; justify-content: flex-end; }
    #org-structure .org-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 10px; width: min(100%, 320px); padding: 12px; border: 1px solid color-mix(in srgb, var(--border) 75%, var(--primary)); border-radius: 18px; box-shadow: 0 10px 22px color-mix(in srgb, var(--foreground) 12%, transparent); text-align: left; color: var(--card-foreground); cursor: pointer; transition: transform 160ms ease, box-shadow 160ms ease; }
    #org-structure .org-card:hover { transform: translateY(-3px); box-shadow: 0 16px 28px color-mix(in srgb, var(--foreground) 18%, transparent); outline: 2px solid var(--ring); outline-offset: 2px; }
    #org-structure .org-card:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
    #org-structure .org-card.is-leader { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent))); color: var(--primary-foreground); }
   #org-structure .org-card.is-leader {
  background: #1B365D;
  color: white;
}
    #org-structure .org-card.is-secretary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, var(--primary))); color: var(--accent-foreground); }
   #org-structure .org-card.is-secretary {
  background: #1B365D;
  color: white;
}
    #org-structure .org-card.is-unit { background: var(--secondary); color: var(--secondary-foreground); }
   #org-structure .support-row .org-card {
  background: #1B365D;
  color: white;
}
    #org-structure .avatar { display: grid; width: 56px; height: 56px; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--card) 82%, transparent); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--foreground) 16%, transparent); color: var(--foreground); font-size: 21px; font-weight: 500; }
    #org-structure .is-leader .avatar, #org-structure .is-secretary .avatar { background: color-mix(in srgb, var(--background) 18%, transparent); color: inherit; }
    #org-structure .org-card > span:last-child { min-width: 0; }
    #org-structure .org-card h3 { margin: 0 0 4px; font-size: .94rem; line-height: 1.25; overflow-wrap: anywhere; }
    #org-structure .org-card p { margin: 0; font-size: .8rem; line-height: 1.4; overflow-wrap: anywhere; opacity: .9; }
    #org-structure .connector { display: none; }
    #org-structure .support-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-flow: row; align-items: stretch; gap: 14px; width: 52%; margin-left: auto; padding-top: 22px; }
    #org-structure .support-row .org-card { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; padding: 10px; }
    #org-structure .support-row .avatar { width: 44px; height: 44px; font-size: 16px; }
    #org-structure .support-row .org-card { min-height: 86px; }
    #org-structure .support-row .org-card h3 { font-size: .8rem; line-height: 1.3; overflow-wrap: normal; word-break: normal; }
    #org-structure .support-row .org-card p { font-size: .74rem; line-height: 1.35; overflow-wrap: normal; word-break: normal; }
    #org-structure .support-row::before { display: none; }
    #org-structure .divisions { position: relative; display: grid; grid-template-columns: repeat(3, minmax(210px, 1fr)); gap: 18px; padding-top: 24px; }
    #org-structure .divisions::before { display: none; }
    #org-structure .unit-row { display: grid; grid-template-columns: repeat(2, minmax(210px, 1fr)); gap: 18px; justify-content: center; max-width: 720px; margin: 0 auto; }
    #org-structure dialog { width: min(92vw, 500px); color: var(--popover-foreground); background: var(--popover); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 24px 64px color-mix(in srgb, var(--foreground) 28%, transparent); padding: 0; }
    #org-structure dialog::backdrop { background: color-mix(in srgb, var(--foreground) 36%, transparent); }
#org-structure .profile { padding: 24px; }
#org-structure .profile-head { display: grid; justify-items: center; gap: 14px; text-align: center; }
#org-structure .profile-photo { display: grid; width: 148px; height: 148px; place-items: center; overflow: hidden; border: 5px solid color-mix(in srgb, var(--primary) 24%, var(--card)); border-radius: 50%; background: var(--secondary); box-shadow: 0 12px 28px color-mix(in srgb, var(--foreground) 18%, transparent); }
#org-structure .profile-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
#org-structure .profile-photo .avatar { width: 100%; height: 100%; border-radius: 0; background: var(--primary); color: var(--primary-foreground); font-size: 42px; }
    #org-structure .profile h2 { margin: 0; font-size: 1.25rem; }
    #org-structure .profile .role { margin: 4px 0 0; color: var(--muted-foreground); }
    #org-structure .profile dl { display: grid; grid-template-columns: 112px 1fr; gap: 10px 14px; margin: 24px 0; }
    #org-structure .profile dt { color: var(--muted-foreground); }
#org-structure .profile dd { margin: 0; }
#org-structure .dialog-actions { display: flex; justify-content: flex-end; }
#org-structure dialog { overflow: hidden; background: linear-gradient(145deg, color-mix(in srgb, var(--popover) 88%, var(--primary)), var(--popover)); }
#org-structure dialog::backdrop { backdrop-filter: blur(4px); background: color-mix(in srgb, var(--foreground) 42%, transparent); }
#org-structure .profile { position: relative; overflow: hidden; background: radial-gradient(circle at 92% 4%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 32%), radial-gradient(circle at 2% 96%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 34%); }
#org-structure .profile::before { content: ''; position: absolute; width: 180px; height: 180px; top: -112px; right: -72px; border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); border-radius: 50%; box-shadow: 0 0 0 24px color-mix(in srgb, var(--primary) 7%, transparent); }
#org-structure .profile > * { position: relative; z-index: 1; }
#org-structure .org-card { animation: org-card-enter 420ms ease both; }
#org-structure .leader-row .org-card { animation-delay: 80ms; }
#org-structure .secretary-row .org-card { animation-delay: 160ms; }
#org-structure .support-row .org-card:nth-child(1) { animation-delay: 230ms; }
#org-structure .support-row .org-card:nth-child(2) { animation-delay: 300ms; }
#org-structure .divisions .org-card:nth-child(1) { animation-delay: 350ms; }
#org-structure .divisions .org-card:nth-child(2) { animation-delay: 420ms; }
#org-structure .divisions .org-card:nth-child(3) { animation-delay: 490ms; }
#org-structure .unit-row .org-card { animation-delay: 560ms; }

@keyframes org-card-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  #org-structure .org-card { animation: none; }
}

#org-structure {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 30px 18px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 8% 8%, rgba(21, 92, 150, 0.18), transparent 31%),
    radial-gradient(circle at 92% 22%, rgba(13, 141, 138, 0.16), transparent 27%),
    linear-gradient(140deg, #edf5fb, #ffffff);
}

#org-structure::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: 340px;
  height: 340px;
  right: -160px;
  bottom: -180px;
  border: 1px solid rgba(21, 92, 150, 0.2);
  border-radius: 50%;
  box-shadow:
    0 0 0 30px rgba(21, 92, 150, 0.05),
    0 0 0 60px rgba(13, 141, 138, 0.04);
}

#org-structure > * {
  position: relative;
  z-index: 1;
}
    @media (min-width: 681px) and (max-width: 900px) { #org-structure .support-row { grid-template-columns: 1fr; width: 45%; } }
