/* =========================================================================
   REPUTIFLY PROFESSIONAL -- the exact design system of Reputifly Mail.
   White, polished, Inter everywhere. Apple-grade LIGHT UI for client-facing
   software. Primary #007aff with EXPLICIT white text. Full pill rounding.
   Soft neutral shadows. cubic-bezier(0.25,0.8,0.25,1) easing. >=44px tap targets.

   Framework-agnostic: plain CSS custom properties + component classes. Paste
   verbatim into any project (HTML/CSS, React, Vue, Svelte, etc.). Pair with the
   Inter webfont (see the <link> in SKILL.md). For a Tailwind v4 project, change
   the ":root {" line below to "@theme {" and keep everything else.
   ========================================================================= */

:root {
  /* ---- Color: surfaces ---- */
  --color-canvas: #f7f8fa;        /* app background (soft off-white) */
  --color-surface: #ffffff;       /* cards, panels, sheets */
  --color-surface-2: #f3f4f6;     /* subtle raised / hover fills */
  --color-surface-3: #eceef1;     /* pressed / active fills */

  /* ---- Color: ink (text) ---- */
  --color-ink: #0a0a0a;           /* primary text */
  --color-ink-2: #3f4754;         /* secondary text */
  --color-muted: #6b7280;         /* tertiary / meta */
  --color-faint: #9ca3af;         /* placeholder / disabled */

  /* ---- Color: lines ---- */
  --color-line: #e8eaed;          /* hairline borders */
  --color-line-2: #dfe2e7;        /* stronger borders */

  /* ---- Color: brand / semantic ---- */
  --color-primary: #007aff;
  --color-primary-hover: #0a6fe0;
  --color-primary-active: #0563cc;
  --color-primary-soft: #e9f2ff;  /* tinted background for selected rows */
  --color-on-primary: #ffffff;

  --color-success: #34c759;
  --color-warn: #ff9500;
  --color-danger: #ff3b30;
  --color-danger-hover: #e11d0f;

  /* ---- Radii ---- */
  --radius-pill: 9999px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --radius-xs: 9px;

  /* ---- Shadows (soft, neutral) ---- */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12), 0 4px 8px rgba(16, 24, 40, 0.06);
  --shadow-focus: 0 0 0 3px rgba(0, 122, 255, 0.28);

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);

  /* ---- Type ---- */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* ---- Layout ---- */
  --sidebar-w: 264px;
}

/* ---- Base ---- */
html, body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
}
html {
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}
body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  color: var(--color-ink);
  background: var(--color-canvas);
  overflow-x: hidden;            /* zero horizontal overflow, ever */
}
* { box-sizing: border-box; }
::selection { background: rgba(0, 122, 255, 0.16); }

h1, h2, h3, h4 { letter-spacing: -0.02em; font-weight: 700; margin: 0; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Accessible focus -- keyboard users get a ring on interactive elements. */
:focus { outline: none; }
.btn:focus-visible,
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-xs);
}

button { font-family: inherit; }

/* Custom scrollbars -- thin, neutral, unobtrusive */
* {
  scrollbar-width: thin;
  scrollbar-color: #d3d6db transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: #d3d6db;
  border-radius: 9999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: #b9bdc4; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* =========================================================================
   Component layer -- reusable, consistent primitives
   ========================================================================= */

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  min-height: 44px; padding: 0 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
              color 0.18s var(--ease), transform 0.12s var(--ease), box-shadow 0.18s var(--ease);
}
.btn:active { transform: translateY(0.5px) scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn--primary {
  background: var(--color-primary);
  color: var(--color-on-primary);   /* explicit white text */
  box-shadow: var(--shadow-xs);
}
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--primary:active { background: var(--color-primary-active); }

.btn--ghost {
  background: var(--color-surface);
  color: var(--color-ink);
  border-color: var(--color-line-2);
}
.btn--ghost:hover { background: var(--color-surface-2); }

.btn--subtle {
  background: transparent;
  color: var(--color-ink-2);
}
.btn--subtle:hover { background: var(--color-surface-2); color: var(--color-ink); }

.btn--danger {
  background: var(--color-danger);
  color: #ffffff;
}
.btn--danger:hover { background: var(--color-danger-hover); }

.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; gap: 6px; }
.btn--icon {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; min-width: 40px; padding: 0;
  border-radius: var(--radius-pill);
  background: transparent; color: var(--color-ink-2);
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.btn--icon:hover { background: var(--color-surface-3); color: var(--color-ink); }
.btn--icon:active { background: #e2e5e9; }

/* ---- Dropdown / overflow menu row (icon + text) ---- */
.menu-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 0 14px;
  min-height: 40px;
  font-size: 14px; font-weight: 500;
  text-align: left;
  color: var(--color-ink-2);
  cursor: pointer;
  transition: background-color 0.13s var(--ease), color 0.13s var(--ease);
}
.menu-item:hover { background: var(--color-surface-2); color: var(--color-ink); }
.menu-item svg { flex-shrink: 0; }

/* ---- Inputs ---- */
.input {
  width: 100%;
  min-height: 44px; padding: 0 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-line-2);
  border-radius: var(--radius-sm);
  font-size: 16px; color: var(--color-ink);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s var(--ease);
}
.input::placeholder { color: var(--color-faint); }
.input:hover { border-color: var(--color-line); }
.input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
/* Kill Chrome's yellow autofill box; keep the white surface + focus ring. */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--color-ink);
  -webkit-box-shadow: 0 0 0 1000px var(--color-surface) inset;
  box-shadow: 0 0 0 1000px var(--color-surface) inset;
  caret-color: var(--color-ink);
  transition: background-color 9999s ease-in-out 0s;
  border-radius: var(--radius-sm);
}
.input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--color-surface) inset, var(--shadow-focus);
  box-shadow: 0 0 0 1000px var(--color-surface) inset, var(--shadow-focus);
}
textarea.input { padding: 12px 14px; resize: vertical; line-height: 1.6; }

