/*
 * inboxMCP design system — shared by the React dashboard and the server-rendered pages
 * (OAuth consent, connection messages). Source: Paper file "inboxMCP", artboard
 * "26 · Design system & page coverage". Dashboard follows the system theme; the landing
 * page uses the warm "notebook" palette under .theme-notebook.
 */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/geist-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
}

/* ---- tokens --------------------------------------------------------------------------- */
:root {
  --font-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --canvas: #ffffff;
  --paper: #ffffff;
  --dust: #f5f5f3;
  --ink: #242424;
  --body: #262626;
  --muted: #6b6b67;
  --border: #e7e7e3;
  --input: #d4d4d4;
  --primary: #242424;
  --on-primary: #ffffff;
  --card-shell: #f8f8f7;
  --sidebar: #f5f5f3;
  --nav-active: #f5f5f3;
  --orange: #f6821f;
  --tint: #fdf3e7;
  --meter-track: #f5f5f3;
  --chart-bar: #b7bcc1;
  --toggle-off: #d9d9d9;

  --ok-bg: #e8f5d8;
  --ok-fg: #3d6b14;
  --warn-bg: #fcf3d6;
  --warn-fg: #8a6d1b;
  --bad-bg: #fbe2e2;
  --bad-fg: #bd2528;
  --danger: #b3261e;
  --banner-warn-bg: #fcf3d6;
  --banner-warn-border: #eddda8;
  --banner-note-bg: #fffbef;
  --banner-note-border: #e8d8a7;

  --r-shell: 16px;
  --r-inner: 12px;
  --r-control: 14px;
  --r-pill: 999px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) {
    --canvas: #171717;
    --paper: #202020;
    --dust: #2b2b2b;
    --ink: #e4e6e7;
    --body: #e4e6e7;
    --muted: #a9afb5;
    --border: #3b3b3b;
    --input: #4a4a4a;
    --primary: #ececec;
    --on-primary: #242424;
    --card-shell: #282828;
    --sidebar: #202020;
    --nav-active: #2b2b2b;
    --tint: #3a2a1c;
    --meter-track: #333333;
    --chart-bar: #4d5257;
    --toggle-off: #4a4a4a;

    --ok-bg: #203e2a;
    --ok-fg: #ade1b5;
    --warn-bg: #453819;
    --warn-fg: #f1d481;
    --bad-bg: #4a2324;
    --bad-fg: #f4b4b0;
    --danger: #c9443c;
    --banner-warn-bg: #3a3120;
    --banner-warn-border: #5a4b26;
    --banner-note-bg: #332d1d;
    --banner-note-border: #5a4b26;

    color-scheme: dark;
  }
}

/* ---- base ----------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.mono {
  font-family: var(--font-mono);
}
.muted {
  color: var(--muted);
}
.ink {
  color: var(--ink);
}
.nowrap {
  white-space: nowrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.tabular {
  font-variant-numeric: tabular-nums;
}

/* ---- type ------------------------------------------------------------------------------- */
.t-title {
  font-size: 32px;
  line-height: 40px;
  font-weight: 500;
  letter-spacing: -0.035em;
  margin: 0;
  text-wrap: balance;
}
.t-heading {
  font-size: 28px;
  line-height: 36px;
  font-weight: 500;
  letter-spacing: -0.035em;
  margin: 0;
}
.t-section {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}
.t-lead {
  font-size: 15px;
  line-height: 23px;
  color: var(--muted);
  margin: 0;
}
.t-strong {
  font-size: 14px;
  line-height: 21px;
  font-weight: 600;
}
.t-label {
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
}
.t-small {
  font-size: 12px;
  line-height: 18px;
}
.t-body {
  font-size: 13px;
  line-height: 20px;
}
.eyebrow {
  font-size: 12px;
  line-height: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-sm {
  font-size: 11px;
  line-height: 17px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- buttons ---------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--input);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 18px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    opacity 0.12s ease;
}
.btn:hover {
  text-decoration: none;
  background: var(--dust);
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: default;
}
.btn svg {
  flex-shrink: 0;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background: var(--primary);
  opacity: 0.9;
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover {
  background: var(--danger);
  opacity: 0.9;
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
}
.btn-block {
  width: 100%;
}
.btn-icon {
  width: 38px;
  padding: 0;
  border-color: transparent;
  background: transparent;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--body);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--dust);
}
.link {
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- pills & chips ------------------------------------------------------------------------ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--dust);
  color: var(--ink);
}
.pill-ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
}
.pill-warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.pill-bad {
  background: var(--bad-bg);
  color: var(--bad-fg);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--dust);
  color: var(--ink);
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  white-space: nowrap;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ---- cards: pale outer shell + bordered rounded inner panel -------------------------------- */
.card {
  background: var(--card-shell);
  border: 1px solid var(--border);
  border-radius: var(--r-shell);
  padding: 4px;
  display: flex;
  flex-direction: column;
  overflow: clip;
  min-width: 0;
}
.card-inner {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  overflow: clip;
  min-width: 0;
  flex-grow: 1;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}
.pad {
  padding: 20px;
}
.pad-lg {
  padding: 28px;
}
.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}
.panel {
  background: var(--dust);
  border-radius: var(--r-control);
  padding: 20px;
}
.panel-canvas {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
}

