/* feexle app pages. Colors follow the demo themes (design/shared_logic.js). */
:root {
  color-scheme: light dark;
  --bg: #F7F4ED; --panel: #FCFBF8; --panel2: #F3EFE6; --border: #ECEAE4; --border2: #D4D3D0;
  --text: #1C1C1C; --soft: #3B3A37; --muted: #5F5F5D; --accent: #3451B2; --accent-hover: #2B4499;
  --accent-fill: rgba(52, 81, 178, 0.14); --good: #2F8A57; --bad: #C2352B; --bad-fill: rgba(194, 53, 43, 0.08);
  --shadow: 0 1px 2px rgba(28, 28, 28, 0.04), 0 8px 24px rgba(28, 28, 28, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090B; --panel: #111114; --panel2: #17171B; --border: #232329; --border2: #3A3A42;
    --text: #EDEDEF; --soft: #C4C4CB; --muted: #8B8B95; --accent: #5B9BFF; --accent-hover: #7BAFFF;
    --accent-fill: rgba(91, 155, 255, 0.22); --good: #4CC38A; --bad: #F2666B; --bad-fill: rgba(242, 102, 107, 0.1);
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 8px; }
h1:focus { outline: none; }
p { margin: 0; }
a { color: var(--accent); }

/* Sign-in */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 20px; }
.card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); }
.logo { display: inline-block; margin-bottom: 28px; }
.logo img { height: 28px; width: auto; display: block; }
.lead { color: var(--muted); margin-bottom: 24px; }
.lead strong { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--soft); margin-bottom: 6px; }
input[type="email"] {
  /* 16px: smaller text makes iPhones zoom the page when the field is tapped. */
  width: 100%; min-height: 44px; padding: 0 14px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border2); border-radius: 10px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input[type="email"]::placeholder { color: var(--muted); opacity: 0.7; }
input[type="email"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fill); }
input[aria-invalid="true"] { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 13px; margin-top: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; border: 1px solid transparent; transition: background-color 150ms ease, transform 100ms ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-fill); }
.btn:disabled { cursor: default; opacity: 0.6; }
.btn-primary { width: 100%; margin-top: 16px; background: var(--accent); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--panel2); border-color: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border2); }
.btn-link { background: none; border: none; padding: 0; min-height: 44px; color: var(--accent); font-weight: 500; }
.btn-link:hover { text-decoration: underline; }
.notice { background: var(--bad-fill); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 20px; }
.fine { color: var(--muted); font-size: 13px; margin-top: 20px; }
.sent-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-fill); color: var(--accent); display: grid; place-items: center; margin-bottom: 16px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #FFFFFF; border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { color: var(--muted); font-size: 13px; }
@media (max-width: 480px) { .card { padding: 24px 20px; border-radius: 14px; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } .btn { transition: none; } }

/* Signed-in shell (temporary home) */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--panel); }
.topbar .logo { margin: 0; }
.topbar .logo img { height: 24px; }
.who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .btn { min-height: 36px; font-size: 13px; padding: 0 12px; white-space: nowrap; flex-shrink: 0; }
.home { max-width: 640px; margin: 64px auto; padding: 0 20px; }
.home .lead { margin-bottom: 0; }

.logo-dark { display: none !important; }
@media (prefers-color-scheme: dark) { .logo-light { display: none !important; } .logo-dark { display: block !important; } }

