:root {
  --bg: #f4f8fc;
  --card: #ffffff;
  --text: #17324d;
  --muted: #5f7388;
  --line: #d9e6f2;
  --primary: #0b63b6;
  --primary-dark: #084d8e;
  --primary-soft: #eaf4fd;
  --danger-bg: #fff1f1;
  --danger-text: #b42318;
  --shadow: 0 10px 30px rgba(11, 68, 122, 0.10);
  --shadow-soft: 0 8px 20px rgba(11, 68, 122, 0.05);
  --shadow-hover: 0 16px 30px rgba(11, 68, 122, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(11, 99, 182, 0.08), transparent 26%),
    linear-gradient(180deg, #f8fbff 0%, #eef5fb 52%, #ffffff 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, #005ca9 0%, #2c8fd6 70%, #7fc4f2 100%);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.brand-row {
  display: flex;
  align-items: center;
  min-width: 180px;
  flex: 0 0 auto;
}

.header-logo {
  height: 88px;
  width: auto;
  display: block;
  object-fit: contain;
}

.search-wrap {
  flex: 1;
  min-width: 320px;
  max-width: 920px;
}

.search-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-input-wrap {
  position: relative;
  flex: 1;
}

.search-box {
  width: 100%;
  background: #f7fbff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 46px 14px 16px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.search-box:focus {
  border-color: #b8d6ee;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(11, 99, 182, 0.08);
}

.clear-search-btn {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #eaf2fb;
  color: #5f7388;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.clear-search-btn.visible {
  display: inline-flex;
}

.clear-search-btn:hover {
  background: #dbeafb;
  color: #123252;
  transform: translateY(-50%) scale(1.05);
}

.search-btn {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 16px;
  padding: 14px 20px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.search-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(11, 68, 122, 0.16);
}

.filters-bar {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 22px;
}

.filters-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filters-label {
  font-size: 14px;
  font-weight: 700;
  color: #123252;
  margin-right: 6px;
  white-space: nowrap;
}

.chip-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: #4c6278;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: 0.18s ease;
}

.chip:hover {
  border-color: #b7d2eb;
  background: #f7fbff;
}

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

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.main-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.count {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  padding-top: 4px;
}

.section {
  margin-top: 28px;
}

.section:first-of-type {
  margin-top: 0;
}

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

.section-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  color: #123252;
}

.section-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.section-count {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 22px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  color: #123252;
}

.panel-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.employee-cards,
.employees-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.employee-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card,
.employee-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
}

.card {
  min-height: 220px;
}

.employee-card {
  min-height: 270px;
  cursor: pointer;
  border-radius: 22px;
  padding: 18px;
}

.card:hover,
.employee-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: #bfd8ee;
}

.card-top,
.employee-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}
.employee-card.manager {
  border-color: #7fb7e3;
  background: linear-gradient(180deg, #ffffff 0%, #eef7ff 100%);
  box-shadow:
    0 10px 26px rgba(11, 68, 122, 0.08),
    0 0 0 1px rgba(11, 99, 182, 0.06);
}

.meta-value a,
.modal-info-value a {
  text-transform: lowercase;
}
.mail-btn,
.action-btn,
.action-btn.primary,
.action-btn.secondary,
.open-btn,
.phone-btn,
.directory-btn {
  text-transform: none;
}
.card-main {
  min-width: 0;
  flex: 1;
}

.service-title-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.service-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
  transition: transform 0.18s ease;
  margin-top: 1px;
}

.card:hover .service-icon {
  transform: scale(1.08);
}

.card-title,
.employee-name {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  color: #123252;
  word-break: break-word;
}

.employee-name {
  padding-right: 150px;
}

.tag {
  display: inline-block;
  margin-top: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #d7eafb;
}

.fav-btn {
  border: 1px solid #cfe2f5;
  background: #f3f9ff;
  color: var(--primary);
  width: 44px;
  height: 44px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 21px;
  flex: 0 0 auto;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.fav-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(11, 68, 122, 0.10);
}

