/* ═══════════════════════════════════════════════════
   DIC Admin · Cargos (cargos.css)
   ═══════════════════════════════════════════════════ */

/* ── Layout principal: info + grade ── */
.cg-layout {
  display: grid;
  grid-template-columns: 268px 1fr;
  gap: 22px;
  align-items: start;
}

/* ════════════════════════════════════════
   PAINEL INFORMATIVO (esquerda)
   ════════════════════════════════════════ */
.cg-info-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  padding: 24px;
  position: sticky;
  top: 20px;
}

.cg-info-card__icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.cg-info-card__title {
  font-size: 0.93rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin: 0 0 8px;
}

.cg-info-card__desc {
  font-size: 0.79rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.65;
  margin: 0;
}

.cg-info-card__divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 18px 0;
}

.cg-info-card__section {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 12px;
}

.cg-info-card__steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.cg-info-card__step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.79rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

.cg-info-card__step-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.cg-info-card__step strong {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.cg-info-card__tip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  background: hsl(var(--primary) / 0.06);
  border-radius: 9px;
  border: 1px solid hsl(var(--primary) / 0.14);
}

.cg-info-card__tip svg {
  flex-shrink: 0;
  color: hsl(var(--primary));
  margin-top: 1px;
}

.cg-info-card__tip span {
  font-size: 0.76rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.55;
}

/* ════════════════════════════════════════
   PAINEL DIREITO
   ════════════════════════════════════════ */
.cg-panel__head {
  margin-bottom: 16px;
}

.cg-panel__title {
  font-size: 0.88rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin: 0 0 3px;
}

.cg-panel__subtitle {
  font-size: 0.74rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

/* ── Cards grid ── */
.cg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

/* ── Card de hierarquia ── */
.cg-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  position: relative;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}

.cg-card:hover {
  border-color: hsl(var(--primary) / 0.45);
  box-shadow: 0 4px 18px hsl(var(--primary) / 0.1);
  transform: translateY(-2px);
}

.cg-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.cg-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s, color 0.16s;
}

.cg-card:hover .cg-card__icon {
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}

.cg-card__badge {
  font-size: 0.64rem;
  font-weight: 700;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

.cg-card__name {
  font-size: 0.87rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 5px;
  line-height: 1.3;
}

.cg-card__meta {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
}

/* ── Card "nova hierarquia" ── */
.cg-card--new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-style: dashed;
  min-height: 110px;
  color: hsl(var(--muted-foreground));
  transform: none !important;
  box-shadow: none !important;
}

.cg-card--new:hover {
  border-color: hsl(var(--primary) / 0.5);
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.03);
}

.cg-card__new-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: hsl(var(--muted));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.cg-card--new:hover .cg-card__new-icon {
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}

.cg-card__new-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ════════════════════════════════════════
   MODAL OVERLAY
   ════════════════════════════════════════ */

/* Header layout */
.cg-modal__header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cg-modal__header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cg-modal__icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cg-modal__subtitle {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  margin: 2px 0 0;
}

.cg-modal__del-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid hsl(var(--border));
  background: none;
  cursor: pointer;
  color: hsl(0 70% 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.13s, border-color 0.13s;
}

.cg-modal__del-btn:hover {
  background: hsl(0 70% 50% / 0.1);
  border-color: hsl(0 70% 50% / 0.4);
}

/* Field section */
.cg-modal__field-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cg-modal__name-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.cg-modal__name-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cg-modal__id-badge {
  font-size: 0.71rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  margin-bottom: 1px;
}

.cg-field__label {
  font-size: 0.73rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}

.cg-field__input {
  padding: 8px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--input));
  color: hsl(var(--foreground));
  font-family: inherit;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.13s;
  width: 100%;
  box-sizing: border-box;
}

.cg-field__input:focus { border-color: hsl(var(--primary)); }

.cg-field__hint {
  font-size: 0.71rem;
  color: hsl(var(--muted-foreground));
  margin: 2px 0 0;
  line-height: 1.5;
  opacity: 0.8;
}

