* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f6f8;
  color: #1c2733;
}

/* ---- Login / signup / connect ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1c2733, #2e6fb0);
}
.login-card {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  width: 320px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-title { margin: 0 0 8px; font-size: 24px; }
.login-card p { color: #5a6b7a; font-size: 14px; margin-bottom: 20px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #d5dbe1;
  border-radius: 8px;
  font-size: 14px;
}
.login-card button, .connect-btn {
  width: 100%;
  padding: 11px;
  background: #2e6fb0;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.login-card button:hover, .connect-btn:hover { background: #245a8f; }
.connect-card { width: 380px; }
.connect-option { text-align: left; border: 1px solid #e5e9ec; border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.connect-option h3 { margin: 0 0 6px; font-size: 15px; }
.connect-option-desc { font-size: 12px; margin-bottom: 12px !important; }
.connect-btn-secondary { background: #5a6b7a; }
.connect-btn-secondary:hover { background: #45525e; }
.qwc-credentials { background: #eef6ff; border-radius: 8px; padding: 14px; margin-bottom: 18px; text-align: left; }
.qwc-credentials p { margin: 0 0 6px !important; font-size: 13px; }
.qwc-password { font-family: monospace; font-size: 15px; font-weight: 700; color: #1c2733; word-break: break-all; }
.qwc-hint { color: #5a6b7a; font-size: 12px !important; }
.qwc-steps { text-align: left; font-size: 13px; color: #3a4650; padding-left: 20px; margin-bottom: 16px; }
.qwc-steps li { margin-bottom: 8px; }
.login-err {
  background: #fdeaea;
  color: #c0392b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}
.login-alt { margin-top: 16px; font-size: 13px; }
.login-alt a { color: #2e6fb0; text-decoration: none; }
.login-footer { margin-top: 24px; font-size: 11px; color: #a3aeb8; }

/* ---- Dashboard ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #1c2733;
  color: #fff;
}
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-brand { font-size: 12px; font-weight: 400; color: #8fa3b3; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.last-synced { font-size: 12px; color: #b7c2cc; }
.sync-btn {
  background: #2e6fb0;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.sync-btn:hover { background: #245a8f; }
.sync-btn:disabled { opacity: 0.6; cursor: default; }
.logout-link { color: #b7c2cc; font-size: 13px; text-decoration: none; }
.logout-link:hover { color: #fff; }

.sync-error-banner {
  background: #fdeaea;
  color: #c0392b;
  padding: 10px 24px;
  font-size: 13px;
}

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

.period-toggle { display: inline-flex; border: 1px solid #d5dbe1; border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.period-toggle button {
  background: #fff; border: none; padding: 8px 16px; font-size: 13px; cursor: pointer;
  border-right: 1px solid #d5dbe1;
}
.period-toggle button:last-child { border-right: none; }
.period-toggle button.active { background: #2e6fb0; color: #fff; }

.period-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.period-nav button {
  background: #fff; border: 1px solid #d5dbe1; border-radius: 6px; padding: 6px 12px; cursor: pointer;
}
.period-label { font-weight: 600; font-size: 15px; }

.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
.kpi-card { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.kpi-label { font-size: 12px; color: #5a6b7a; margin-bottom: 6px; }
.kpi-value { font-size: 20px; font-weight: 700; }

.card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 20px; }
.card h2 { margin: 0 0 14px; font-size: 15px; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; }

.breakdown-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-content { background: #fff; border-radius: 10px; width: min(700px, 92vw); max-height: 80vh; display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e5e9ec; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #5a6b7a; }
.modal-body { padding: 16px 20px; overflow-y: auto; }

.drilldown-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.drilldown-table th, .drilldown-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #e5e9ec; }
.drilldown-table th { color: #5a6b7a; font-weight: 600; }

@media (max-width: 768px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .breakdown-row { grid-template-columns: 1fr; }
}

/* ---- Landing page ---- */
.landing { background: #fff; }

.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px; max-width: 1100px; margin: 0 auto;
}
.landing-nav-brand { font-size: 18px; font-weight: 700; color: #1c2733; }
.landing-nav-actions { display: flex; align-items: center; gap: 20px; }
.landing-nav-link { color: #3a4650; font-size: 14px; text-decoration: none; }
.landing-nav-link:hover { color: #1c2733; }
.landing-nav-cta {
  background: #2e6fb0; color: #fff; text-decoration: none;
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.landing-nav-cta:hover { background: #245a8f; }

.landing-hero {
  background: linear-gradient(135deg, #1c2733, #2e6fb0);
  color: #fff; text-align: center; padding: 80px 24px 90px;
}
.landing-hero h1 { font-size: 42px; margin: 0 0 20px; max-width: 720px; margin-left: auto; margin-right: auto; }
.landing-hero-sub {
  font-size: 17px; color: #d7e2ec; max-width: 620px; margin: 0 auto 32px;
  line-height: 1.6;
}
.landing-hero-actions { display: flex; align-items: center; justify-content: center; gap: 18px; }
.landing-hero-cta {
  background: #fff; color: #1c2733; text-decoration: none; font-weight: 700;
  padding: 13px 26px; border-radius: 8px; font-size: 15px;
}
.landing-hero-cta:hover { background: #e8edf1; }
.landing-hero-secondary { color: #fff; text-decoration: none; font-size: 14px; opacity: 0.85; }
.landing-hero-secondary:hover { opacity: 1; }

.landing-features {
  max-width: 1000px; margin: -50px auto 0; padding: 0 24px 60px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
.landing-feature {
  background: #fff; border-radius: 12px; padding: 24px 20px;
  box-shadow: 0 10px 30px rgba(28,39,51,0.12);
}
.landing-feature h3 { margin: 0 0 10px; font-size: 15px; color: #1c2733; }
.landing-feature p { margin: 0; font-size: 13px; color: #5a6b7a; line-height: 1.5; }

.landing-compat { background: #f4f6f8; text-align: center; padding: 50px 24px; }
.landing-compat-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #8fa3b3; margin: 0 0 12px; }
.landing-compat-row { font-size: 20px; font-weight: 700; color: #1c2733; margin: 0 0 14px; }
.landing-compat-sep { color: #c3cdd6; margin: 0 12px; }
.landing-compat-desc { font-size: 14px; color: #5a6b7a; max-width: 520px; margin: 0 auto; line-height: 1.6; }

.landing-footer { text-align: center; padding: 28px 24px; font-size: 12px; color: #a3aeb8; }

@media (max-width: 800px) {
  .landing-features { grid-template-columns: repeat(2, 1fr); }
  .landing-hero h1 { font-size: 32px; }
}
@media (max-width: 500px) {
  .landing-features { grid-template-columns: 1fr; margin-top: -30px; }
  .landing-nav { padding: 16px 20px; }
  .landing-hero { padding: 60px 20px 70px; }
}
