/* ============================================================
   DASHBOARD — PC06 / CÔNG AN TỈNH NINH BÌNH
   Styles dành riêng cho trang Dashboard tổng quan
   ============================================================ */

/* ── Layout chính ────────────────────────────────────────── */
.db-main {
  background: #f6f8fb;
}

.db-content {
  padding: 24px 28px 40px;
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.db-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 18px;
}
.db-breadcrumb a {
  color: #bd0000;
  text-decoration: none;
  font-weight: 500;
}
.db-breadcrumb a:hover { text-decoration: underline; }
.db-breadcrumb .sep { color: #d1d5db; }
.db-breadcrumb .current { color: #374151; font-weight: 500; }

/* ── Page title ──────────────────────────────────────────── */
.db-page-title {
  font-size: 22px;
  font-weight: 900;
  color: #111827;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

/* ── Stat Cards Row ──────────────────────────────────────── */
.db-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

@media (max-width: 1400px) {
  .db-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .db-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.db-stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 18px 12px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.07);
  border: 1px solid #f0f2f5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.db-stat-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.db-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.db-stat-icon svg { width: 22px; height: 22px; }

.db-stat-icon.red    { background: #fff0f0; color: #bd0000; }
.db-stat-icon.orange { background: #fff7ed; color: #ea580c; }
.db-stat-icon.amber  { background: #fffbeb; color: #d97706; }
.db-stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.db-stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.db-stat-icon.rose   { background: #fff1f2; color: #e11d48; }

.db-stat-info { min-width: 0; }
.db-stat-value {
  font-size: 26px;
  font-weight: 900;
  color: #111827;
  line-height: 1;
}
.db-stat-label {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-stat-sparkline {
  height: 36px;
  width: 100%;
}

/* ── Charts + Alerts row ─────────────────────────────────── */
.db-mid-row {
  display: grid;
  grid-template-columns: 1fr 1fr 320px;
  gap: 16px;
  margin-bottom: 22px;
  align-items: stretch;
}

@media (max-width: 1350px) {
  .db-mid-row { grid-template-columns: 1fr 1fr; }
  .db-alert-panel { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .db-mid-row { grid-template-columns: 1fr; }
}

.db-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 22px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.07);
  border: 1px solid #f0f2f5;
}

.db-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 16px;
}

/* ── Alert panel ─────────────────────────────────────────── */
.db-alert-panel {
  background: #fff;
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.07);
  border: 1px solid #f0f2f5;
}

.db-alert-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 14px;
}

.db-alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
}
.db-alert-item:last-child { border-bottom: none; padding-bottom: 0; }
.db-alert-item:first-child { padding-top: 0; }

.db-alert-item:hover { opacity: 0.8; }

.db-alert-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.db-alert-icon-wrap svg { width: 18px; height: 18px; }

.alert-icon-purple { background: #f5f3ff; color: #7c3aed; }
.alert-icon-red    { background: #fff0f0; color: #bd0000; }
.alert-icon-blue   { background: #eff6ff; color: #2563eb; }
.alert-icon-orange { background: #fff7ed; color: #ea580c; }

.db-alert-body { flex: 1; min-width: 0; }
.db-alert-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #1b2430;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-alert-sub {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 1px;
}
.db-alert-count {
  font-size: 17px;
  font-weight: 900;
  color: #bd0000;
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
}
.db-alert-chevron {
  color: #d1d5db;
  flex-shrink: 0;
}
.db-alert-chevron svg { width: 14px; height: 14px; }

/* ── Recent Records Table ────────────────────────────────── */
.db-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 14px;
}

.db-table-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.07);
  border: 1px solid #f0f2f5;
  overflow: hidden;
  margin-bottom: 22px;
}

.db-table-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.db-table thead tr {
  background: #fdf5f5;
}

.db-table thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  border-bottom: 1px solid #f3f4f6;
  white-space: nowrap;
}

.db-table tbody tr {
  border-bottom: 1px solid #f9fafb;
  transition: background 0.12s;
}
.db-table tbody tr:hover { background: #fafbff; }
.db-table tbody tr:last-child { border-bottom: none; }

.db-table td {
  padding: 12px 16px;
  color: #374151;
  vertical-align: middle;
}

.db-table .td-code {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  color: #374151;
  font-weight: 700;
}

.db-table .td-facility-name { font-weight: 700; color: #111827; }
.db-table .td-facility-sub  { font-size: 11px; color: #9ca3af; margin-top: 1px; }

.db-table .td-date {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.db-table .td-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.db-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px;
  border-radius: 4px;
  line-height: 0;
  transition: color 0.12s, background 0.12s;
}
.db-action-btn:hover { color: #374151; background: #f3f4f6; }
.db-action-btn svg { width: 16px; height: 16px; }

/* ── Status badges ───────────────────────────────────────── */
.db-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.db-badge-pending  { background: #fff7ed; color: #d97706; }
.db-badge-process  { background: #f0fdf4; color: #16a34a; }
.db-badge-needmore { background: #eff6ff; color: #2563eb; }

/* ── Bottom bar chart ────────────────────────────────────── */
.db-bottom-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* ── Chart canvas ────────────────────────────────────────── */
.db-chart-wrap {
  position: relative;
  width: 100%;
}

/* ── Pie legend ──────────────────────────────────────────── */
.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #374151;
}
.pie-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Responsive adjustments ──────────────────────────────── */
@media (max-width: 768px) {
  .db-content { padding: 16px; }
  .db-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .db-main { margin-left: 0; }
}