/* Divider inside body */
.cg-modal__divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 2px 0;
}

/* List section */
.cg-list-section__head {
  margin-bottom: 10px;
}

/* Button variants */
.cg-btn--ghost {
  background: none;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.cg-btn--ghost:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  filter: none;
}

.cg-btn--add-cargo {
  background: none;
  border: 1px dashed hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.cg-btn--add-cargo:hover {
  border-color: hsl(var(--primary) / 0.5);
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.04);
  filter: none;
}


.cg-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.cg-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.cg-modal__box {
  position: relative;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  width: min(700px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.cg-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

.cg-modal__title {
  font-size: 0.93rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin: 0;
  line-height: 1.2;
}

.cg-modal__close {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: none;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.13s, color 0.13s;
}

.cg-modal__close:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.cg-modal__body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Name + ID + delete row */
.cg-fields {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.cg-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cg-field--name { flex: 1; }
.cg-field--id   { width: 90px; }

.cg-field label {
  font-size: 0.73rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}

.cg-field input {
  padding: 7px 11px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--input));
  color: hsl(var(--foreground));
  font-family: inherit;
  font-size: 0.83rem;
  outline: none;
  transition: border-color 0.13s;
}

.cg-field input:focus { border-color: hsl(var(--primary)); }

.cg-field input[readonly] {
  opacity: 0.55;
  cursor: default;
}

.cg-del-hier {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid hsl(var(--border));
  background: none;
  cursor: pointer;
  color: hsl(0 70% 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.13s, border-color 0.13s;
}

.cg-del-hier:hover {
  background: hsl(0 70% 50% / 0.1);
  border-color: hsl(0 70% 50% / 0.4);
}

/* Lista de cargos section */
.cg-list__head {
  font-size: 0.83rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin: 0 0 4px;
}

.cg-list__note {
  font-size: 0.73rem;
  color: hsl(var(--muted-foreground));
  margin: 0 0 10px;
  line-height: 1.5;
}

.cg-list__note strong { color: hsl(var(--foreground)); }

.cg-list {
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  overflow: hidden;
}

.cg-loading, .cg-empty {
  padding: 24px;
  text-align: center;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}

/* List item */
.cg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  transition: background 0.1s;
}

.cg-item:last-child { border-bottom: none; }
.cg-item.dragging   { opacity: 0.35; }
.cg-item.drag-over  { border-top: 2px solid hsl(var(--primary)); }

.cg-item__num {
  width: 22px;
  font-size: 0.73rem;
  color: hsl(var(--muted-foreground));
  text-align: right;
  flex-shrink: 0;
}

.cg-item__handle {
  cursor: grab;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.13s;
}

.cg-item__handle:hover  { color: hsl(var(--foreground)); }
.cg-item__handle:active { cursor: grabbing; }

.cg-item__nome {
  flex: 1;
  font-size: 0.83rem;
  color: hsl(var(--foreground));
}

.cg-item__input {
  flex: 1;
  font-size: 0.83rem;
  color: hsl(var(--foreground));
  background: none;
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  padding: 3px 8px;
  font-family: inherit;
  outline: none;
}

.cg-item__input:focus { border-color: hsl(var(--primary)); }

.cg-item__del {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}

.cg-item__del:hover {
  background: hsl(0 70% 50% / 0.1);
  color: hsl(0 70% 50%);
}

/* Modal footer */
.cg-modal__footer {
  padding: 14px 22px;
  border-top: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cg-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.14s, filter 0.14s;
}

.cg-btn:hover    { filter: brightness(0.9); }
.cg-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.cg-btn--add  { background: #0ea5a0; color: #fff; }
.cg-btn--save { background: hsl(210 80% 48%); color: #fff; }

/* ════════════════════════════════════════
   RESPONSIVIDADE
   ════════════════════════════════════════ */
@media (max-width: 860px) {
  .cg-layout {
    grid-template-columns: 1fr;
  }

  .cg-info-card {
    position: static;
  }
}