/* Sign-in page: card on the left, product on the right */
.split { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.split-left { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 40px 20px; }
.split-right { display: none; }
@media (min-width: 1000px) {
  .split { grid-template-columns: minmax(480px, 1fr) minmax(0, 1.15fr); }
  .split-right {
    display: block; position: relative; overflow: hidden;
    background:
      radial-gradient(120% 80% at 100% 0%, rgba(224, 79, 208, 0.16), transparent 60%),
      radial-gradient(90% 70% at 0% 100%, rgba(74, 108, 247, 0.18), transparent 60%),
      var(--panel2);
    border-left: 1px solid var(--border);
  }
}
.card-lg { max-width: 440px; padding: 40px; border-radius: 22px; }
.card[data-loading="true"] #ask > :not(h1):not(.lead) { visibility: hidden; }
.h-xl { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
.lead-lg { font-size: 16px; margin-bottom: 28px; }
.btn-google {
  width: 100%; min-height: 52px; font-size: 16px; gap: 12px;
  background: var(--panel2); border-color: var(--border2); color: var(--text);
}
.btn-google:hover:not(:disabled) { background: var(--bg); }
.divider { display: flex; align-items: center; gap: 14px; margin: 24px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border2); }
.card-lg input[type="email"] { min-height: 52px; }
.btn-brand {
  min-height: 52px; font-size: 16px;
  background: linear-gradient(135deg, #3D6BF5 0%, #2850D8 100%);
  box-shadow: 0 6px 18px -6px rgba(40, 80, 216, 0.55), inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.btn-brand:hover:not(:disabled) { background: linear-gradient(135deg, #335FE6 0%, #2145C4 100%); }
.notice-neutral { background: var(--panel2); color: var(--soft); }
.foot a { color: inherit; }
.foot a:hover { color: var(--text); }

.showcase { position: absolute; inset: 0; padding: 72px 0 0 64px; display: flex; flex-direction: column; }
.showcase-kicker { color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 10px; }
.showcase-title { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; max-width: 460px; margin-bottom: 40px; }
.shot {
  width: 1100px; border-radius: 16px 0 0 0; overflow: hidden;
  border: 1px solid var(--border2); border-right: none; border-bottom: none;
  box-shadow: 0 30px 80px -20px rgba(28, 28, 28, 0.35);
}
.shot img { display: block; width: 100%; height: auto; }
@media (prefers-reduced-motion: no-preference) {
  .shot { animation: rise 700ms cubic-bezier(0.22, 1, 0.36, 1) both; }
  .card-lg { animation: fade 400ms ease-out both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .card-lg { padding: 28px 20px; } .h-xl { font-size: 24px; } }

/* Onboarding */
.onb { min-height: 100vh; min-height: 100dvh; background:
  radial-gradient(60% 45% at 50% 100%, rgba(74, 108, 247, 0.16), transparent 70%),
  radial-gradient(40% 30% at 85% 90%, rgba(224, 79, 208, 0.10), transparent 70%),
  var(--bg); }
.onb-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1040px; margin: 0 auto; padding: 24px 20px; }
.onb-top .logo { margin: 0; }
.onb-who { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.onb-main { max-width: 560px; margin: 0 auto; padding: 24px 20px 64px; }
.onb-back { min-height: 38px; font-size: 14px; margin-bottom: 28px; text-decoration: none; }
.steps { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 24px; padding: 0; margin: 0 0 28px; font-size: 14px; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border2); }
.steps li.done { color: var(--soft); }
.steps li.done::before { background: var(--good, #2F8A57); }
.steps li.current { color: var(--accent); font-weight: 600; }
.steps li.current::before { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-fill); }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { font-size: 18px; font-weight: 600; margin: 0; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.panel-body { padding: 24px; }
.panel-body .btn-primary { margin-top: 24px; }
.mt { margin-top: 18px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.hint-top { margin: 0 0 20px; font-size: 14px; }
.field-prefix { display: flex; align-items: stretch; border: 1px solid var(--border2); border-radius: 10px; background: var(--bg); overflow: hidden; transition: border-color 150ms ease, box-shadow 150ms ease; }
.field-prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fill); }
.field-prefix.invalid { border-color: var(--bad); }
.prefix { display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted); border-right: 1px solid var(--border2); background: var(--panel2); font-size: 15px; }
.field-prefix input, .field-prefix input[type="text"], .field-prefix input[type="text"]:focus { flex: 1; border-radius: 0; box-shadow: none; min-width: 0; border: none; background: transparent; min-height: 48px; padding: 0 14px; font: inherit; font-size: 16px; color: var(--text); outline: none; }
input[type="text"], input[type="password"], textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border2); border-radius: 10px; transition: border-color 150ms ease, box-shadow 150ms ease;
}
input[type="text"], input[type="password"] { min-height: 48px; padding: 0 14px; }
textarea { padding: 12px 14px; resize: vertical; line-height: 1.45; }
input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fill); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.7; }
.select-wrap { position: relative; }
select { appearance: none; min-height: 48px; padding: 0 150px 0 14px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.select-time { position: absolute; right: 36px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.scanning { display: flex; align-items: center; gap: 12px; color: var(--soft); padding: 8px 0; }
.spinner-dark { border-color: var(--border2); border-top-color: var(--accent); }
.btn-center { display: flex; width: 100%; margin-top: 8px; }
.sources { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.source { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.source.is-connected { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.src-row { display: flex; align-items: center; gap: 14px; }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 14px; white-space: nowrap; flex-shrink: 0; }
.src-status { font-size: 13px; color: var(--good); font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
/* "All good": a steady green dot with a ring that grows and fades. Decorative; still under reduced motion. */
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex-shrink: 0; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--good); opacity: 0;
  animation: live-ring 2s cubic-bezier(0.22, 1, 0.36, 1) infinite; }
@keyframes live-ring { from { transform: scale(1); opacity: 0.6; } to { transform: scale(2.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .live-dot::after { animation: none; } }
.src-setup { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.src-inline { display: flex; gap: 10px; }
.src-inline input { flex: 1; min-width: 0; }
.src-inline .btn { flex-shrink: 0; width: auto; margin-top: 0; min-height: 48px; }
.src-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--text); background: var(--panel2); border: 1px solid var(--border); flex-shrink: 0; }
.google-account { font-size: 14px; color: var(--soft); margin-bottom: 12px; overflow-wrap: anywhere; }
.google-account b { color: var(--text); font-weight: 600; }
.google-account .btn-link { margin-left: 6px; }
.src-setup select { padding-right: 40px; min-width: 0; }
#google-notice { margin-bottom: 12px; }
.src-cancel { display: block; margin: 4px auto 0; min-height: 36px; color: var(--muted); font-size: 14px; }
.src-cancel:hover { color: var(--text); }
.pay-steps { margin: 14px 0 16px; padding-left: 20px; color: var(--soft); font-size: 14px; line-height: 1.5; }
.pay-steps li + li { margin-top: 4px; }
.pay-steps a { color: var(--accent); font-weight: 500; }
.pay-steps b { color: var(--text); font-weight: 600; }
.pay-steps code { font-size: 13px; padding: 1px 5px; border-radius: 5px; background: var(--panel2); border: 1px solid var(--border); }
.key-rules { margin: 6px 0 8px; padding-left: 18px; }
.key-perms { width: 100%; max-width: 320px; border-collapse: collapse; font-size: 13px; margin-bottom: 4px; }
.key-perms th, .key-perms td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: center; }
.key-perms th[scope="row"], .key-perms thead th:first-child { text-align: left; font-weight: 500; color: var(--text); }
.key-perms thead th { color: var(--muted); font-weight: 500; }
.key-on { color: var(--good); font-weight: 700; }
.key-off { color: var(--muted); }
.src-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.src-text strong { font-weight: 600; }
.src-text span { color: var(--muted); font-size: 13px; }
.badge { font-size: 12px; color: var(--muted); border: 1px solid var(--border2); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
a.btn { text-decoration: none; }
@media (max-width: 480px) {
  .panel-body { padding: 20px; } .panel-head { padding: 16px 20px; }
  select { padding-right: 40px; } .select-time { display: none; }
  .badge { display: none; }
  .src-inline { flex-direction: column; }
  .src-inline .btn { width: 100%; }
  .source.is-connected .src-row { flex-wrap: wrap; row-gap: 4px; }
  .source.is-connected .src-text { flex-basis: calc(100% - 52px); }
  .source.is-connected .src-status { margin-left: 52px; }
}
@media (prefers-reduced-motion: no-preference) { .panel:not([hidden]) { animation: fade 300ms ease-out both; } }

.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.home-head h1 { margin: 0; }
.home-head .btn { min-height: 38px; font-size: 14px; }
.home .lead { margin-bottom: 20px; }
.project-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.project-list a { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--text); text-decoration: none; transition: border-color 150ms ease; }
.project-list a:hover { border-color: var(--border2); }
.project-list strong { font-weight: 600; }
.project-list span { color: var(--muted); font-size: 13px; }
