/* AssistePsi — CSS Principal */
/* Baseado na identidade visual definida nos wireframes */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --blue:   #4A6FA5;
  --green:  #7AAE8E;
  --terra:  #C4724A;
  --dark:   #2D2D2D;
  --gray:   #888;
  --light:  #F5F5F5;
  --white:  #fff;
  --border: #E8E8E8;
  --nav-h:  64px;
  --top-h:  56px;
}

html, body { height: 100%; font-family: -apple-system, 'Inter', sans-serif; color: var(--dark); background: var(--light); }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }

/* ── Shell ── */
.shell { display: flex; flex-direction: column; height: 100dvh; max-width: 430px; margin: 0 auto; background: var(--light); }

/* ── Topbar ── */
.topbar { height: var(--top-h); background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 10px; flex-shrink: 0; position: sticky; top: 0; z-index: 10; }
.topbar-logo { font-size: 20px; font-weight: 700; flex: 1; letter-spacing: -0.5px; }
.topbar-logo span { color: var(--blue); font-weight: 800; }
.topbar h1 { font-size: 17px; font-weight: 600; flex: 1; }
.topbar-action { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--light); font-size: 18px; cursor: pointer; flex-shrink: 0; }
.topbar-back { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--light); font-size: 20px; cursor: pointer; flex-shrink: 0; }

/* ── Content ── */
.content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: calc(var(--nav-h) + 16px); -webkit-overflow-scrolling: touch; }
.content.no-pad { padding: 0; padding-bottom: var(--nav-h); }

/* ── Bottom Nav ── */
.bottom-nav { height: var(--nav-h); background: var(--white); border-top: 1px solid var(--border); display: flex; align-items: stretch; flex-shrink: 0; position: sticky; bottom: 0; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--gray); font-size: 11px; font-weight: 500; padding-bottom: 4px; }
.nav-item .nav-icon { font-size: 22px; line-height: 1; }
.nav-item.active { color: var(--blue); }

/* ── FAB ── */
.fab { position: fixed; bottom: calc(var(--nav-h) + 16px); right: 16px; width: 56px; height: 56px; border-radius: 50%; background: var(--blue); color: var(--white); font-size: 26px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(74,111,165,0.4); cursor: pointer; border: none; z-index: 20; }

/* ── Cards ── */
.card { background: var(--white); border-radius: 14px; border: 1px solid var(--border); overflow: hidden; }
.card + .card { margin-top: 12px; }
.card-pad { padding: 16px; }

/* ── Stat ── */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat-card { background: var(--white); border-radius: 14px; border: 1px solid var(--border); padding: 16px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--gray); margin-top: 2px; }
.stat-delta { font-size: 11px; color: var(--green); margin-top: 6px; }
.stat-warn  { font-size: 11px; color: var(--terra); margin-top: 6px; }

