* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #f4f6fb;
  color: #222;
}

/* ============ TOP BAR ============ */
.top-bar {
  background: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  position: relative;
}

/* Logo always on the left */
.logo {
  flex-shrink: 0;
}

.logo img {
  height: 80px;
  width: auto;
  max-width: 100%;
}

/* Title perfectly centered for desktop/tablet */
.title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.25rem;
  font-weight: 700;
  color: black;
  text-align: center;
}

/* Optional subtitle inside top-bar */
.top-bar .subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* ============ LAYOUT WRAPPER ============ */
.container {
  max-width: 1140px;
  margin: 24px auto;
  padding: 0 16px;
}

/* ============ CARDS ============ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.card h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: #555;
}

.card p {
  font-size: 1.6rem;
  font-weight: 600;
}

/* ============ MAIN GRID ============ */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr);
  gap: 18px;
}

/* Stack panels on smaller screens */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* ============ PANELS ============ */
.panel {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel-header h2 {
  font-size: 1.1rem;
}

/* ============ CHARTS ============ */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.chart-box {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.chart-box h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: #333;
  text-align: center;
}

/* ============ TABLE ============ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: #eef2ff;
}

th,
td {
  padding: 8px;
  border-bottom: 1px solid #eee;
  text-align: left;
}

tbody tr:hover {
  background: #fafafa;
}

/* Enable horizontal scroll for wide tables on mobile */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

/* ============ FORM ============ */
form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 0.85rem;
  color: #444;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

input {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
}

button {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: #2563eb;
  color: white;
  align-self: flex-start;
}

button:hover {
  background: #1d4ed8;
}

.form-status {
  min-height: 18px;
  font-size: 0.8rem;
  margin-top: 4px;
}

.form-status.success {
  color: #15803d;
}

.form-status.error {
  color: #b91c1c;
}

/* ============ AI PANEL ============ */
.ai-panel {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.ai-panel h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.ai-result {
  margin-top: 8px;
  font-size: 0.85rem;
  padding: 8px;
  border-radius: 8px;
  background: #f9fafb;
}

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  font-size: 0.8rem;
  padding: 16px;
  margin-top: 24px;
  color: #666;
}

/* ============ RESPONSIVE TWEAKS ============ */

/* Tablet & small laptop */
@media (max-width: 768px) {
  .top-bar {
    padding: 10px 12px;
  }

  .logo img {
    height: 60px;
  }

  .title {
    font-size: 1.1rem;
  }

  .container {
    padding: 0 12px;
  }

  button {
    width: 100%;          /* full-width buttons on tablet/mobile */
    text-align: center;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .top-bar {
    flex-direction: row;
    justify-content: flex-start;
  }

  /* On very small screens, avoid absolute centering issues */
  .title {
    position: static;
    transform: none;
    margin-left: 8px;
    text-align: left;
  }

  .logo img {
    height: 48px;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .charts {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 0.8rem;
  }
}
