/* Paleta Life: altere estes tokens para trocar o tema da aplicação. */
:root {
  color-scheme: dark;
  --bg: #171619;
  --deep: #121215;
  --surface: #232226;
  --raised: #323035;
  --border: #686169;
  --subtle: #3d393f;
  --gold: #e9c98c;
  --gold-dark: #b08d51;
  --purple: #7437a1;
  --purple-hover: #632d8f;
  --purple-light: #d5b1ef;
  --purple-deep: #353029;
  --text: #f5f3f6;
  --muted: #b6b0bb;
  --success: #53be89;
  --error: #e06b6b;
  --display: 'Cormorant Garamond', Georgia, serif;
  --ui: 'Outfit', system-ui, sans-serif;
  --radius: 18px;
  --ease: cubic-bezier(.2, .8, .3, 1);
}

* { box-sizing: border-box; }
html { background: var(--deep); scroll-padding-block: 100px; }
body { margin: 0; background: radial-gradient(ellipse at 80% 0, #36302b 0, transparent 42%), var(--bg); color: var(--text); font: 400 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button, input, select, textarea, summary { scroll-margin-block: 100px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
img { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.12; }
h1, h2 { font-family: var(--display); font-weight: 600; }
h1 { margin-bottom: 8px; font-size: clamp(34px, 5vw, 52px); }
h2 { margin-bottom: 8px; font-size: clamp(25px, 3vw, 32px); }
h3 { font-size: 16px; }
p { color: var(--muted); }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.app-shell { min-height: 100dvh; }
.sidebar { display: none; }
.main-shell { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; padding: calc(12px + env(safe-area-inset-top)) 20px 12px; background: rgba(20,19,22,.88); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(233,201,140,.12); }
.brand, .mobile-brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); text-decoration: none; }
.mobile-brand { flex: 0 1 auto; }
.brand-mark, .mobile-brand .brand-mark, .brand .brand-mark, .auth-card .brand-mark { display: block; flex: 0 0 auto; width: 40px; height: 40px; object-fit: contain; }
.brand-wordmark { display: grid; min-width: 0; color: var(--text); font-family: var(--display); font-size: 23px; font-weight: 700; line-height: .9; letter-spacing: .035em; }
.brand-wordmark small { display: block; margin-top: 5px; color: var(--gold); font-family: var(--ui); font-size: 8px; font-weight: 600; line-height: 1.1; letter-spacing: .17em; text-transform: uppercase; }
.mobile-brand .brand-wordmark { font-size: 20px; }
.mobile-brand .brand-wordmark small { font-size: 7px; }
.topbar-title { display: none; }
.role-switch { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--purple-light); font-size: 12px; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; transition: background .16s var(--ease), border-color .16s var(--ease); }
.role-switch:hover { border-color: var(--purple-light); background: #30213d; }
.role-switch span { margin-left: 2px; }
.content { width: 100%; max-width: 1440px; min-height: 70vh; margin: auto; padding: 28px 20px calc(104px + env(safe-area-inset-bottom)); }
.mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 8; display: flex; justify-content: space-around; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--subtle); background: rgba(20,19,22,.95); backdrop-filter: blur(16px); }
.mobile-nav button, .mobile-nav a, .desktop-nav button, .desktop-nav a { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font: inherit; text-decoration: none; }
.mobile-nav button, .mobile-nav a { flex: 1 1 0; flex-direction: column; justify-content: center; min-width: 0; min-height: 52px; padding: 4px; border-radius: 9px; font-size: 10px; line-height: 1.2; }
.mobile-nav svg, .desktop-nav svg { flex: 0 0 auto; width: 21px; height: 21px; }
.mobile-nav [aria-current], .desktop-nav [aria-current] { color: var(--gold); }
.mobile-nav [aria-current] { background: var(--purple-deep); }

