/* === NOTION-INSPIRED DESIGN SYSTEM === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

:root {
  --primary:        #5645d4;
  --primary-press:  #4534b3;
  --primary-light:  #ede9fb;
  --canvas:         #ffffff;
  --surface:        #f6f5f4;
  --surface-soft:   #fafaf9;
  --hairline:       #e5e3df;
  --hairline-str:   #c8c4be;
  --ink:            #1a1a1a;
  --charcoal:       #37352f;
  --slate:          #5d5b54;
  --steel:          #787671;
  --muted:          #bbb8b1;
  --success:        #1aae39;
  --success-light:  #d9f3e1;
  --warning:        #dd5b00;
  --warning-light:  #ffe8d4;
  --error:          #e03131;
  --error-light:    #fde0ec;
  --tint-mint:      #d9f3e1;
  --tint-sky:       #dcecfa;
  --tint-lavender:  #e6e0f5;
  --tint-peach:     #ffe8d4;
  --tint-rose:      #fde0ec;
  --tint-yellow:    #fef7d6;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 9999px;

  --nav-h: 68px;
  --header-h: 56px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  min-height: 100dvh;
  padding-bottom: var(--nav-h);
  -webkit-font-smoothing: antialiased;
}

body.no-nav { padding-bottom: 0; }

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

img { max-width: 100%; display: block; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--hairline-str); border-radius: var(--r-full); }

/* === TOP HEADER === */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.top-header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  flex: 1;
}
.top-header .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}
.top-header .header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  text-align: center;
}
.top-header .header-action {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--slate);
  cursor: pointer;
  background: none;
  border: none;
}
.top-header .header-action:hover { background: var(--surface); }

/* === BOTTOM NAV === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--nav-h);
  background: var(--canvas);
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--steel);
  text-decoration: none;
  padding: 8px 4px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item .material-icons-round { font-size: 22px; }
.nav-item span.nav-label { font-size: 10px; font-weight: 500; letter-spacing: 0.2px; }
.nav-item.active { color: var(--primary); }
.nav-item:hover { color: var(--charcoal); }

/* === PAGE CONTAINER === */
.page {
  max-width: 540px;
  margin: 0 auto;
  padding: 16px;
}
.page-wide {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

/* === CARDS === */
.card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px;
}
.card + .card { margin-top: 12px; }
.card-sm { padding: 14px 16px; }
.card-tint-mint     { background: var(--tint-mint);     border-color: #b8e8c6; }
.card-tint-sky      { background: var(--tint-sky);      border-color: #b8d8f0; }
.card-tint-lavender { background: var(--tint-lavender); border-color: #c8b8f0; }
.card-tint-peach    { background: var(--tint-peach);    border-color: #f0cca8; }
.card-tint-rose     { background: var(--tint-rose);     border-color: #f0b8cc; }
.card-tint-yellow   { background: var(--tint-yellow);   border-color: #e8d898; }

/* === SECTION TITLE === */
.section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 10px;
  margin-top: 20px;
}
.section-title:first-child { margin-top: 0; }

/* === TYPOGRAPHY === */
h1 { font-size: 22px; font-weight: 600; line-height: 1.3; color: var(--ink); }
h2 { font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--ink); }
h3 { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--charcoal); }
p  { color: var(--charcoal); }

.text-sm   { font-size: 13px; }
.text-xs   { font-size: 12px; }
.text-muted { color: var(--steel); }
.text-slate { color: var(--slate); }
.fw-500    { font-weight: 500; }
.fw-600    { font-weight: 600; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  border: none;
  border-radius: var(--r-md);
  padding: 10px 18px;
  transition: background 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .material-icons-round { font-size: 18px; }

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-press); color: #fff; text-decoration: none; }
.btn-primary:active { background: var(--primary-press); }

.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--hairline-str); }
.btn-secondary:hover { background: var(--hairline); color: var(--ink); text-decoration: none; }

.btn-danger  { background: var(--error-light); color: var(--error); }
.btn-success { background: var(--success-light); color: var(--success); }
.btn-warning { background: var(--warning-light); color: var(--warning); }

.btn-ghost   { background: transparent; color: var(--slate); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); text-decoration: none; }

.btn-full    { width: 100%; }
.btn-sm      { font-size: 13px; padding: 7px 14px; }
.btn-lg      { font-size: 16px; padding: 13px 24px; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--slate);
  border: 1px solid var(--hairline);
}
.btn-icon:hover { background: var(--hairline); color: var(--ink); text-decoration: none; }
.btn-icon .material-icons-round { font-size: 18px; }

