:root {
  --ink: #18211d;
  --muted: #68716c;
  --paper: #f7f4ec;
  --panel: rgba(255, 255, 255, 0.86);
  --line: #e8e5dd;
  --green: #3f765f;
  --green-soft: #e5f0e9;
  --yellow: #f5bb28;
  --yellow-soft: #fff2c5;
  --blue: #527ca7;
  --blue-soft: #e8f0f8;
  --purple: #75649e;
  --purple-soft: #eeeafb;
  --coral: #c36c55;
  --coral-soft: #fae9e3;
  --shadow: 0 18px 50px rgba(41, 49, 44, 0.08);
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--paper); }
body { min-height: 100vh; margin: 0; overflow-x: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
[hidden] { display: none !important; }

.ambient { position: fixed; z-index: -1; width: 36rem; height: 36rem; border-radius: 50%; pointer-events: none; }
.ambient-one { top: -20rem; right: -13rem; background: radial-gradient(circle, rgba(245, 187, 40, 0.2), transparent 67%); }
.ambient-two { bottom: -24rem; left: -18rem; background: radial-gradient(circle, rgba(63, 118, 95, 0.13), transparent 68%); }

.brand { display: inline-flex; align-items: center; gap: 0.65rem; color: var(--ink); font-size: 1.05rem; font-weight: 760; letter-spacing: -0.035em; text-decoration: none; }
.brand-large { font-size: 1.28rem; }
.brand em { padding: 0.26rem 0.48rem; border: 1px solid #ded9cb; border-radius: 999px; color: var(--muted); font-size: 0.62rem; font-style: normal; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.brand-mark { display: grid; width: 2.35rem; height: 2.35rem; place-items: center; border-radius: 44% 56% 50% 50%; background: white; box-shadow: 0 6px 18px rgba(34, 49, 41, 0.11); transform: rotate(-8deg); }
.brand-mark span { display: block; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--yellow); box-shadow: inset 0 -2px 3px rgba(180, 113, 0, 0.15); }
.brand-mark-small { width: 2rem; height: 2rem; }
.brand-mark-small span { width: 0.85rem; height: 0.85rem; }
.eyebrow { margin: 0 0 0.55rem; color: var(--green); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.muted { color: var(--muted); }

.login-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1.18fr) minmax(24rem, 0.82fr); }
.login-intro { position: relative; display: flex; min-height: 100vh; padding: clamp(2rem, 5vw, 5rem); flex-direction: column; justify-content: space-between; overflow: hidden; background: linear-gradient(145deg, rgba(246, 241, 222, 0.86), rgba(224, 237, 227, 0.9)), var(--paper); }
.login-intro::after { position: absolute; right: -13rem; bottom: -16rem; width: 35rem; height: 35rem; border: 6rem solid rgba(255, 255, 255, 0.38); border-radius: 48% 52% 46% 54%; content: ""; transform: rotate(21deg); }
.intro-copy { position: relative; z-index: 1; max-width: 41rem; margin: 8vh 0 5vh; }
.intro-copy h1 { max-width: 35rem; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 5.7vw, 6.8rem); font-weight: 500; letter-spacing: -0.065em; line-height: 0.94; }
.intro-copy > p:last-child { max-width: 35rem; margin: 1.75rem 0 0; color: #55615b; font-size: clamp(1rem, 1.35vw, 1.2rem); line-height: 1.65; }
.signal-card { position: relative; z-index: 1; display: flex; width: min(31rem, 92%); min-height: 8.5rem; padding: 1.4rem 1.5rem; align-items: stretch; justify-content: space-between; border: 1px solid rgba(255, 255, 255, 0.78); border-radius: 1.4rem; background: rgba(255, 255, 255, 0.56); box-shadow: 0 16px 50px rgba(52, 70, 59, 0.08); backdrop-filter: blur(12px); }
.signal-copy { display: flex; flex-direction: column; justify-content: flex-end; }
.signal-copy span { color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.signal-copy strong { margin-top: 0.4rem; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.signal-bars { display: flex; width: 48%; align-items: end; gap: 0.45rem; }
.signal-bars i { width: 100%; height: var(--height); min-height: 0.4rem; border-radius: 999px 999px 0.3rem 0.3rem; background: var(--green); opacity: 0.75; }

.login-card { display: flex; width: min(28rem, calc(100% - 3rem)); margin: auto; padding: clamp(2rem, 5vw, 3.2rem); flex-direction: column; border: 1px solid rgba(222, 218, 207, 0.8); border-radius: 1.8rem; background: rgba(255, 255, 255, 0.82); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.login-card h2 { margin: 0.2rem 0 0.75rem; font-family: Georgia, serif; font-size: 2.1rem; font-weight: 500; letter-spacing: -0.04em; }
.login-card .muted { margin: 0 0 1.75rem; font-size: 0.93rem; line-height: 1.55; }
.secure-icon { display: grid; width: 3rem; height: 3rem; margin-bottom: 1.5rem; place-items: center; border-radius: 1rem; background: var(--green-soft); color: var(--green); }
.secure-icon svg, .kpi-icon svg, .icon-button svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.secure-icon svg { width: 1.35rem; }
.google-button { min-height: 44px; }
.google-button > div { margin: auto; }
.message { min-height: 2.5rem; margin: 1rem 0 0; color: var(--coral); font-size: 0.82rem; line-height: 1.45; text-align: center; }
.security-note { display: flex; margin-top: 1rem; padding-top: 1rem; align-items: flex-start; gap: 0.65rem; border-top: 1px solid var(--line); color: #7a817d; }
.security-note > span { color: var(--green); font-size: 0.55rem; line-height: 1.5rem; }
.security-note p { margin: 0; font-size: 0.75rem; line-height: 1.5; }

.dashboard { min-height: 100vh; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; height: 4.7rem; padding: 0 clamp(1.25rem, 4vw, 4.5rem); align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(225, 222, 213, 0.86); background: rgba(247, 244, 236, 0.82); backdrop-filter: blur(18px); }
.topbar-actions { display: flex; align-items: center; gap: 0.7rem; }
.environment-pill { display: flex; padding: 0.45rem 0.7rem; align-items: center; gap: 0.45rem; border: 1px solid #e1ded5; border-radius: 999px; background: rgba(255, 255, 255, 0.72); color: var(--muted); font-size: 0.66rem; letter-spacing: 0.07em; text-transform: uppercase; }
.environment-pill span { width: 0.42rem; height: 0.42rem; border-radius: 50%; background: #65a77d; box-shadow: 0 0 0 3px rgba(101, 167, 125, 0.12); }
.icon-button, .text-button { border: 1px solid #e1ded5; background: rgba(255, 255, 255, 0.72); color: var(--ink); cursor: pointer; }
.icon-button:hover, .text-button:hover { border-color: #c8c5bc; background: white; }
.icon-button:focus-visible, .text-button:focus-visible { outline: 3px solid rgba(63, 118, 95, 0.22); outline-offset: 2px; }
.icon-button { display: grid; width: 2.25rem; height: 2.25rem; padding: 0; place-items: center; border-radius: 50%; }
.icon-button svg { width: 1rem; }
.icon-button.loading svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.text-button { padding: 0.55rem 0.82rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; }

.content { width: min(1440px, calc(100% - clamp(2rem, 8vw, 8rem))); margin: 0 auto; padding: 3.4rem 0 2rem; }
.page-heading { display: flex; margin-bottom: 2.2rem; align-items: flex-end; justify-content: space-between; gap: 2rem; }
.page-heading h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.5rem, 4.5vw, 4.4rem); font-weight: 500; letter-spacing: -0.055em; line-height: 1; }
.page-heading .muted { margin: 0.8rem 0 0; font-size: 0.95rem; }
.updated-at { margin: 0; color: #838984; font-size: 0.72rem; }
.dashboard-message { margin: -0.5rem 0 1.5rem; padding: 0.9rem 1rem; border: 1px solid #f0c8bb; border-radius: 0.8rem; background: var(--coral-soft); color: #8c4936; font-size: 0.83rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.9rem; }
.kpi-card, .panel { border: 1px solid rgba(228, 225, 216, 0.92); background: var(--panel); box-shadow: 0 12px 35px rgba(41, 49, 44, 0.045); backdrop-filter: blur(10px); }
.kpi-card { min-height: 11.2rem; padding: 1.2rem; border-radius: 1.15rem; }
.kpi-icon { display: grid; width: 2.25rem; height: 2.25rem; margin-bottom: 1.2rem; place-items: center; border-radius: 0.72rem; }
.kpi-icon svg { width: 1.1rem; }
.accent-green .kpi-icon { background: var(--green-soft); color: var(--green); }
.accent-blue .kpi-icon { background: var(--blue-soft); color: var(--blue); }
.accent-yellow .kpi-icon, .accent-gold .kpi-icon { background: var(--yellow-soft); color: #9c7200; }
.accent-purple .kpi-icon { background: var(--purple-soft); color: var(--purple); }
.accent-coral .kpi-icon { background: var(--coral-soft); color: var(--coral); }
.kpi-card p { margin: 0 0 0.45rem; color: var(--muted); font-size: 0.72rem; font-weight: 650; }
.kpi-card strong { display: block; font-family: Georgia, serif; font-size: clamp(1.8rem, 2.4vw, 2.5rem); font-weight: 500; letter-spacing: -0.045em; line-height: 1; }
.kpi-card > span { display: block; margin-top: 0.55rem; color: #8a908b; font-size: 0.64rem; }

.panel { padding: 1.55rem; border-radius: 1.25rem; }
.trend-panel, .table-panel, .token-panel, .two-column { margin-top: 0.9rem; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
.panel-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 1.4rem; font-weight: 500; letter-spacing: -0.035em; }
.legend { display: flex; align-items: center; gap: 1.1rem; color: var(--muted); font-size: 0.69rem; }
.legend span { display: flex; align-items: center; gap: 0.36rem; }
.legend i, .status-dot { width: 0.46rem; height: 0.46rem; border-radius: 50%; }
.legend-users { background: var(--green); }
.legend-recipes { background: var(--yellow); }
.legend-imports { background: var(--purple); }
.chart-wrap { width: 100%; margin-top: 0.8rem; overflow: hidden; }
#trend-chart { display: block; width: 100%; min-width: 600px; height: auto; }
.chart-grid { stroke: #ece9e2; stroke-width: 1; }
.chart-label { fill: #929790; font-family: Inter, sans-serif; font-size: 9px; }
.chart-line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.chart-area { opacity: 0.08; }
.chart-dot { stroke: white; stroke-width: 1.5; }

.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.large-stat { color: var(--green); font-family: Georgia, serif; font-size: 1.65rem; }
.funnel-summary { display: grid; margin: 1.3rem 0 1.4rem; padding: 1rem 0; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.funnel-summary div { padding: 0 1rem; border-right: 1px solid var(--line); }
.funnel-summary div:first-child { padding-left: 0; }
.funnel-summary div:last-child { border: 0; }
.funnel-summary strong { display: block; font-family: Georgia, serif; font-size: 1.3rem; font-weight: 500; }
.funnel-summary span, .panel-note { color: #878d88; font-size: 0.65rem; }
.panel-note { margin: 0.55rem 0 1.35rem; }
.bar-list { display: grid; gap: 0.92rem; }
.bar-row { display: grid; grid-template-columns: 5.8rem 1fr 2.5rem; align-items: center; gap: 0.75rem; }
.bar-row span, .bar-row strong { font-size: 0.7rem; }
.bar-row span { overflow: hidden; color: #59615c; text-overflow: ellipsis; white-space: nowrap; }
.bar-row strong { color: var(--ink); text-align: right; }
.bar-track { height: 0.48rem; overflow: hidden; border-radius: 999px; background: #efede7; }
.bar-track i { display: block; width: var(--width); height: 100%; border-radius: inherit; background: var(--bar-color, var(--green)); transition: width 450ms ease; }

.token-summary { display: grid; margin: 1.25rem 0 1.5rem; padding: 1rem 0; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.token-summary div { padding: 0 1.25rem; border-right: 1px solid var(--line); }
.token-summary div:first-child { padding-left: 0; }
.token-summary div:last-child { border: 0; }
.token-summary span { display: block; margin-bottom: 0.35rem; color: #878d88; font-size: 0.65rem; }
.token-summary strong { font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.token-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 5vw, 5rem); }
.token-columns h3 { margin: 0 0 1rem; color: var(--muted); font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; }
.token-list { display: grid; gap: 1rem; }
.token-row { display: grid; gap: 0.4rem; }
.token-row-heading { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 1rem; }
.token-row-heading span { overflow: hidden; color: #59615c; font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.token-row-heading strong { color: var(--ink); font-size: 0.7rem; }
.token-row small { color: #90958f; font-size: 0.61rem; }

.import-summary { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: 0.68rem; }
.import-summary span { display: flex; align-items: center; gap: 0.35rem; }
.status-dot { display: inline-block; }
.status-success { background: #65a77d; }
.status-failed { background: #d3785f; }
.status-pending { background: #d2a528; }
.table-scroll { margin-top: 1.2rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
th, td { padding: 0.85rem 0.7rem; border-bottom: 1px solid #eeece6; text-align: left; white-space: nowrap; }
th { color: #858b86; font-size: 0.62rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
td { color: #4d5550; }
tbody tr:last-child td { border-bottom: 0; }
.run-id { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.68rem; }
.source-badge, .status-badge { display: inline-flex; padding: 0.3rem 0.52rem; align-items: center; border-radius: 999px; background: #f1efe9; color: #5d655f; font-size: 0.65rem; font-weight: 700; text-transform: capitalize; }
.status-badge.completed { background: var(--green-soft); color: var(--green); }
.status-badge.failed { background: var(--coral-soft); color: #a5513b; }
.status-badge.pending { background: var(--yellow-soft); color: #8a6808; }
.empty-row { height: 5rem; color: var(--muted); text-align: center; }
footer { display: flex; padding: 1.5rem 0 0.25rem; justify-content: space-between; color: #8b908c; font-size: 0.65rem; }
footer p { margin: 0; }

@media (max-width: 1180px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { min-height: auto; padding-bottom: 5rem; }
  .intro-copy { margin: 12vh 0 3rem; }
  .signal-card { display: none; }
  .login-card { margin: -2.5rem auto 3rem; }
  .two-column { grid-template-columns: 1fr; }
  .token-columns { grid-template-columns: 1fr; }
  .content { width: calc(100% - 2rem); }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 1rem; }
}
@media (max-width: 620px) {
  .topbar { height: 4.2rem; padding: 0 1rem; }
  .brand em, .environment-pill { display: none; }
  .content { padding-top: 2.2rem; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { min-height: 10.4rem; }
  .panel { padding: 1.15rem; }
  .panel-heading { flex-direction: column; }
  .legend { gap: 0.7rem; }
  .funnel-summary div { padding: 0 0.55rem; }
  footer { align-items: flex-start; flex-direction: column; gap: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
