/* Company setup: the full-screen wizard (no top bar), and Settings afterwards (list + panel). */
.setup-shell {
  min-height: 100vh;
  background: var(--lb-bg);
}

/* Navy header bar, like the app's header. */
.setup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 64px;
  padding: 0 28px;
  color: #fff;
  background:
    radial-gradient(26rem 10rem at 100% 0%, rgba(var(--lb-accent-rgb), 0.28), transparent 70%),
    linear-gradient(120deg, var(--lb-primary-active) 0%, var(--lb-primary) 60%, var(--lb-navy-lift) 140%);
}

.setup-brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.setup-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.setup-company {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
}

.setup-header .setup-skip {
  --bs-btn-color: rgba(255, 255, 255, 0.85);
  --bs-btn-hover-color: #fff;
  font-weight: 500;
}

.setup-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

/* Step bar: numbered dots joined by a line; done steps get a tick. */
.setup-stepper {
  display: flex;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}

.setup-stepper-item {
  position: relative;
  flex: 1;
  text-align: center;
}

.setup-stepper-item + .setup-stepper-item::before {
  content: "";
  position: absolute;
  top: 16px;
  right: 50%;
  left: -50%;
  height: 2px;
  background: var(--lb-border);
}

.setup-stepper-item.is-done + .setup-stepper-item::before,
.setup-stepper-item.is-done + .setup-stepper-item.is-current::before {
  background: var(--lb-accent);
}

.setup-stepper-link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--lb-muted);
  text-decoration: none;
}

.setup-stepper-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 0.875rem;
  font-weight: 700;
  background: var(--lb-surface);
  border: 2px solid var(--lb-border);
  border-radius: 50%;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.setup-stepper-label {
  font-size: 0.8125rem;
  font-weight: 500;
}

.is-current .setup-stepper-dot {
  color: #fff;
  background: var(--lb-gradient);
  border-color: var(--lb-primary);
  box-shadow: 0 0 0 4px rgba(var(--lb-accent-rgb), 0.2);
}

.is-current .setup-stepper-label {
  font-weight: 700;
  color: var(--lb-ink);
}

.is-done .setup-stepper-dot {
  color: #fff;
  background: var(--lb-gradient-accent);
  border-color: var(--lb-accent-strong);
}

.is-skipped .setup-stepper-dot { border-style: dashed; }

.setup-stepper-link:hover .setup-stepper-dot { border-color: var(--lb-primary); }

/* The step card slides up and fades in on every step (smooth movement between steps). */
.setup-card {
  animation: setup-step-in 0.35s ease-out both;
}

@keyframes setup-step-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.setup-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1.1rem 1.5rem;
}

.setup-step-count {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lb-muted);
}

.setup-card .card-body { padding: 1.5rem; }

.setup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
}

@media (max-width: 576px) {
  .setup-header { padding: 0 16px; }
  .setup-company { display: none; }
  .setup-stepper-label { display: none; }
}

/* Company structure: names as bullets in a row, each removable (bullet_list_controller.js). */
.bullet-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.bullet-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem 0.3rem 0.75rem;
  font-size: 0.875rem;
  background: var(--lb-surface);
  border: 1px solid var(--lb-border);
  border-radius: 999px;
}

/* The bullet itself, in the accent. */
.bullet-item::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--lb-accent);
  border-radius: 50%;
}

/* Read-only bullets (no remove button) get even padding. */
.bullet-item:not(:has(.bullet-remove)) { padding-right: 0.75rem; }

.bullet-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--lb-muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.bullet-remove:hover,
.bullet-remove:focus-visible {
  color: #B42318;
  background: #FDECEA;
}

/* The "type a name and Add" row under a bullet list: pill fields side by side, wrapping on small screens, with a
   round Add button. (Designations also have a department box.) */
.add-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  max-width: 680px;
}

.add-bar .form-control,
.add-bar .form-select {
  flex: 1 1 200px;
  min-width: 0;
}

