:root {
  --ufs-blue: #0F204B;
  --ufs-red: #A71930;
  --ufs-gray-light: #f4f6f9;
  --ufs-gray-dark: #6b7280;
  --ufs-text: #1f2937;
  --ufs-border: #e5e7eb;
  --ufs-white: #ffffff;
  --ufs-table-head: #f9fafb;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: var(--ufs-gray-light);
  color: var(--ufs-text);
  line-height: 1.5;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.dashboard-container::before {
  content: "";
  display: block;
  height: 6px;
  background: linear-gradient(to right, var(--ufs-red), var(--ufs-blue));
  margin-bottom: 20px;
  border-radius: 4px;
}

/* Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ufs-logo {
  height: 90px;
  width: auto;
  max-width: 250px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-text h1 {
  margin: 0;
  line-height: 1.1;
}

.header-text p {
  margin-top: 6px;
}

.dashboard-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ufs-blue);
  margin-left: 320px;
}

.dashboard-header p {
  font-size: 0.95rem;
  color: var(--ufs-gray-dark);
  margin-left: 400px;
}

.refresh-btn {
  background: var(--ufs-blue);
  color: var(--ufs-white);
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: 0.3s ease;
}

.refresh-btn:hover {
  background: var(--ufs-red);
}

/* Generic Card */
.card {
  background: var(--ufs-white);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 18px rgba(15, 32, 75, 0.08);
  border-left: 4px solid var(--ufs-blue);
}

/* Overview Cards */
.overview-section {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.overview-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ufs-gray-dark);
  margin-bottom: 10px;
}

.overview-card p {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ufs-blue);
}

.overview-card:nth-child(2) {
  border-left-color: var(--ufs-red);
}

.overview-card:nth-child(2) p {
  color: var(--ufs-red);
}

.overview-card:nth-child(4) {
  border-left-color: var(--ufs-red);
}

.overview-card:nth-child(4) p {
  color: var(--ufs-red);
}

/* Main Chart */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  margin-bottom: 24px;
}

.large-card {
  min-height: 420px;
}

.chart-card h2,
.list-card h2,
.trends-card h2 {
  font-size: 1.15rem;
  margin-bottom: 18px;
  color: var(--ufs-blue);
  border-left: 4px solid var(--ufs-red);
  padding-left: 10px;
}

/* Secondary Grid */
.secondary-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* Trends Grid */
.trends-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Lists */
.data-list {
  list-style: none;
}

.data-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--ufs-border);
  font-size: 0.95rem;
  color: #374151;
}

.data-list li:last-child {
  border-bottom: none;
}

.chart-card canvas {
  display: block;
  width: 100% !important;
  height: 300px !important;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  background: var(--ufs-blue);
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ufs-border);
  font-size: 0.95rem;
}

th {
  font-weight: 700;
  color: var(--ufs-white);
}

td {
  color: #4b5563;
}

/* Canvas */
canvas {
  width: 100% !important;
  max-height: 320px;
}

/* Links */
a {
  color: var(--ufs-blue);
  text-decoration: none;
}

a:hover {
  color: var(--ufs-red);
}

/* Responsive */
@media (max-width: 1200px) {
  .overview-section {
    grid-template-columns: repeat(3, 1fr);
  }

  .secondary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .trends-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 16px;
  }

  .dashboard-header {
    align-items: flex-start;
  }

  .header-left {
    align-items: flex-start;
  }

  .ufs-logo {
    height: 52px;
    max-width: 180px;
  }

  .dashboard-header h1 {
    font-size: 1.6rem;
  }

  .overview-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .secondary-grid {
    grid-template-columns: 1fr;
  }

  .overview-card p {
    font-size: 1.5rem;
  }

  .large-card {
    min-height: 340px;
  }
}

@media (max-width: 480px) {
  .overview-section {
    grid-template-columns: 1fr;
  }

  .header-left {
    flex-direction: column;
    gap: 10px;
  }

  .ufs-logo {
    height: 48px;
    max-width: 170px;
  }

  .refresh-btn {
    width: 100%;
    text-align: center;
  }

  th,
  td {
    font-size: 0.88rem;
    padding: 10px 12px;
  }
}

.trend-row td {
  padding: 18px 14px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.trend-rank {
  width: 40px;
  color: #111827;
}

.trend-label {
  font-weight: 500;
  color: #111827;
}

.trend-score {
  width: 50px;
  color: #9ca3af;
  text-align: right;
}

.trend-bar-cell {
  width: 150px;
}

.trend-bar-bg {
  width: 130px;
  height: 18px;
  background: #eeeeee;
  overflow: hidden;
}

.trend-bar-fill {
  height: 100%;
  background: #4285f4;
}

/* Weekly Report Layout */
.report-layout {
  max-width: 1600px;
}

.report-header {
  margin-bottom: 18px;
}

.report-performance-card {
  display: grid;
  grid-template-columns: 0.9fr 1.3fr;
  gap: 30px;
  align-items: start;
  margin-bottom: 10px;
  border-left: none;
  border-radius: 18px 18px 0 0;
}

.performance-summary h2,
.report-panel h2 {
  color: var(--ufs-red);
  font-size: 2rem;
  line-height: 1.1;
  margin-bottom: 12px;
  border-left: none;
  padding-left: 0;
}

.performance-summary p {
  font-size: 1.15rem;
  line-height: 1.3;
  color: #111827;
}

.performance-summary strong {
  color: var(--ufs-red);
  font-weight: 800;
}

.performance-chart {
  height: 260px;
}

.performance-chart canvas {
  height: 250px !important;
}

.report-main-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.4fr 0.95fr;
  gap: 0;
  background: var(--ufs-white);
  border-radius: 0 0 18px 18px;
  overflow: hidden;
}

.report-panel {
  border-radius: 0;
  box-shadow: none;
  border-left: none;
  border-right: 6px solid var(--ufs-border);
  min-height: 430px;
  padding: 28px 34px;
}

.report-panel:last-child {
  border-right: none;
}

.device-panel canvas {
  height: 300px !important;
  margin-top: 20px;
}

.report-list {
  list-style: disc;
  padding-left: 24px;
}

.report-list li {
  border-bottom: none;
  padding: 4px 0;
  font-size: 1rem;
  line-height: 1.25;
  color: #111827;
}

.report-list strong,
.report-list .metric {
  color: var(--ufs-red);
  font-weight: 800;
}

.trends-heading {
  margin-top: 28px;
  font-size: 1.45rem !important;
}

.combined-trends-table {
  margin-top: 10px;
  font-size: 0.85rem;
}

.combined-trends-table thead tr {
  background: var(--ufs-red);
}

.combined-trends-table th {
  color: var(--ufs-white);
  padding: 8px 12px;
}

.combined-trends-table td {
  background: #ead7d9;
  padding: 8px 12px;
  color: #111827;
  border: 2px solid var(--ufs-white);
}

/* Responsive */
@media (max-width: 1100px) {
  .report-performance-card,
  .report-main-grid {
    grid-template-columns: 1fr;
  }

  .report-panel {
    border-right: none;
    border-bottom: 6px solid var(--ufs-border);
  }

  .report-panel:last-child {
    border-bottom: none;
  }
}

.metric {
  color: var(--ufs-red);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}