/* ── List items ── */
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #F4F4F4; cursor: pointer; transition: background 0.1s; text-decoration: none; color: inherit; }
.list-item:last-child { border-bottom: none; }
.list-item:active { background: #F8F8F8; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub { font-size: 13px; color: var(--gray); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-chevron { color: #CCC; font-size: 16px; flex-shrink: 0; }

/* ── Section label ── */
.section-label { font-size: 12px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; margin: 20px 0 8px; }
.section-label:first-child { margin-top: 0; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; flex-shrink: 0; white-space: nowrap; }
.badge-green  { background: #E8F5EE; color: #2D7A4F; }
.badge-blue   { background: #E8EEF7; color: #2A4F8A; }
.badge-orange { background: #FBF0EA; color: #8B4513; }
.badge-gray   { background: #F0F0F0; color: #666; }
.badge-red    { background: #FDECEA; color: #B03020; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 20px; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; border: none; transition: opacity 0.15s; text-decoration: none; }
.btn:active { opacity: 0.8; }
.btn-primary   { background: var(--blue); color: var(--white); }
.btn-success   { background: var(--green); color: var(--white); }
.btn-danger    { background: #D94F4F; color: var(--white); }
.btn-secondary { background: var(--white); color: var(--dark); border: 1.5px solid var(--border); }
.btn-ghost     { background: transparent; color: var(--blue); padding: 8px 12px; font-size: 14px; }
.btn-full      { width: 100%; }
.btn-sm        { padding: 8px 14px; font-size: 13px; border-radius: 9px; }
.btn:disabled  { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 6px; }
.form-input { width: 100%; padding: 13px 14px; border: 1.5px solid #D8D8D8; border-radius: 12px; font-size: 15px; color: var(--dark); background: var(--white); outline: none; appearance: none; font-family: inherit; }
.form-input:focus { border-color: var(--blue); }
.form-input:disabled { background: #F8F8F8; color: #AAA; }
.form-hint { font-size: 12px; color: #AAA; margin-top: 5px; }
textarea.form-input { resize: none; min-height: 120px; line-height: 1.6; }

/* ── Alerts ── */
.alert { padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; display: flex; gap: 8px; margin-bottom: 12px; }
.alert-info    { background: #E8EEF7; color: #2A4F8A; }
.alert-success { background: #E8F5EE; color: #1D5C38; }
.alert-warning { background: #FBF0EA; color: #7A3A10; }
.alert-red     { background: #FDECEA; color: #8B1A1A; }

/* ── Toggle ── */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #F4F4F4; }
.toggle-row:last-child { border-bottom: none; }
.toggle { width: 48px; height: 28px; border-radius: 14px; background: var(--green); position: relative; cursor: pointer; flex-shrink: 0; }
.toggle::after { content: ''; position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 4px rgba(0,0,0,0.2); transition: right 0.2s; }
.toggle.off { background: #D0D0D0; }
.toggle.off::after { right: auto; left: 3px; }

/* ── Bottom Sheet ── */
.sheet-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 50; display: flex; align-items: flex-end; }
.sheet { background: var(--white); border-radius: 20px 20px 0 0; padding: 16px; width: 100%; max-height: 90dvh; overflow-y: auto; }
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: #DDD; margin: 0 auto 16px; }
.sheet-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.sheet-sub { font-size: 13px; color: var(--gray); margin-bottom: 20px; }

/* ── Auth pages ── */
.auth-page { min-height: 100dvh; background: var(--light); display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { background: var(--white); border-radius: 20px; padding: 32px 24px; width: 100%; border: 1px solid var(--border); box-shadow: 0 4px 24px rgba(0,0,0,0.06); }
.auth-logo { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 6px; }
.auth-logo span { color: var(--blue); font-weight: 800; }
.auth-sub { font-size: 14px; color: var(--gray); margin-bottom: 28px; }

.passkey-btn { width: 100%; padding: 15px; background: var(--dark); color: var(--white); border: none; border-radius: 14px; font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; font-family: inherit; }
.or-line { display: flex; align-items: center; gap: 10px; color: #CCC; font-size: 13px; margin: 16px 0; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Steps ── */
.steps { display: flex; align-items: center; margin-bottom: 24px; }
.step { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #AAA; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: #E0E0E0; color: #AAA; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.step.active .step-num { background: var(--blue); color: var(--white); }
.step.active { color: var(--dark); font-weight: 500; }
.step.done .step-num { background: var(--green); color: var(--white); }
.step-line { flex: 1; height: 1px; background: #E0E0E0; margin: 0 6px; }

/* ── Timeline ── */
.tl-item { display: flex; gap: 12px; padding: 0 16px 20px; }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; background: #E8EEF7; border: 2px solid var(--blue); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--blue); flex-shrink: 0; }
.tl-line { flex: 1; width: 1px; background: #EEE; margin-top: 4px; }
.tl-body { flex: 1; }
.tl-date { font-size: 12px; color: var(--gray); margin-bottom: 6px; }
.tl-card { background: #FAFAFA; border: 1px solid #EEE; border-radius: 12px; padding: 12px; }
.tl-text { font-size: 14px; color: #444; line-height: 1.6; }
.tl-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tl-tag { background: var(--light); border-radius: 6px; padding: 3px 9px; font-size: 12px; color: #666; }
.tl-meta { font-size: 11px; color: #AAA; margin-top: 6px; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 1.5px solid var(--border); margin-bottom: 16px; }
.tab { flex: 1; padding: 12px; text-align: center; font-size: 14px; font-weight: 500; color: var(--gray); border: none; background: none; cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; font-family: inherit; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── Recorder ── */
.recorder-area { background: var(--light); border-radius: 14px; border: 1.5px dashed #CCC; padding: 24px 16px; text-align: center; }
.rec-btn { width: 72px; height: 72px; border-radius: 50%; background: var(--terra); border: none; color: var(--white); font-size: 28px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.rec-btn.gravando { background: #B03020; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(176,48,32,0.35); } 50% { box-shadow: 0 0 0 12px rgba(176,48,32,0); } }

/* ── Chips ── */
.chip { padding: 7px 14px; border-radius: 20px; background: var(--light); border: 1.5px solid var(--border); font-size: 13px; cursor: pointer; display: inline-block; }
.chip.selecionado { background: #E8EEF7; border-color: var(--blue); color: var(--blue); }

/* ── Avatar ── */
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: var(--white); }
.bg-blue { background: var(--blue); }

/* ── Pill filters ── */
.pill-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; margin-bottom: 16px; }
.pill-row::-webkit-scrollbar { display: none; }
.pill { padding: 7px 16px; border-radius: 20px; white-space: nowrap; font-size: 13px; font-weight: 500; cursor: pointer; flex-shrink: 0; border: 1.5px solid var(--border); background: var(--white); color: var(--gray); }
.pill.active { background: var(--blue); color: var(--white); border-color: var(--blue); }

/* ── Trial banner ── */
.trial-banner { background: linear-gradient(135deg, var(--blue), var(--green)); border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; color: var(--white); display: flex; align-items: center; justify-content: space-between; }
.btn-trial { background: rgba(255,255,255,0.2); border-radius: 8px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--white); }

/* ── Empty state ── */
.empty { text-align: center; padding: 48px 24px; color: #AAA; }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty p { font-size: 14px; line-height: 1.6; }

/* ── Public form ── */
.public-page { min-height: 100dvh; background: var(--light); padding: 16px; }
.public-card { background: var(--white); border-radius: 20px; padding: 24px; border: 1px solid var(--border); max-width: 480px; margin: 0 auto; }

/* ── Utilitários ── */
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.text-sm { font-size: 13px; }
.text-xl { font-size: 20px; }
.font-bold { font-weight: 700; }
.text-gray { color: var(--gray); }
.text-blue { color: var(--blue); }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Responsivo desktop ── */
@media (min-width: 768px) {
  .shell { max-width: 480px; }
}

@media (min-width: 1024px) {
  .shell { max-width: 1024px; flex-direction: row; }
  .content { padding-bottom: 24px; }
  .bottom-nav { display: none; }
  /* Em desktop, sidebar lateral (futuro) */
}