.add-bar .form-select { flex-basis: 230px; padding-right: 2.25rem; }
.add-bar .btn { flex: none; }

/* Branches (Company profile, Module 6): one bordered block per branch. */
.branch-row {
  padding: 1rem;
  background: var(--lb-surface);
  border: 1px solid var(--lb-border);
  border-radius: 8px;
}

/* Coordinates box and "Use my current location": side by side, stacked on phones. */
.branch-location {
  display: flex;
  gap: 0.5rem;
}

/* The button keeps the width of its text; the coordinates box takes the rest. */
.branch-location .btn { flex: none; }
.branch-location .form-control { flex: 1 1 auto; min-width: 0; }

@media (max-width: 575.98px) {
  .branch-location { flex-direction: column; }
}

/* Settings: the section list on the left, the open section on the right (setups/settings). */
.settings-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--lb-surface);
  border: 1px solid var(--lb-border-soft);
  border-radius: var(--lb-radius-lg);
  box-shadow: var(--lb-shadow);
}

.settings-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--lb-ink);
  text-decoration: none;
  border-radius: var(--lb-radius);
  transition: background-color 0.15s ease;
}

.settings-nav-link:hover { color: var(--lb-ink); background: var(--lb-hover); }
.settings-nav-link.active { background: var(--lb-primary-soft); }

.settings-nav-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 16px;
  color: var(--lb-muted);
  background: var(--lb-bg);
  border-radius: 9px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.settings-nav-link.active .settings-nav-icon { color: #fff; background: var(--lb-gradient); }

.settings-nav-text { display: flex; flex-direction: column; min-width: 0; }
.settings-nav-title { font-weight: 600; line-height: 1.3; }

.settings-nav-desc {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--lb-muted);
}

.settings-nav-chevron { margin-left: auto; font-size: 12px; color: var(--lb-border); }
.settings-nav-link.active .settings-nav-chevron { color: var(--lb-primary); }

.settings-panel {
  background: var(--lb-surface);
  border: 1px solid var(--lb-border-soft);
  border-radius: var(--lb-radius-lg);
  box-shadow: var(--lb-shadow);
  animation: settings-in 0.25s var(--lb-ease);
}

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

.settings-panel-header { padding: 1.4rem 1.75rem 1.1rem; border-bottom: 1px solid var(--lb-border-soft); }
.settings-panel-body { padding: 1.5rem 1.75rem 1.75rem; }

/* Narrow forms: short fields read faster than full-width ones. Tables (leave types) and branch rows get more room. */
.settings-form { max-width: 560px; min-width: 0; margin: 0; padding: 0; border: 0; }
.settings-form-wide { max-width: none; }
.field-sm { max-width: 160px; }

.settings-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--lb-border-soft);
}

.settings-note {
  display: flex;
  gap: 0.5rem;
  margin: 1.5rem 0 0;
  padding: 0.75rem 0.9rem;
  font-size: 13px;
  color: var(--lb-accent-ink);
  background: var(--lb-accent-soft);
  border-radius: var(--lb-radius);
}

/* Tablets and phones: the list becomes a row of scrollable chips above the panel. */
@media (max-width: 991.98px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }

  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .settings-nav-link { flex-shrink: 0; padding: 8px 12px; }
  .settings-nav-desc,
  .settings-nav-chevron { display: none; }
  .settings-nav-icon { width: 28px; height: 28px; font-size: 14px; }
  .settings-panel-header,
  .settings-panel-body { padding-right: 1.1rem; padding-left: 1.1rem; }
}

/* Leave policy table: short number boxes and a dropdown wide enough for its label. */
.leave-table .form-control { width: 84px; }
.leave-table .form-select { min-width: 135px; }
.leave-table td:first-child { font-weight: 600; white-space: nowrap; }


/* ---- Settings in one colour: the theme's teal accent, on the menu icons, the open item and the panel ---- */
.settings-nav-link, .settings-panel { --tone: var(--lb-accent-strong); --tone-soft: var(--lb-accent-soft); }