.card { padding: 20px; border: 1px solid var(--subtle); border-radius: var(--radius); background: linear-gradient(145deg, rgba(255,255,255,.035), transparent 55%), var(--surface); box-shadow: inset 0 1px rgba(255,255,255,.04), 0 12px 32px rgba(0,0,0,.1); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 11px 20px; border: 1px solid var(--purple); border-radius: 9px; background: var(--purple); color: #fff; box-shadow: inset 0 1px rgba(255,255,255,.14), 0 4px 14px rgba(0,0,0,.14); font-weight: 700; line-height: 1.3; text-align: center; text-decoration: none; transition: transform .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease); }
.button:hover { border-color: var(--purple-hover); background: var(--purple-hover); }
.button:active { transform: scale(.98); }
.button.secondary, .secondary { border: 1px solid var(--border); background: transparent; color: var(--purple-light); }
.button.secondary:hover, .secondary:hover { border-color: var(--purple-light); background: #30213d; }
.button.danger, .danger { border: 1px solid var(--error); background: transparent; color: var(--error); }
.button.danger:hover, .danger:hover { background: #3b242b; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 32px 0 16px; }
.section-heading h2, .section-heading h3 { margin: 0; }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.grid { display: grid; gap: 14px; }
.input, input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-width: 0; min-height: 48px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--deep); color: var(--text); }
.input:hover, input:not([type=checkbox]):not([type=radio]):hover, select:hover, textarea:hover { border-color: var(--gold-dark); }
input::placeholder, textarea::placeholder { color: #938d98; opacity: 1; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.pill, .badge { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; background: var(--purple-deep); color: var(--gold); font-size: 11px; font-weight: 600; }
.empty { padding: 36px 20px; color: var(--muted); text-align: center; }
.page-title { margin-bottom: 24px; }
.page-title p { margin-bottom: 0; }
.eyebrow { display: block; margin-bottom: 10px; color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.page-enter { animation: page-in .32s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.initial-loader { display: grid; min-height: 100dvh; place-content: center; justify-items: center; gap: 18px; color: var(--muted); }
.spinner { width: 35px; height: 35px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; z-index: 20; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: 90vw; padding: 13px 18px; transform: translate(-50%, 10px); border: 1px solid var(--border); border-radius: 10px; background: var(--raised); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.visible { transform: translate(-50%, 0); opacity: 1; }

.auth-screen { min-height: 100dvh; padding: 24px; background: var(--bg); }
.auth-screen .auth-card { width: min(100%, 440px); padding: clamp(28px, 6vw, 44px); border-color: var(--border); border-radius: 20px; background: linear-gradient(145deg, rgba(255,255,255,.035), transparent 55%), var(--surface); box-shadow: inset 0 1px rgba(255,255,255,.04), 0 12px 32px rgba(0,0,0,.1); }
.auth-card .brand, .auth-card .mobile-brand { justify-content: flex-start; margin-bottom: 14px; }
.auth-card .brand-mark { width: 52px; height: 52px; }
.auth-card .brand-wordmark { font-size: 28px; }
.auth-card h1 { font-size: clamp(34px, 6vw, 44px); }
.auth-card p { line-height: 1.6; }
.auth-card .button { width: 100%; margin-top: 8px; }

@media (max-width: 380px) {
  .topbar { gap: 8px; padding-right: 12px; padding-left: 12px; }
  .mobile-brand { gap: 6px; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; }
  .mobile-brand .brand-wordmark { font-size: 18px; }
  .role-switch { padding-right: 9px; padding-left: 9px; font-size: 11px; }
  .content { padding-right: 16px; padding-left: 16px; }
}
@media (max-width: 799px) {
  .input, input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; }
  .topbar { min-height: 78px; }
  .role-switch { min-height: 44px; }
  .mobile-nav { border-color: var(--border); box-shadow: 0 -8px 24px rgba(0,0,0,.14); }
  .mobile-nav [aria-current] { box-shadow: inset 0 2px var(--gold); }
}
@media (min-width: 800px) {
  .app-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; padding: 32px 18px 24px; border-right: 1px solid rgba(233,201,140,.12); background: linear-gradient(160deg, rgba(255,255,255,.025), transparent 60%), var(--deep); }
  .brand { min-height: 64px; padding: 0 12px; }
  .brand .brand-mark { width: 46px; height: 46px; }
  .sidebar-label { margin: 32px 0 12px; padding: 0 14px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .16em; }
  .desktop-nav { display: grid; gap: 5px; }
  .desktop-nav button, .desktop-nav a { width: 100%; min-height: 46px; gap: 12px; padding: 11px 14px; border-radius: 9px; font-size: 14px; text-align: left; }
  .desktop-nav button:hover, .desktop-nav a:hover { background: var(--raised); color: var(--text); }
  .desktop-nav [aria-current], .desktop-nav [aria-current]:hover { background: var(--purple-deep); color: var(--gold); box-shadow: inset 3px 0 var(--gold); }
  .sidebar-bottom { margin-top: auto; padding: 16px 14px 8px; border-top: 1px solid var(--subtle); color: var(--muted); font-size: 11px; }
  .local-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--success); }
  .mobile-brand, .mobile-nav { display: none; }
  .topbar { min-height: 78px; padding: 16px clamp(24px, 4vw, 56px); }
  .topbar-title { display: grid; min-width: 0; font-weight: 600; }
  .topbar-title small { overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 42px clamp(24px, 4vw, 56px) 70px; }
  #toast { bottom: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Shared details: the same quiet metallic edge follows current navigation and focus. */
.topbar-separator { margin: 0 10px; color: var(--gold-dark); font-weight: 400; }
.sidebar-signature { display: block; color: var(--text); font: 500 25px/1.1 var(--display); }
.sidebar-signature em { color: var(--gold); }
.button.secondary, .button.danger, .role-switch { box-shadow: none; }
.button:disabled { transform: none; }
@media (hover: hover) { .button:hover { box-shadow: 0 6px 20px rgba(116,55,161,.25); } }
@media (min-width: 800px) {
 .desktop-nav button, .desktop-nav a { min-height: 50px; }
 .desktop-nav [aria-current], .desktop-nav [aria-current]:hover { background: linear-gradient(100deg, rgba(233,201,140,.14), rgba(233,201,140,.035)); border: 1px solid rgba(233,201,140,.25); box-shadow: inset 0 1px rgba(255,255,255,.06); }
 .sidebar-bottom { border-top-color: rgba(233,201,140,.16); }
}
