:root {
  --ink: #202124;
  --muted: #5f6368;
  --surface: #ffffff;
  --page: #f1f3f4;
  --border: #e8eaed;
  --accent: #1565c0;
  --accent-soft: #e8f0fe;
  --sidebar-width: 256px;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Roboto", sans-serif;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

body.app-body,
body.auth-body {
  min-height: 100vh;
}

/* Auth */
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, rgba(21, 101, 192, 0.12), transparent 42%),
    radial-gradient(circle at 88% 80%, rgba(46, 125, 50, 0.08), transparent 40%),
    var(--page);
}

.auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(32, 33, 36, 0.08);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.auth-brand .material-icons {
  color: var(--accent);
  font-size: 2rem;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 500;
}

.auth-subtitle {
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.5;
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
}

.auth-footer {
  margin: 20px 0 0;
  text-align: center;
  color: var(--muted);
}

.auth-footer a { color: var(--accent); }

/* Sidebar */
.agent-sidenav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #1a237e;
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.sidenav-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidenav-brand a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 500;
}

.sidenav-brand .material-icons { font-size: 1.6rem; }

.agent-sidenav ul {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}

.agent-sidenav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  color: rgba(255, 255, 255, 0.82);
}

.agent-sidenav li a:hover,
.agent-sidenav li.active a {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.agent-sidenav li a .material-icons {
  font-size: 1.25rem;
}

.sidenav-footer {
  padding: 16px 18px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidenav-footer .user-email {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 8px;
}

.sidenav-footer .btn-flat {
  color: #fff;
  padding-left: 0;
}

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  border: none;
  border-radius: 8px;
  background: #1a237e;
  color: #fff;
  width: 42px;
  height: 42px;
  cursor: pointer;
}

.sidenav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 900;
}

.sidenav-backdrop.open { display: block; }

main.main-content {
  margin-left: var(--sidebar-width);
  padding: 28px 32px 48px;
  min-height: 100vh;
  max-width: 1200px;
}

@media (max-width: 992px) {
  .agent-sidenav {
    transform: translateX(-105%);
  }
  .agent-sidenav.open {
    transform: translateX(0);
  }
  .mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  main.main-content {
    margin-left: 0;
    padding: 72px 18px 40px;
  }
}

.page-header { margin-bottom: 22px; }

.page-title {
  margin: 0 0 6px;
  font-size: 1.85rem;
  font-weight: 500;
}

.page-subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.5;
}

.dashboard-card,
.product-card,
.info-card,
.table-card,
.current-plan-card {
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.12);
}

.dashboard-card {
  display: block;
  color: inherit;
  margin-bottom: 16px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.dashboard-card:hover {
  box-shadow: 0 6px 18px rgba(60, 64, 67, 0.16);
  transform: translateY(-1px);
}

.dashboard-card .material-icons {
  color: var(--accent);
  margin-bottom: 8px;
}

.dashboard-card .card-title {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.dashboard-card .metric {
  font-size: 1.75rem;
  font-weight: 500;
  margin: 0 0 4px;
}

.muted { color: var(--muted); }

.info-card { margin-bottom: 20px; }

.table-card .card-content.table-wrap,
.table-wrap {
  overflow-x: auto;
  padding: 0;
}

.table-card table {
  margin-bottom: 0;
}

.table-card thead th {
  color: var(--muted);
  font-weight: 500;
}

.product-card {
  margin-bottom: 16px;
  min-height: 180px;
}

.product-desc {
  color: var(--muted);
  min-height: 3.2em;
  line-height: 1.45;
}

.product-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.plan-chip {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  font-weight: 500;
}

.eyebrow {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.plan-name {
  margin: 0 0 10px;
  font-size: 2rem;
  font-weight: 500;
}

.plan-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.plan-list li { margin-bottom: 6px; }

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #eceff1;
  color: #546e7a;
}

.status-unknown { background: #eceff1; color: #546e7a; }
.status-active { background: #e8f5e9; color: #2e7d32; }
.status-used { background: #e3f2fd; color: #1565c0; }
.status-expired { background: #fff3e0; color: #ef6c00; }

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.flash-card {
  margin-bottom: 16px;
  border-radius: var(--radius);
}
.flash-error { border-left: 4px solid #c62828; }
.flash-success { border-left: 4px solid #2e7d32; }

.install-steps {
  margin: 8px 0 12px;
  padding-left: 20px;
  line-height: 1.6;
}
.install-steps li { margin-bottom: 10px; }

.code-block {
  background: #eceff1;
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 0.88rem;
  margin: 8px 0 0;
}

.token-result {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.token-value {
  word-break: break-all;
  font-weight: 500;
}

.token-cell {
  font-size: 0.78rem;
  word-break: break-all;
}

.btn.disabled,
.btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
}

code {
  background: #eceff1;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