.settings-nav-icon { color: var(--tone); background: var(--tone-soft); }
.settings-nav-link:hover .settings-nav-icon { background: var(--tone-soft); }

.settings-nav-link { position: relative; }
.settings-nav-link.active {
  background: linear-gradient(90deg, var(--tone-soft) 0%, rgba(255, 255, 255, 0) 100%);
  box-shadow: inset 0 0 0 1px var(--tone-soft);
}

.settings-nav-link.active::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -6px;
  width: 4px;
  background: var(--tone);
  border-radius: 0 4px 4px 0;
}

.settings-nav-link.active .settings-nav-icon { color: #fff; background: var(--tone); box-shadow: 0 4px 10px color-mix(in srgb, var(--tone) 35%, transparent); }
.settings-nav-link.active .settings-nav-chevron { color: var(--tone); }

/* The open panel: a line of the section's colour along the top, and a tinted header with its icon. */
.settings-panel { position: relative; overflow: hidden; border-top: 4px solid var(--tone); }

.settings-panel-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(100deg, var(--tone-soft) 0%, rgba(255, 255, 255, 0) 70%);
}

.settings-panel-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  font-size: 1.3rem;
  color: #fff;
  background: var(--tone);
  border-radius: 14px;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--tone) 35%, transparent);
}

.settings-panel .form-section-title i,
.settings-panel .form-label i { color: var(--tone); }

.settings-panel .form-section-title {
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--tone-soft);
}

/* Focus and primary actions inside a section pick up its tone. */
.settings-panel .form-control:focus,
.settings-panel .form-select:focus { border-color: var(--tone); box-shadow: 0 0 0 0.22rem color-mix(in srgb, var(--tone) 18%, transparent); }
.settings-panel .bullet-item::before { background: var(--tone); }
.settings-panel .bullet-item { background: var(--tone-soft); border-color: transparent; }
.settings-panel .table thead th { background: var(--tone-soft); color: var(--tone); }

/* The new hire's onboarding wizard reuses the setup wizard's shell; the step's own form card sits flat inside the card. */
.setup-card form.card { border: 0; box-shadow: none; background: transparent; }
.setup-card form.card.card-body { padding: 0; }
.setup-card .form-narrow { max-width: none; }

/* Every card in setup is the same width (the Settings panels and the wizard card): 760px, or the screen when it is narrower. Short
   forms are kept to 620px inside it for readability; the wide ones (the leave table, branches) use the whole card. */
.settings-panel { width: 760px; max-width: 100%; }
.setup-card { width: 760px; max-width: 100%; margin-inline: auto; }
.setup-card .card-body > *,
.settings-panel-body > * { max-width: 620px; }
.settings-panel-body > form:has(.settings-form-wide),
.setup-card .card-body > form:has(.leave-table) { max-width: none; }

/* Structure settings (CR-69): a card per department, its designations inside it. */
.structure-groups { display: flex; flex-direction: column; gap: 0.9rem; }
.structure-dept { padding: 0.9rem 1rem 1rem; background: var(--lb-surface); border: 1px solid var(--lb-border-soft); border-radius: var(--lb-radius-lg); }
.structure-dept.is-new { border-color: var(--lb-accent); box-shadow: 0 0 0 3px rgba(var(--lb-accent-rgb), 0.12); }
.structure-dept.is-orphan { border-color: #E0A800; background: #FFF9E6; }
.structure-dept-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.structure-dept-name { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 1.02rem; font-weight: 700; }
.structure-dept-name i { color: var(--lb-accent-strong); }
.structure-dept-remove { padding: 0.2rem 0.6rem; font-size: 0.82rem; color: var(--lb-danger); background: transparent; border: 0; border-radius: 999px; }
.structure-dept-remove:hover { background: rgba(180, 35, 24, 0.08); }
/* "No designations yet." shows only while the card has none. */
.structure-dept:has(.bullet-item) .structure-empty { display: none; }
.structure-dept:not(:has(.bullet-item)) .structure-designations { display: none; }
.structure-groups > template { display: none; }