.fav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.card-desc {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.card-bottom,
.employee-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.employee-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.category {
  font-size: 12px;
  color: #88a0b8;
}

.open-btn,
.mail-btn,
.phone-btn,
.directory-btn,
.action-btn {
  border-radius: 16px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.open-btn,
.mail-btn,
.directory-btn,
.action-btn.primary {
  background: var(--primary);
  color: #fff;
}

.open-btn:hover,
.mail-btn:hover,
.directory-btn:hover,
.action-btn.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(11, 68, 122, 0.14);
}

.phone-btn,
.action-btn.secondary {
  background: #f3f9ff;
  color: var(--primary);
  border: 1px solid #cfe2f5;
}

.phone-btn:hover,
.action-btn.secondary:hover {
  transform: translateY(-1px);
  background: #eaf4fd;
  border-color: #b9d6ee;
  box-shadow: 0 10px 18px rgba(11, 68, 122, 0.10);
}

.employee-position {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: #2c4a68;
  font-weight: 600;
}

.employee-department {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.employee-meta {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.meta-row {
  display: flex;
  gap: 8px;
  align-items: start;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}

.meta-label {
  min-width: 78px;
  color: var(--muted);
  flex: 0 0 auto;
}

.meta-value a {
  color: var(--primary);
  text-decoration: none;
}

.status {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.status.error {
  display: block;
  background: #fff4f4;
  color: #9b2c2c;
  border: 1px solid #f1caca;
}
.modal-photo-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #eef5fb 0%, #e4eff9 100%);
  color: #7b94ac;
  text-align: center;
  padding: 20px;
}
.photo-placeholder-initials {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(11, 99, 182, 0.12);
  color: #123252;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 1px;
}

.photo-placeholder-text {
  margin-top: 14px;
  font-size: 14px;
  color: #6d849b;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(180, 35, 24, 0.12);
}

.employee-card .status-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-box {
  display: none;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.tree-wrap {
  margin-top: 18px;
  max-height: calc(100vh - 240px);
  overflow: auto;
  padding-right: 6px;
}

.tree-group {
  margin-bottom: 18px;
}

.tree-group-title {
  font-size: 15px;
  font-weight: 800;
  color: #123252;
  margin: 0 0 8px;
  padding: 0 6px;
}

.tree-node {
  margin-bottom: 8px;
}

.tree-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  transition: background 0.18s ease;
}

.tree-line:hover {
  background: #f7fbff;
}

.tree-toggle {
  width: 24px;
  height: 24px;
  border: 1px solid #cfe2f5;
  background: #f3f9ff;
  color: var(--primary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  flex: 0 0 auto;
  transition: transform 0.18s ease, background 0.18s ease;
}

.tree-toggle:hover {
  background: #eaf4fd;
  transform: scale(1.05);
}

.tree-spacer {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.tree-label {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  color: #123252;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.tree-label.active {
  color: var(--primary);
  font-weight: 700;
}

.tree-children {
  margin-left: 18px;
  padding-left: 10px;
  border-left: 1px dashed #d7e7f5;
  display: none;
}

.tree-children.open {
  display: block;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.breadcrumbs.large {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 800;
  color: #123252;
}

.breadcrumb-link,
.modal-breadcrumb-link {
  color: var(--primary);
  cursor: pointer;
}

.breadcrumb-link:hover,
.modal-breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: #90a5b8;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 35, 59, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
}

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

.modal-card {
  width: min(1080px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(11, 68, 122, 0.18);
  padding: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid #cfe2f5;
  background: #f3f9ff;
  color: var(--primary);
  border-radius: 14px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  z-index: 3;
}

.modal-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: start;
}

.modal-photo-wrap {
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.modal-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 18px;
  display: block;
  background: #eef5fb;
}

.modal-photo-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #eef5fb 0%, #e4eff9 100%);
  color: #7b94ac;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  padding: 20px;
}

.modal-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.modal-title-row {
  display: block;
  padding-right: 0;
}

.modal-title {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 800;
  color: #123252;
  margin: 0;
  padding-right: 240px;
}

.modal-title-row .status-badge {
  position: absolute;
  top: 18px;
  right: 72px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  background: #fff4f1;
  color: #c2412d;
  border: 1px solid #f1d4cd;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.modal-position {
  margin-top: 14px;
  font-size: 19px;
  line-height: 1.45;
  color: #2c4a68;
  font-weight: 600;
}

.modal-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.modal-info-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.modal-info-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.modal-info-value {
  color: #123252;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}

.modal-info-value a {
  color: var(--primary);
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
  margin-top: 28px;
}

.modal-actions-left {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
}

.modal-actions-right {
  display: flex;
  justify-content: flex-end;
  margin-left: auto;
  flex: 0 0 auto;
}

.placeholder {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 30px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 15px;
}

.employee-card.highlighted {
  outline: 2px solid rgba(11, 99, 182, 0.28);
  box-shadow: 0 0 0 6px rgba(11, 99, 182, 0.08), var(--shadow-hover);
}

@media (max-width: 1400px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .tree-wrap {
    max-height: none;
  }
}

@media (max-width: 980px) {
  .cards,
  .employee-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .modal-photo-wrap {
    max-width: 320px;
  }

  .modal-info-grid {
    grid-template-columns: 1fr;
  }
}

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

@media (max-width: 760px) {
  .container {
    padding: 18px;
  }

  .topbar {
    padding: 18px;
    border-radius: 20px;
  }

  .search-row {
    flex-direction: column;
  }

  .cards,
  .employee-cards,
  .employees-grid {
    grid-template-columns: 1fr;
  }

  .main-header,
  .section-header,
  .content-header {
    flex-direction: column;
    align-items: start;
  }

  .filters-row {
    align-items: flex-start;
  }

  .header-logo {
    height: 72px;
  }

  .service-icon {
    width: 32px;
    height: 32px;
  }

  .fav-btn {
    width: 42px;
    height: 42px;
  }

  .employee-name {
    padding-right: 0;
  }

  .employee-card .status-badge,
  .modal-title-row .status-badge {
    position: static;
    margin-bottom: 12px;
    margin-right: 0;
  }

  .modal-card {
    padding: 20px;
  }

  .modal-title {
    font-size: 28px;
  }

.modal-title-row {
  padding-right: 0;
  min-height: auto;
}

.modal-title-row .status-badge {
  position: static;
  margin-top: 8px;
  margin-bottom: 12px;
}

.modal-actions {
  flex-direction: column;
  align-items: stretch;
  flex-wrap: wrap;
}

.modal-actions-left,
.modal-actions-right {
  width: 100%;
  justify-content: flex-start;
  margin-left: 0;
}
}
