/* =========================================================
   PVT Executive Dashboard
========================================================= */

:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --progress: #6b21a8;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --bg-soft: #f8fafc;
  --card: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sarabun", sans-serif;
  color: var(--text-primary);
  background: linear-gradient(135deg, #eff6ff, #e0f2fe);
}

button,
select,
input {
  font-family: inherit;
}

.dashboard-container {
  width: min(1440px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.exec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
}

.exec-brand h1 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 28px;
}

.exec-brand p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-weight: 600;
}

.exec-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.exec-user-tag {
  padding: 10px 14px;
  background: #eff6ff;
  color: var(--primary-dark);
  border-radius: 999px;
  font-weight: 600;
}

.btn-logout {
  border: 0;
  background: var(--danger);
  color: #fff;
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.nav-section,
.panel-card {
  margin-top: 20px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

.nav-title,
.panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-title-compact {
  margin-bottom: 10px;
  padding-bottom: 0;
  border-bottom: none;
}

.panel-desc {
  margin: 0 0 15px;
  color: var(--text-secondary);
  font-size: 14px;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
}

.btn-dept {
  border: 0;
  padding: 12px 14px;
  border-radius: 14px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.d-print { background: #dc2626; }
.d-sheet { background: #2563eb; }
.d-tape { background: #16a34a; }
.d-blow { background: #9333ea; }
.d-drill { background: #ea580c; }
.d-garbage { background: #4b5563; }
.d-mono { background: #0891b2; }
.d-salan { background: #14532d; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.metric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

.card-primary { border-top: 5px solid var(--primary); }
.card-warning { border-top: 5px solid var(--warning); }
.card-progress { border-top: 5px solid var(--progress); }
.card-success { border-top: 5px solid var(--success); }

.metric-label {
  color: var(--text-secondary);
  font-weight: 700;
}

.metric-value {
  margin-top: 8px;
  font-size: 38px;
  font-weight: 700;
}

.metric-icon {
  font-size: 34px;
  opacity: 0.85;
}

.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }
.text-progress { color: var(--progress); }
.text-success { color: var(--success); }

.summary-box {
  padding: 20px;
  background: var(--bg-soft);
  border-radius: 14px;
  min-height: 100px;
  line-height: 1.8;
}

.exec-insight-box {
  padding: 20px;
  background: #0f172a;
  color: #fff;
  border-radius: 14px;
  line-height: 1.8;
}

.large-chart-wrapper {
  height: 380px;
}

.chart-wrapper {
  height: 310px;
}

.analytics-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
}

.control-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.form-select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 0 14px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  font-size: 15px;
}

.btn-global {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 0;
  border-radius: 14px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-excel {
  background: var(--success);
  color: #fff;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1050px;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  background: #f1f5f9;
  color: #334155;
  font-size: 14px;
  white-space: nowrap;
}

.empty-cell {
  text-align: center;
  padding: 40px !important;
  color: var(--text-secondary);
}

.badge-status {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-pending {
  color: #92400e;
  background: #fef3c7;
}

.status-progress {
  color: #581c87;
  background: #f3e8ff;
}

.status-resolved {
  color: #166534;
  background: #dcfce7;
}

.select-inline-status,
.input-inline-note {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  outline: none;
}

.input-inline-note {
  min-width: 240px;
}

.cell-detail {
  max-width: 320px;
  word-break: break-word;
  font-size: 14px;
  color: #334155;
}

.reporter-code {
  display: inline-block;
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 6px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
}

.small-note {
  display: block;
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 11px;
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-split {
    grid-template-columns: 1fr;
  }

  .nav-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .dashboard-container {
    width: min(100% - 20px, 1440px);
    margin-top: 10px;
  }

  .exec-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .exec-brand h1 {
    font-size: 22px;
  }

  .metrics-grid,
  .nav-grid {
    grid-template-columns: 1fr;
  }
}