/* === FORMS === */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--charcoal);
  margin-bottom: 6px;
}
.label-hint { font-size: 12px; color: var(--steel); font-weight: 400; margin-left: 4px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--hairline-str);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
textarea {
  height: auto;
  min-height: 100px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23787671' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-error { font-size: 12px; color: var(--error); margin-top: 4px; }
.form-hint  { font-size: 12px; color: var(--steel); margin-top: 4px; }

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-full);
  line-height: 1;
}
.badge-mint    { background: var(--tint-mint);    color: #14803a; }
.badge-sky     { background: var(--tint-sky);     color: #1a5fa8; }
.badge-lavender{ background: var(--tint-lavender);color: #4a2ea0; }
.badge-yellow  { background: var(--tint-yellow);  color: #8a6200; }
.badge-peach   { background: var(--tint-peach);   color: #b04000; }
.badge-rose    { background: var(--tint-rose);    color: #a02060; }
.badge-gray    { background: var(--surface);      color: var(--slate); border: 1px solid var(--hairline); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* === FLASH MESSAGES === */
.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
}
.flash-success { background: var(--tint-mint);   color: #14803a; }
.flash-error   { background: var(--tint-rose);   color: #a02060; }
.flash-warning { background: var(--tint-yellow);  color: #8a6200; }
.flash-info    { background: var(--tint-sky);    color: #1a5fa8; }
.flash .material-icons-round { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* === AVATAR === */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }

/* === LIST ITEMS === */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 15px; font-weight: 500; color: var(--ink); }
.list-item-sub   { font-size: 13px; color: var(--steel); margin-top: 2px; }

/* === STAT CARD === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 16px;
}
.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--steel);
  margin-top: 4px;
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 10px;
}

/* === VOTING === */
.vote-bar-wrap {
  margin-top: 12px;
}
.vote-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--steel);
  margin-bottom: 6px;
}
.vote-bar {
  display: flex;
  height: 8px;
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--hairline);
}
.vote-bar-sim     { background: var(--success); }
.vote-bar-nao     { background: var(--error); }
.vote-bar-abstenc { background: var(--muted); }

.vote-btns {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.vote-btns .btn { flex: 1; }
.vote-btn-sim  { background: var(--tint-mint);  color: #14803a; border: 1px solid #b8e8c6; }
.vote-btn-nao  { background: var(--tint-rose);  color: #a02060; border: 1px solid #f0b8cc; }
.vote-btn-abs  { background: var(--surface);    color: var(--slate); border: 1px solid var(--hairline-str); }
.vote-btn-sim.selected { background: var(--success); color: #fff; border-color: var(--success); }
.vote-btn-nao.selected { background: var(--error);   color: #fff; border-color: var(--error); }
.vote-btn-abs.selected { background: var(--slate);   color: #fff; border-color: var(--slate); }

/* === TRIBUNA STATUS === */
.tribuna-order {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

/* === FAQ ACCORDION === */
.accordion { border: 1px solid var(--hairline); border-radius: var(--r-lg); overflow: hidden; }
.accordion + .accordion { margin-top: 8px; }
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--canvas);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  user-select: none;
  gap: 12px;
}
.accordion-header .material-icons-round {
  font-size: 18px;
  color: var(--steel);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.accordion.open .accordion-header .material-icons-round { transform: rotate(180deg); }
.accordion-body {
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s;
  font-size: 14px;
  color: var(--charcoal);
  line-height: 1.6;
}
.accordion.open .accordion-body {
  max-height: 500px;
  padding: 0 16px 16px;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--steel);
}
.empty-state .material-icons-round { font-size: 48px; color: var(--muted); margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; color: var(--slate); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* === DIVIDER === */
.divider {
  height: 1px;
  background: var(--hairline);
  margin: 16px 0;
}

/* === CHIP === */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-full);
  border: 1px solid var(--hairline-str);
  background: var(--canvas);
  color: var(--charcoal);
  cursor: pointer;
  transition: all 0.15s;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* === LOADER === */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--hairline);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

/* === AUTH PAGES === */
.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-soft);
  padding-bottom: 0;
}
.auth-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.auth-logo-icon {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
}
.auth-logo-text { font-size: 18px; font-weight: 600; color: var(--ink); }
.auth-logo-sub  { font-size: 12px; color: var(--steel); }
.auth-title { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.auth-sub   { font-size: 14px; color: var(--slate); margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--steel); }

/* === ADMIN SPECIFIC === */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
}

/* === TABLE (admin) === */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--steel);
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}
tbody td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--hairline);
  color: var(--charcoal);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-soft); }

/* === MODAL === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--canvas);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 540px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--hairline-str);
  border-radius: var(--r-full);
  margin: 0 auto 20px;
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; }

/* === TABS === */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-item {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--steel);
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* === UTILITIES === */
.d-flex  { display: flex; }
.ai-center { align-items: center; }
.jc-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === RESPONSIVE === */
@media (min-width: 541px) {
  body { background: var(--surface); }
  .page, .page-wide { padding: 24px; }
  .modal-backdrop { align-items: center; }
  .modal { border-radius: var(--r-xl); margin: 20px; }
}
