.page-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters-row { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--ypm-muted); }

.btn {
  border: 1px solid var(--ypm-line);
  background: #fff;
  color: var(--ypm-text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}
.btn.primary { background: linear-gradient(135deg, var(--ypm-primary), var(--ypm-primary-2)); color: #fff; border-color: transparent; }
.btn.danger { background: #fff5f4; border-color: #f3c6c0; color: var(--ypm-danger); }

.unit-entry-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.unit-entry-tab {
  border: 1px solid var(--ypm-line);
  background: #fff;
  color: var(--ypm-text);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.unit-entry-tab.active {
  background: linear-gradient(135deg, var(--ypm-primary), var(--ypm-primary-2));
  color: #fff;
  border-color: transparent;
}

.unit-stepper {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.unit-step-chip {
  border: 1px solid var(--ypm-line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ypm-muted);
  background: #f8fbff;
}

.unit-step-chip.active {
  color: var(--ypm-primary);
  border-color: #8adbd3;
  background: #edfdfa;
}

.unit-form-block {
  display: grid;
  gap: 12px;
}

.unit-form-block[hidden] {
  display: none !important;
}

.unit-section-card {
  border: 1px solid var(--ypm-line);
  border-radius: 14px;
  background: #fbfdff;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.unit-section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  flex-wrap: wrap;
}

.unit-section-head h4 {
  margin: 0;
  font-size: 16px;
}

.unit-section-head p {
  margin: 4px 0 0;
  color: var(--ypm-muted);
  font-size: 13px;
  line-height: 1.7;
}

.unit-inline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.unit-helper {
  color: var(--ypm-muted);
  font-size: 12px;
  line-height: 1.6;
}

.unit-preview {
  border: 1px dashed var(--ypm-line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.unit-preview strong {
  font-size: 14px;
  color: var(--ypm-text);
}

.unit-photo-tools {
  display: grid;
  gap: 10px;
}

.unit-photo-drop {
  border: 1px dashed var(--ypm-line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.unit-photo-drop input[type="file"] {
  width: 100%;
}

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

.unit-photo-item {
  position: relative;
  border: 1px solid var(--ypm-line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  aspect-ratio: 1 / 1;
}

.unit-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.unit-photo-item button {
  position: absolute;
  top: 8px;
  left: 8px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-weight: 700;
}

.unit-photo-empty {
  border: 1px dashed var(--ypm-line);
  border-radius: 12px;
  padding: 14px;
  color: var(--ypm-muted);
  font-size: 13px;
  background: #fff;
  text-align: center;
}

.unit-check-grid {
  display: grid;
  gap: 10px;
}

.unit-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ypm-text);
  font-size: 14px;
}

.unit-check input {
  width: 16px;
  height: 16px;
}

.unit-mode-panel {
  display: none;
}

.unit-mode-panel.active {
  display: block;
}

.unit-form-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.unit-form-actions .ypm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.unit-status-box {
  border: 1px solid var(--ypm-line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ypm-muted);
  font-size: 13px;
  line-height: 1.7;
}

.unit-status-box.success {
  border-color: #9adfd8;
  background: #eefcf9;
  color: #0b6f69;
}

.unit-status-box.error {
  border-color: #f3c6c0;
  background: #fff5f4;
  color: var(--ypm-danger);
}

.unit-bulk-help {
  border: 1px dashed var(--ypm-line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ypm-muted);
  font-size: 12px;
  line-height: 1.8;
}

.unit-account-card {
  border: 1px solid var(--ypm-line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfdff;
  display: grid;
  gap: 10px;
}

.unit-actions-stack {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.unit-table-meta {
  display: grid;
  gap: 2px;
}

.unit-table-meta strong {
  font-size: 14px;
}

.unit-table-meta span {
  color: var(--ypm-muted);
  font-size: 12px;
}

.badge.soft {
  background: #f8fbff;
  color: #28527a;
  border: 1px solid var(--ypm-line);
}

.badge.success {
  background: #eefcf9;
  color: #0b6f69;
  border: 1px solid #9adfd8;
}

.badge.warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.badge.danger {
  background: #fff5f4;
  color: var(--ypm-danger);
  border: 1px solid #f3c6c0;
}

.ypm-modal[data-modal="unit-form"] .ypm-modal-dialog {
  width: min(980px, 100%);
}

@media (max-width: 760px) {
  .page-toolbar {
    align-items: stretch;
  }

  .page-toolbar .ypm-actions,
  .filters-row {
    width: 100%;
  }

  .page-toolbar .ypm-actions .btn,
  .filters-row .btn,
  .filters-row .ypm-input,
  .filters-row .ypm-select {
    width: 100%;
  }

  .unit-inline-grid,
  .ypm-form-grid {
    grid-template-columns: 1fr;
  }

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

  .unit-form-actions {
    flex-direction: column;
  }

  .unit-form-actions .ypm-actions {
    width: 100%;
  }

  .unit-form-actions .btn {
    width: 100%;
  }
}
