/* Device management page - aligned with dashboard/analytics visual */
.dm-body {
  padding: 24px 28px;
  background: var(--bg);
  color: var(--text);
}
.dm-main {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header - bar style like row1 */
.dm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--card);
  padding: 20px 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.dm-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
}
.dm-back-link {
  display: inline-block;
  padding: 10px 14px;
  background: #4CAF50;
  color: white;
  text-decoration: none;
  font-weight: 700;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dm-back-link:hover {
  background: #3d8b3f;
  text-decoration: none;
}

/* Sections as cards */
.dm-section {
  margin-bottom: 28px;
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.dm-section h2 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #000;
  color: #fff;
  padding: 6px 12px;
  display: inline-block;
  margin: 0 0 12px 0;
}
.dm-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

/* Tables - header green like analytics */
.dm-table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}
.dm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.dm-table th,
.dm-table td {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  text-align: left;
}
.dm-table th {
  background: #679903;
  color: #000;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}
.dm-table tr:nth-child(even) {
  background: #f9fafb;
}
.dm-table tr:hover {
  background: #f1f5f9;
}

/* Forms - card style, inputs with focus ring */
.dm-form-wrap {
  margin-top: 12px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.dm-form-wrap label {
  display: inline-block;
  margin-right: 12px;
  margin-bottom: 8px;
}
.dm-form-wrap input {
  padding: 8px 12px;
  margin-left: 4px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.dm-form-wrap input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

/* Buttons - primary black/white, secondary black, delete red */
.dm-section button {
  padding: 8px 16px;
  cursor: pointer;
  background: #1b1b1b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
}
.dm-section button:hover:not(:disabled) {
  background: #333;
}
.dm-section button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.dm-btn-small {
  padding: 4px 10px;
  font-size: 0.85rem;
  margin-right: 4px;
  background: #111;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
}
.dm-btn-small:hover:not(:disabled) {
  background: #333;
}
.dm-delete-client,
.dm-delete-unit {
  background: #b91c1c;
}
.dm-delete-client:hover:not(:disabled),
.dm-delete-unit:hover:not(:disabled) {
  background: #991b1b;
}
.dm-save-btn {
  margin-top: 12px;
}

/* Hints and admin list */
.dm-hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.dm-admin-list {
  margin-bottom: 12px;
}
.dm-admin-list .dm-admin-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.dm-admin-list .dm-admin-item span {
  flex: 1;
}

/* Modals */
.dm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.dm-modal {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
.dm-modal h3 {
  margin-top: 0;
}
.dm-modal label {
  display: block;
  margin-bottom: 8px;
}
.dm-modal input {
  width: 100%;
  padding: 8px 12px;
  margin-top: 4px;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.dm-modal input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}
.dm-modal .dm-modal-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}
.dm-modal .dm-modal-actions button[type="submit"] {
  background: #1b1b1b;
  color: #fff;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
.dm-modal .dm-modal-actions button[type="submit"]:hover {
  background: #333;
}
.dm-modal .dm-modal-actions .dm-cancel-modal {
  background: #111;
  color: #fff;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.dm-modal .dm-modal-actions .dm-cancel-modal:hover {
  background: #333;
}

/* Messages - loading / unauthorized */
.dm-message {
  padding: 24px;
  text-align: center;
  color: var(--text);
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

@media (max-width: 600px) {
  .dm-body {
    padding: 16px 16px;
  }
  .dm-header {
    padding: 16px 16px;
  }
  .dm-section {
    padding: 16px;
  }
}
