/* ── CrowTalk · Base · Design tokens, reset, layout ─────────────────── */

:root {
  /* Colours */
  --bg:    #0d1117;
  --s1:    #161b27;
  --s2:    #1e2535;
  --s3:    #2a3247;
  --t1:    #e6eaf3;
  --t2:    #8b95a8;
  --t3:    #4e5668;
  --acc:   #2dd4bf;   /* teal  */
  --acc2:  #a78bfa;   /* purple */
  --green: #3ecf72;
  --red:   #e85555;
  --amber: #f0a832;

  /* Layout */
  --top-h:    52px;
  --nav-h:    64px;
  --radius:   12px;
  --radius-sm: 8px;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* ─ Type scale ─ */
  --fs-xs:   11px;
  --fs-sm:   12px;
  --fs-base: 14px;
  --fs-ui:   15px;
  --fs-lg:   18px;
  --fs-xl:   22px;
  --fs-2xl:  28px;

  /* ─ Letter-spacing ─ */
  --ls-tight: -0.4px;
  --ls-snug:  -0.2px;
  --ls-cap:    0.6px;

  /* ─ Elevation shadows ─ */
  --shadow-1: 0 1px 3px rgba(0,0,0,.22), 0 1px 2px rgba(0,0,0,.14);
  --shadow-2: 0 3px 10px rgba(0,0,0,.38), 0 1px 3px rgba(0,0,0,.2);
  --shadow-3: 0 8px 28px rgba(0,0,0,.52);

  /* ─ Nature palette (Dr. Dolittle) ─ */
  --leaf:    #52b788;
  --feather: #c4a862;
  --bark:    #a07448;
  --sky-blue: #5ba4cf;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure [hidden] attribute always wins over any display:flex/block rules */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--t1);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── Default heading rhythm ─────────────────────────────────────── */
h1, h2, h3, h4 { letter-spacing: var(--ls-snug); line-height: 1.25; }

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

input, textarea, button, select {
  font-family: var(--font);
  font-size: 15px;
  color: inherit;
}

button { cursor: pointer; border: none; background: none; }

/* ── App shell ─────────────────────────────────────────────────────── */
#appShell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
}

.top-bar {
  height: var(--top-h);
  background: var(--s1);
  border-bottom: 1px solid var(--s3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.user-badge {
  font-size: 12px;
  color: var(--t3);
  background: var(--s2);
  padding: 3px 8px;
  border-radius: 20px;
}

/* ── Breadcrumb bar ─────────────────────────────────────────── */
.app-breadcrumb {
  height: 36px;
  background: var(--s2);
  border-bottom: 1px solid var(--s3);
  display: flex;
  align-items: center;
  padding: 0 12px 0 4px;
  flex-shrink: 0;
  gap: 0;
}

.breadcrumb-back {
  background: none;
  border: none;
  color: var(--acc);
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  padding: 0 8px 0 4px;
  line-height: 1;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.breadcrumb-path {
  display: flex;
  align-items: center;
  list-style: none;
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  gap: 0;
}

.breadcrumb-seg {
  color: var(--t3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-seg:last-child {
  color: var(--t1);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--t3);
  margin: 0 5px;
  font-size: 11px;
  flex-shrink: 0;
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + 8px);
}

.tab-pane {
  min-height: 100%;
  padding: 16px;
}

.tab-pane[hidden] { display: none; }

.tab-intro {
  color: var(--t2);
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

/* ── Bottom nav ────────────────────────────────────────────────────── */
.bottom-nav {
  height: var(--nav-h);
  background: var(--s1);
  border-top: 1px solid var(--s3);
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--t3);
  font-size: 11px;
  font-weight: 500;
  transition: color .15s;
  padding: 4px 0 2px;
}

.nav-btn svg { width: 22px; height: 22px; }

.nav-btn.active { color: var(--acc); }
.nav-btn:hover  { color: var(--t2); }

/* ── Auth screen ───────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
}

.auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../images/crow-photo.jpg') center / cover no-repeat;
  filter: brightness(1.25) contrast(1.1) saturate(1.15);
  z-index: 0;
}

.auth-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(8,14,26,.52) 0%, rgba(8,14,26,.38) 50%, rgba(8,14,26,.72) 100%),
    linear-gradient(to bottom, rgba(8,14,26,.3) 0%, rgba(8,14,26,.72) 100%);
  z-index: 1;
}

.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.auth-logo { line-height: 1; margin-bottom: 16px; display: block; }
.auth-logo svg { width: 140px; height: 140px; filter: brightness(2.0) drop-shadow(0 2px 16px rgba(0,0,0,.7)); }

.auth-title {
  font-size: var(--fs-2xl, 28px);
  font-weight: 700;
  letter-spacing: var(--ls-tight, -0.5px);
  margin-bottom: 4px;
  color: var(--t1);
}

.auth-sub {
  font-size: 13px;
  color: var(--t3);
  margin-bottom: 32px;
}

.auth-error {
  background: rgba(232,85,85,.12);
  border: 1px solid rgba(232,85,85,.3);
  color: #ff8080;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: left;
}

.auth-divider {
  color: var(--t3);
  font-size: 12px;
  margin: 12px 0;
  position: relative;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--s3);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-switch {
  font-size: 13px;
  color: var(--t3);
  margin-top: 16px;
}

.remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--t2);
  cursor: pointer;
}

.remember-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.forgot-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.85;
}
.forgot-link:hover { opacity: 1; text-decoration: underline; }

.auth-form-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 6px;
  text-align: center;
}

.auth-form-sub {
  font-size: 13px;
  color: var(--t3);
  margin-bottom: 20px;
  text-align: center;
}

.magic-sent-icon { font-size: 40px; margin-bottom: 12px; }

.magic-sent { padding: 24px 0; }
.magic-icon { font-size: 40px; margin-bottom: 12px; }
.magic-sent p { color: var(--t2); font-size: 15px; }

/* ── Save status ───────────────────────────────────────────────────── */
.save-status {
  font-size: 12px;
  color: var(--t3);
  text-align: center;
  margin-top: 8px;
  font-family: monospace;
}