/* ---- avatars ------------------------------------------------------------------------------ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--dust);
  color: var(--ink);
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-sm {
  width: 28px;
  height: 28px;
}
.avatar-md {
  width: 34px;
  height: 34px;
}
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 14px;
}
.app-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--dust);
  color: var(--ink);
  flex-shrink: 0;
}

/* ---- forms -------------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field-label {
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  color: var(--ink);
}
.input,
.select {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border-radius: var(--r-control);
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 23px;
}
.input:focus,
.select:focus {
  outline: none;
  border-color: var(--ink);
}
.input::placeholder {
  color: var(--muted);
}
.select {
  appearance: none;
  -webkit-appearance: none;
  border-color: var(--input);
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath d='m8 10 4 4 4-4' fill='none' stroke='%236b6b67' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
}
.toggle {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 42px;
  height: 24px;
}
.toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.toggle span {
  pointer-events: none;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: var(--toggle-off);
  padding: 3px;
  transition: background-color 0.15s ease;
}
.toggle span::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.15s ease;
}
.toggle input:checked + span {
  background: var(--ink);
}
.toggle input:checked + span::after {
  transform: translateX(18px);
  background: var(--canvas);
}
.toggle input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
}
.check input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  margin-top: 1px;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--input);
  background: var(--paper);
  cursor: pointer;
  display: grid;
  place-content: center;
}
.check input:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.check input:checked::after {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--on-primary);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12 5 5 9-10' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- notices, banners, info rows ---------------------------------------------------------- */
.note {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.note svg {
  color: var(--body);
  flex-shrink: 0;
}
.callout {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--dust);
  border-radius: var(--r-shell);
  padding: 18px 24px;
  font-size: 15px;
  line-height: 23px;
  color: var(--ink);
}
.callout svg {
  flex-shrink: 0;
}
.banner {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: var(--r-control);
  border: 1px solid var(--banner-warn-border);
  background: var(--banner-warn-bg);
  padding: 22px 26px;
}
.banner-note {
  border-color: var(--banner-note-border);
  background: var(--banner-note-bg);
}
.banner .grow {
  flex: 1;
  min-width: 0;
}
.error-text {
  color: var(--bad-fg);
}

/* ---- tables built from rows (desktop) ------------------------------------------------------ */
.rows-head {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  color: var(--muted);
}
.row {
  display: flex;
  align-items: center;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}
.row:last-child {
  border-bottom: 0;
}

/* ---- meters & stats ----------------------------------------------------------------------- */
.meter {
  height: 4px;
  border-radius: 4px;
  background: var(--meter-track);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--ink);
}
.meter-lg {
  height: 6px;
}
.stat-value {
  font-size: 30px;
  line-height: 45px;
  font-weight: 500;
  letter-spacing: -0.035em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---- code blocks -------------------------------------------------------------------------- */
.code {
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--canvas);
  padding: 18px 18px 20px;
  position: relative;
  min-width: 0;
}
.code pre {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  color: var(--ink);
  white-space: pre;
  overflow-x: auto;
}
.code .copy-corner {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* ---- modal & toast ------------------------------------------------------------------------ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 20, 20, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade-in 0.12s ease;
}
.modal {
  width: min(588px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}
.modal .card-inner {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--r-pill);
  padding: 8px 14px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  animation: rise 0.18s ease;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .overlay,
  .toast {
    animation: none;
  }
}

/* ---- brand -------------------------------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover {
  text-decoration: none;
}
.brand-word {
  font-size: 18px;
  line-height: 36px;
  font-weight: 600;
  letter-spacing: -0.06em;
}
.brand-lg .brand-word {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

/* ---- auth / standalone pages (login, consent, connected) ----------------------------------- */
.standalone {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
}
.standalone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 64px;
}
.standalone-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 52px 16px 80px;
}
.standalone-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding: 32px 64px;
  font-size: 12px;
  line-height: 18px;
  color: var(--muted);
}
.center-card {
  width: min(520px, 100%);
}
.center-card .card-inner {
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--r-control);
  background: var(--dust);
  color: var(--ink);
}
@media (max-width: 720px) {
  .standalone-head,
  .standalone-foot {
    padding: 24px 20px;
  }
  .standalone-main {
    padding: 24px 20px 48px;
  }
  .center-card .card-inner {
    padding: 32px 24px;
  }
}

/* ---- consent (server-rendered) ------------------------------------------------------------ */
.consent {
  width: min(620px, 100%);
}
.consent-top {
  padding: 16px 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.consent-icons {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--ink);
}
.consent-icons .tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-control);
  background: var(--dust);
}
.consent .card-inner {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.account-select {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  padding: 14px 16px;
  position: relative;
}
.account-select select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.account-select .chev {
  margin-left: auto;
  color: var(--muted);
}
.perm-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--canvas);
  border-radius: var(--r-control);
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}
.info-box svg {
  color: var(--body);
  flex-shrink: 0;
}
.consent-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}
@media (max-width: 720px) {
  .consent .card-inner {
    padding: 24px 20px;
  }
}

/* ---- small utilities (also used by server pages, which allow no inline styles) ------------ */
.stack-1 {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.stack-3 {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.pt-6 {
  padding-top: 6px;
}
.gap-16 {
  gap: 16px !important;
}
.t-24 {
  font-size: 24px;
  line-height: 32px;
}
.center-card p {
  margin: 0;
}