.label {
  display: block;
  font-size: 13px; font-weight: 600; color: var(--color-ink-2);
  margin-bottom: 7px; letter-spacing: -0.01em;
}

/* ---- Cards ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ---- Pills / chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  color: var(--color-ink-2);
  font-size: 12px; font-weight: 600;
}
.chip--primary { background: var(--color-primary-soft); color: var(--color-primary-active); }

/* ---- Count badge ---- */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-3); color: var(--color-ink-2);
  font-size: 11px; font-weight: 700;
}
.badge--primary { background: var(--color-primary); color: #fff; }

/* ---- Sidebar nav item ---- */
.nav-item {
  background: transparent;
  color: var(--color-ink-2);
  font-weight: 500;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-item:hover { background: var(--color-surface-2); }
.nav-item--active,
.nav-item--active:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary-active);
  font-weight: 600;
}

/* ---- List row (e.g. inbox row, table row, result row) ---- */
.list-row {
  position: relative;
  background: var(--color-surface);
  transition: background-color 0.13s var(--ease);
  cursor: pointer;
}
.list-row:hover { background: var(--color-surface-2); }
.list-row--active,
.list-row--active:hover { background: var(--color-primary-soft); }
.list-row--unread::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-primary);
}
.list-row--read { background: #fcfcfd; }

/* ---- Search pill (flush, fills its slot) ---- */
.search-pill {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  height: 42px; padding: 0 14px;
  background: var(--color-surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.search-pill:hover { background: var(--color-surface-3); }
.search-pill--focused,
.search-pill--focused:hover {
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
.search-pill input {
  flex: 1; min-width: 0;
  border: none; outline: none; background: transparent;
  font-size: 16px; color: var(--color-ink);
}
.search-pill input::placeholder { color: var(--color-faint); }

/* ---- Keyword highlight ---- */
mark.hl {
  background: #ffec99;
  color: var(--color-ink);
  border-radius: 3px;
  padding: 0 1px;
}

/* ---- Borderless / flush field (for compose-style or inline editing) ---- */
.field-flush {
  width: 100%; border: none; background: transparent;
  font-size: 16px; color: var(--color-ink); min-height: 38px;
  outline: none;
}
.field-flush::placeholder { color: var(--color-faint); }
.field-flush:focus { outline: none; box-shadow: none; }

/* 14px only on true mouse/desktop pointers; EVERY touch device keeps 16px so
   iOS never zooms the page when an input is focused (the <16px trigger). */
@media (hover: hover) and (pointer: fine) {
  .input, .field-flush, .search-pill input { font-size: 14px; }
}

/* ---- Loader spin ---- */
@keyframes rf-spin { to { transform: rotate(360deg); } }
.rf-spin { animation: rf-spin 0.7s linear infinite; }

/* ---- Fade / pop / slide for modals, sheets, toasts, drawers ---- */
@keyframes rf-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rf-pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes rf-slide-in-left { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.rf-fade-in { animation: rf-fade-in 0.2s var(--ease); }
.rf-pop-in { animation: rf-pop-in 0.22s var(--ease); }
.rf-slide-in-left { animation: rf-slide-in-left 0.24s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  .rf-spin, .rf-fade-in, .rf-pop-in, .rf-slide-in-left { animation: none; }
}

/* ---- Safe-area helpers for notch / home-indicator on iOS ---- */
@supports (padding: env(safe-area-inset-top)) {
  .safe-top { padding-top: env(safe-area-inset-top); }
  .safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
}
