/* main.css — eCon Reports portal */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #2F5496;
  --blue-light: #ADD8E6;
  --blue-mid:   #BDD7EE;
  --blue-sub:   #DEEAF1;
  --grey-row:   #F2F2F2;
  --white:      #FFFFFF;
  --border:     #AAAAAA;
  --text:       #333333;
  --text-hdr:   #1a3a6b;
  --red:        #C00000;
  --font:       'Segoe UI', Arial, sans-serif;
}

body { font-family: var(--font); font-size: 13px; color: var(--text); background: #eef2f7; }

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--blue); color: white;
  padding: 0 20px; height: 46px;
  position: sticky; top: 0; z-index: 100;
}
.logo { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 12px; }
.btn-logout {
  color: white; text-decoration: none; border: 1px solid rgba(255,255,255,.5);
  padding: 3px 10px; border-radius: 3px;
}
.btn-logout:hover { background: rgba(255,255,255,.15); }

/* ── Toolbar ── */
.toolbar {
  background: white; border-bottom: 1px solid var(--border);
  padding: 10px 20px; display: flex; align-items: center;
  gap: 14px; flex-wrap: wrap; position: sticky; top: 46px; z-index: 90;
}
.search-group { display: flex; gap: 8px; align-items: center; }
#searchInput {
  border: 1px solid var(--border); border-radius: 3px;
  padding: 5px 10px; width: 240px; font-size: 12px;
}
#oppSelect {
  border: 1px solid var(--border); border-radius: 3px;
  padding: 5px 10px; font-size: 12px; min-width: 300px; max-width: 420px;
}
.report-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--border); border-radius: 3px;
  padding: 5px 12px; font-size: 11px; background: white;
  cursor: pointer; color: var(--text); white-space: nowrap;
}
.tab:hover  { background: var(--blue-sub); }
.tab.active { background: var(--blue); color: white; border-color: var(--blue); }
.btn-export {
  margin-left: auto; background: #1E7145; color: white;
  border: none; border-radius: 3px; padding: 6px 16px;
  font-size: 12px; cursor: pointer; white-space: nowrap;
}
.btn-export:disabled { background: #aaa; cursor: not-allowed; }
.btn-export:not(:disabled):hover { background: #155734; }

/* ── Report area ── */
.report-area { padding: 16px 20px; overflow-x: auto; }

.placeholder { text-align: center; padding: 60px; color: #888; font-size: 14px; }

.loading {
  display: flex; align-items: center; gap: 10px;
  padding: 30px; color: #666;
}
.spinner {
  width: 22px; height: 22px; border: 3px solid #ddd;
  border-top-color: var(--blue); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Report header block ── */
.rpt-header {
  display: flex; margin-bottom: 8px;
  border: 1px solid black; font-size: 12px;
}
.rpt-header-title {
  flex: 0 0 220px; background: var(--blue-light);
  border-right: 1px solid black; padding: 6px 8px;
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.rpt-header-opp {
  flex: 0 0 130px; background: var(--blue-light);
  border-right: 1px solid black; padding: 6px 8px;
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.rpt-header-fields { display: flex; flex: 1; }
.rpt-header-field {
  flex: 1; border-left: 1px solid black; padding: 4px 8px;
  background: var(--blue-light);
}
.rpt-header-field:first-child { border-left: none; }
.rpt-header-label { font-size: 9px; font-weight: 700; color: #555; text-transform: uppercase; }
.rpt-header-value { font-size: 12px; color: var(--text); margin-top: 1px; }

/* ── Tables ── */
.rpt-table-wrap { overflow-x: auto; margin-bottom: 14px; }
table.rpt { border-collapse: collapse; width: 100%; font-size: 11px; }
table.rpt th, table.rpt td {
  border: 1px solid black; padding: 4px 6px;
  vertical-align: middle; text-align: center;
}
table.rpt th {
  background: var(--blue-light); font-weight: 700;
  font-size: 11px; white-space: nowrap;
}
table.rpt td.left  { text-align: left; }
table.rpt td.right { text-align: right; }
table.rpt td.num   { text-align: right; font-variant-numeric: tabular-nums; }

/* Row types */
tr.row-odd  td { background: var(--grey-row); }
tr.row-even td { background: var(--white); }
tr.row-white td { background: var(--white); }

tr.sub-total td {
  background: var(--blue-mid); font-weight: 700;
  border-top: 2px solid var(--blue);
}
tr.grand-total td {
  background: var(--blue); color: white;
  font-weight: 700; font-size: 12px;
  border-top: 2px solid black;
}
tr.room-header td {
  background: var(--blue-sub); font-weight: 700;
  color: var(--text-hdr); text-align: left;
  border-top: 2px solid var(--blue);
  padding: 5px 8px; font-size: 11px;
}

/* Section heading above a table */
.section-title {
  background: var(--blue); color: white;
  font-weight: 700; font-size: 11px;
  padding: 5px 10px; margin-top: 14px; margin-bottom: 0;
  border: 1px solid #1a3a6b;
}

/* ── Error ── */
.error-box {
  background: #FFF0F0; border: 1px solid var(--red);
  color: var(--red); padding: 12px 16px; border-radius: 4px; margin: 10px 0;
}
