:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e3e6ec;
  --text: #1a1d29;
  --muted: #6b7280;
  --accent: #4f8cff;
  --good: #0f9d68;
  --good-bg: #e6f7ef;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 20px;
  margin: 0;
}

#last-synced {
  color: var(--muted);
  font-size: 13px;
}

/* ---- Shared button system ---- */
button {
  font-family: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 16px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 140, 255, 0.35);
}

.btn-primary:hover {
  background: #3d78e8;
  border-color: #3d78e8;
}

.btn-secondary {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #f0f2f6;
  border-color: #d5d9e2;
}

.btn-secondary.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 140, 255, 0.35);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

#sync-now-btn {
  min-width: 96px;
}

.platform-tabs {
  display: flex;
  padding: 14px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.platform-tab-group {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.platform-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 18px;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.platform-tab:hover:not(:disabled):not(.active) {
  background: #e9ebf0;
  color: var(--text);
}

.platform-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 140, 255, 0.35);
}

.platform-tab:disabled {
  cursor: default;
  opacity: 0.5;
}

main {
  padding: 24px 28px 60px;
  max-width: 1100px;
  margin: 0 auto;
}

.range-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}

.custom-date {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.custom-date label {
  font-size: 12px;
  color: var(--muted);
}

.custom-date input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
}


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

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.card .label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.card .value {
  font-size: 26px;
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.panel h2 {
  font-size: 15px;
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  background: var(--good-bg);
  color: var(--good);
}

canvas {
  width: 100% !important;
  max-height: 260px;
}
