/* public/css/main.css — CondoConnect Design System */

/* ══════════════════════════════════════════
   TEMA ESCURO (padrão)
══════════════════════════════════════════ */
:root {
  --bg:       #0d0f14;
  --surface:  #161921;
  --surface2: #1e2230;
  --surface3: #252a3a;
  --border:   #2a3048;
  --shadow:   0 4px 32px rgba(0,0,0,0.4);
  --topbar-bg:rgba(13,15,20,0.92);

  --text:  #e8eaf2;
  --text2: #8891b0;
  --text3: #4a5068;

  --accent:  #4f8cff;
  --accent2: #7c5cfc;
  --green:   #2ecc8a;
  --yellow:  #f5c842;
  --red:     #ff5c5c;
  --orange:  #ff8c42;

  --radius:    12px;
  --radius-sm: 8px;
  --topbar-h:  60px;
  --sidebar-w: 220px;

  /* transição suave ao trocar tema */
  --theme-transition: background 0.25s ease, color 0.25s ease,
                      border-color 0.25s ease, box-shadow 0.25s ease;
}

/* ══════════════════════════════════════════
   TEMA CLARO — sobrescreve apenas as vars
   que mudam; cores de acento permanecem
══════════════════════════════════════════ */
[data-theme="light"] {
  --bg:       #f0f2f7;
  --surface:  #ffffff;
  --surface2: #f5f6fa;
  --surface3: #eaecf3;
  --border:   #d8dce8;
  --shadow:   0 4px 32px rgba(0,0,0,0.10);
  --topbar-bg:rgba(255,255,255,0.92);

  --text:  #111827;
  --text2: #4b5563;
  --text3: #9ca3af;

  /* acento ligeiramente mais saturado no claro */
  --accent:  #2563eb;
  --accent2: #6d28d9;
  --green:   #059669;
  --yellow:  #d97706;
  --red:     #dc2626;
  --orange:  #ea580c;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: var(--theme-transition);
}

/* ══════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════ */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 28px env(safe-area-inset-bottom, 0px);
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  transition: var(--theme-transition);
}
.logo { font-family: 'Arial', sans-serif; font-weight: 800; font-size: 1.25rem; letter-spacing: -.5px; display:flex; align-items:center; gap:12px; }
.logo span { color: var(--accent); }

.mode-switcher { display: flex; gap: 6px; background: var(--surface); border-radius: 10px; padding: 4px; border: 1px solid var(--border); }
.mode-btn { padding: 6px 18px; border-radius: 7px; border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: .85rem; transition: all .2s; background: transparent; color: var(--text2); }
.mode-btn.active { background: var(--accent); color: #fff; }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-left  { display: flex; align-items: center; gap: 12px; }

/* ── Hamburger (visível só no mobile) ── */
.hamburger-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 1.3rem; line-height: 1;
  border-radius: var(--radius-sm);
  transition: background .2s;
  flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--surface2); }

/* ── Botão de tema ── */
.theme-btn {
  position: relative;
  width: 52px; height: 28px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease;
  flex-shrink: 0;
  padding: 0;
}
.theme-btn-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .25s;
  user-select: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
[data-theme="light"] .theme-btn-knob { transform: translateX(24px); }
.theme-btn-track {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 5px;
  position: absolute; inset: 0;
  font-size: .6rem; pointer-events: none;
}
/* ícones nas pontas da track */
.theme-btn-track::before { content: '☀️'; }
.theme-btn-track::after  { content: '🌙'; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent2), var(--accent)); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; cursor: pointer; color: #fff; flex-shrink: 0; }
.notif-btn { position: relative; background: none; border: none; color: var(--text2); cursor: pointer; padding: 6px; border-radius: 8px; transition: background .2s; font-size: 1.1rem; }
.notif-btn:hover { background: var(--surface2); }
.notif-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid var(--bg); }
.notif-count { position: absolute; top: 0; right: 0; background: var(--red); color: #fff; border-radius: 10px; font-size: .62rem; font-weight: 700; padding: 1px 4px; border: 2px solid var(--bg); min-width: 16px; text-align: center; }

/* ══════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════ */
.app-layout { display: flex; padding-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); min-height: 100vh; }

#sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); left: 0; bottom: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px; overflow-y: auto;
  transition: transform .3s, var(--theme-transition);
}
.sidebar-section { margin-bottom: 28px; }
.sidebar-label { font-size: .68rem; font-weight: 700; letter-spacing: 1.5px; color: var(--text3); text-transform: uppercase; padding: 0 8px; margin-bottom: 8px; display: block; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: all .18s; font-size: .88rem; font-weight: 400; color: var(--text2); user-select: none; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(79,140,255,.15); color: var(--accent); font-weight: 500; }
[data-theme="light"] .nav-item.active { background: rgba(37,99,235,.10); }
.nav-item .icon { width: 18px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 10px; font-size: .68rem; font-weight: 700; padding: 1px 6px; }
.nav-badge.green { background: var(--green); }
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px; min-height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px)); }

/* ── Overlay do sidebar (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ── Mode-switcher dentro do sidebar (mobile) ── */
.sidebar-mode-switcher {
  display: none;
  gap: 6px;
  background: var(--surface2);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.sidebar-mode-switcher .mode-btn { flex: 1; text-align: center; padding: 7px 10px; }

/* ══════════════════════════════════════════
   VIEWS
══════════════════════════════════════════ */
.view { display: none; animation: fadeIn .3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════════════════════
   GRID
══════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.page-title { font-family: 'Arial', sans-serif; font-weight: 700; font-size: 1.5rem; margin-bottom: 4px; }
.page-subtitle { color: var(--text2); font-size: .9rem; margin-bottom: 28px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color .2s, box-shadow .2s, var(--theme-transition);
}
.card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(79,140,255,.15); }
[data-theme="light"] .card { box-shadow: 0 1px 4px rgba(0,0,0,.06); }
[data-theme="light"] .card:hover { box-shadow: 0 4px 16px rgba(37,99,235,.10); }
.card-title { font-family: 'Arial', sans-serif; font-weight: 600; font-size: .95rem; margin-bottom: 12px; }
.stat-number { font-family: 'Arial', sans-serif; font-weight: 800; font-size: 2rem; }
.stat-label { color: var(--text2); font-size: .8rem; margin-top: 4px; }
.stat-delta { font-size: .78rem; margin-top: 6px; }
.stat-delta.up { color: var(--green); } .stat-delta.down { color: var(--red); }

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.badge-blue   { background: rgba(79,140,255,.18);  color: var(--accent); }
.badge-green  { background: rgba(46,204,138,.18);  color: var(--green); }
.badge-yellow { background: rgba(245,200,66,.18);  color: var(--yellow); }
.badge-red    { background: rgba(255,92,92,.18);   color: var(--red); }
.badge-purple { background: rgba(124,92,252,.18);  color: var(--accent2); }
.badge-orange { background: rgba(255,140,66,.18);  color: var(--orange); }
.badge-gray   { background: rgba(136,145,176,.15); color: var(--text2); }

[data-theme="light"] .badge-blue   { background: rgba(37,99,235,.12);  }
[data-theme="light"] .badge-green  { background: rgba(5,150,105,.12);  }
[data-theme="light"] .badge-yellow { background: rgba(217,119,6,.12);  }
[data-theme="light"] .badge-red    { background: rgba(220,38,38,.12);  }
[data-theme="light"] .badge-purple { background: rgba(109,40,217,.12); }
[data-theme="light"] .badge-orange { background: rgba(234,88,12,.12);  }

/* ══════════════════════════════════════════
   TABLES
══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; padding: 10px 14px; font-size: .7rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text2); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
td strong { color: var(--text); font-weight: 500; }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-sm); border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: .875rem; transition: all .2s; text-decoration: none; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface3); }
.btn-danger  { background: rgba(255,92,92,.15);  color: var(--red);   border: 1px solid rgba(255,92,92,.3); }
.btn-danger:hover  { background: rgba(255,92,92,.25); }
.btn-green   { background: rgba(46,204,138,.15); color: var(--green); border: 1px solid rgba(46,204,138,.3); }
.btn-green:hover   { background: rgba(46,204,138,.25); }
[data-theme="light"] .btn-danger { background: rgba(220,38,38,.10);  border-color: rgba(220,38,38,.25); }
[data-theme="light"] .btn-green  { background: rgba(5,150,105,.10);  border-color: rgba(5,150,105,.25); }
.btn-sm   { padding: 5px 12px; font-size: .8rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ══════════════════════════════════════════
   INPUTS
══════════════════════════════════════════ */
.input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  width: 100%; outline: none;
  transition: border-color .2s, var(--theme-transition);
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.12); }
[data-theme="light"] .input:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.input::placeholder { color: var(--text3); }
select.input { cursor: pointer; }
textarea.input { resize: vertical; min-height: 80px; }
.form-group  { margin-bottom: 16px; }
.form-label  { font-size: .8rem; font-weight: 500; color: var(--text2); margin-bottom: 6px; display: block; }
.form-error  { font-size: .75rem; color: var(--red); margin-top: 4px; }

/* ══════════════════════════════════════════
   PROGRESS
══════════════════════════════════════════ */
.progress-bar  { background: var(--surface3); border-radius: 4px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 1s ease; }

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,.35); }
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 520px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); position: relative; }
[data-theme="light"] .modal { box-shadow: 0 8px 40px rgba(0,0,0,.18); }
.modal-title { font-family: 'Arial', sans-serif; font-weight: 700; font-size: 1.15rem; margin-bottom: 20px; padding-right: 24px; }
.modal-close { position: absolute; top: 20px; right: 20px; background: none; border: none; color: var(--text2); cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--text); }

/* ══════════════════════════════════════════
   ANNOUNCEMENT
══════════════════════════════════════════ */
.announcement { border-left: 3px solid var(--accent); padding: 14px 16px; background: rgba(79,140,255,.06); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 12px; }
.announcement.urgent { border-left-color: var(--red);   background: rgba(255,92,92,.06); }
.announcement.info   { border-left-color: var(--green); background: rgba(46,204,138,.06); }
[data-theme="light"] .announcement        { background: rgba(37,99,235,.05); }
[data-theme="light"] .announcement.urgent { background: rgba(220,38,38,.05); }
[data-theme="light"] .announcement.info   { background: rgba(5,150,105,.05); }
.ann-title { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.ann-date  { font-size: .72rem; color: var(--text3); font-family: 'JetBrains Mono', monospace; }

/* ══════════════════════════════════════════
   TIMELINE
══════════════════════════════════════════ */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 8px; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.timeline-item.done::before    { background: var(--green); }
.timeline-item.pending::before { background: var(--yellow); }
.timeline-meta { font-size: .75rem; color: var(--text3); font-family: 'JetBrains Mono', monospace; }
.timeline-text { font-size: .875rem; color: var(--text2); margin-top: 3px; }

/* ══════════════════════════════════════════
   CHAT THREAD
══════════════════════════════════════════ */
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg-bubble { padding: 12px 16px; border-radius: 12px; font-size: .875rem; line-height: 1.5; max-width: 85%; }
.msg-bubble.morador  { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px 12px 12px 2px; }
.msg-bubble.diretoria{ background: rgba(79,140,255,.12); border: 1px solid rgba(79,140,255,.25); border-radius: 12px 12px 2px 12px; align-self: flex-end; margin-left: auto; }
.msg-bubble.internal { background: rgba(245,200,66,.08); border: 1px solid rgba(245,200,66,.2); }
[data-theme="light"] .msg-bubble.morador   { background: var(--surface2); }
[data-theme="light"] .msg-bubble.diretoria { background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.2); }
[data-theme="light"] .msg-bubble.internal  { background: rgba(217,119,6,.07); border-color: rgba(217,119,6,.2); }
.msg-sender { font-size: .72rem; font-weight: 600; color: var(--text3); margin-bottom: 4px; }
.msg-time   { font-size: .68rem; color: var(--text3); margin-top: 6px; font-family: 'JetBrains Mono', monospace; }

/* ══════════════════════════════════════════
   VOTE
══════════════════════════════════════════ */
.vote-option { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; cursor: pointer; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); transition: all .2s; }
.vote-option:hover    { border-color: var(--accent); background: rgba(79,140,255,.06); }
.vote-option.selected { border-color: var(--accent); background: rgba(79,140,255,.12); }
[data-theme="light"] .vote-option:hover    { background: rgba(37,99,235,.05); }
[data-theme="light"] .vote-option.selected { background: rgba(37,99,235,.09); }
.vote-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; transition: all .2s; }
.vote-option.selected .vote-radio { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.2); }
.vote-count { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: .78rem; color: var(--text3); }

/* ══════════════════════════════════════════
   TABS
══════════════════════════════════════════ */
.tabs { display: flex; gap: 2px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 24px; width: fit-content; flex-wrap: wrap; }
.tab { padding: 7px 20px; border-radius: 7px; border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: .85rem; font-weight: 500; transition: all .2s; background: transparent; color: var(--text2); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ══════════════════════════════════════════
   TOAST
══════════════════════════════════════════ */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 999; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 20px; font-size: .875rem; opacity: 0; transform: translateY(8px); transition: all .3s; pointer-events: none; max-width: 320px; box-shadow: var(--shadow); }
#toast.show    { opacity: 1; transform: translateY(0); }
#toast.success { border-color: var(--green); }
#toast.error   { border-color: var(--red); }
#toast.warn    { border-color: var(--yellow); }

/* ══════════════════════════════════════════
   AUTH SCREEN
══════════════════════════════════════════ */
#authScreen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; transition: var(--theme-transition); position: relative; }
.auth-theme-btn { position: absolute; top: 20px; right: 20px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 40px; width: 420px; max-width: 100%; box-shadow: var(--shadow); }
[data-theme="light"] .auth-card { box-shadow: 0 4px 24px rgba(0,0,0,.10); }
.auth-logo { font-family: 'Arial', sans-serif; font-weight: 800; font-size: 1.8rem; text-align: center; margin-bottom: 8px; }
.auth-logo span { color: var(--accent); }
.auth-subtitle { text-align: center; color: var(--text2); font-size: .9rem; margin-bottom: 32px; }
.auth-tabs { display: flex; gap: 2px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 28px; }
.auth-tab { flex: 1; padding: 8px; border-radius: 7px; border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: .875rem; font-weight: 500; transition: all .2s; background: transparent; color: var(--text2); text-align: center; }
.auth-tab.active { background: var(--accent); color: #fff; }
.status-pending { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: 10px; background: rgba(245,200,66,.08); border: 1px solid rgba(245,200,66,.2); margin-top: 16px; font-size: .875rem; color: var(--yellow); }
[data-theme="light"] .status-pending { background: rgba(217,119,6,.07); border-color: rgba(217,119,6,.25); }

/* ══════════════════════════════════════════
   MISC UTILITIES
══════════════════════════════════════════ */
.flex            { display: flex; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }  .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mb-8   { margin-bottom: 8px; }  .mb-16 { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; }
.mt-8   { margin-top: 8px; }     .mt-16 { margin-top: 16px; }
.text-sm   { font-size: .8rem; }   .text-xs { font-size: .72rem; }
.text-muted  { color: var(--text2); }
.text-green  { color: var(--green); } .text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }.text-accent { color: var(--accent); }
.mono { font-family: 'JetBrains Mono', monospace; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.w-full { width: 100%; }

.loading     { text-align: center; color: var(--text3); padding: 40px; font-size: .9rem; }
.empty-state { text-align: center; color: var(--text3); padding: 60px 20px; }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; font-size: .72rem; font-weight: 500; border: 1px solid var(--border); color: var(--text2); margin: 2px; }

.chamado-item { padding: 12px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; transition: all .2s; }
.chamado-item:hover, .chamado-item.selected { border-color: var(--accent); background: rgba(79,140,255,.06); }
[data-theme="light"] .chamado-item:hover,
[data-theme="light"] .chamado-item.selected { background: rgba(37,99,235,.05); }

.search-wrap { position: relative; }
.search-wrap input { padding-left: 36px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text3); }

.finance-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin: 12px 0; gap: 2px; }
.finance-seg { height: 100%; }

.rbac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.perm-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border); font-size: .82rem; cursor: pointer; transition: all .2s; }
.perm-item:hover { border-color: var(--accent); background: var(--surface2); }
.perm-item.checked { border-color: var(--green); background: rgba(46,204,138,.06); }
[data-theme="light"] .perm-item.checked { background: rgba(5,150,105,.06); }
.perm-checkbox { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--border); flex-shrink: 0; transition: all .2s; display: flex; align-items: center; justify-content: center; font-size: .65rem; }
.perm-item.checked .perm-checkbox { background: var(--green); border-color: var(--green); color: #fff; }
.login-logo-div{text-align: center;}
.login-logo{width:70%;}

/* ══════════════════════════════════════════
   DETAILS / SUMMARY
══════════════════════════════════════════ */
details {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: var(--theme-transition);
}
details[open] { padding-bottom: 14px; }
details > summary {
  list-style: none;
  outline: none;
  user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { display: none; }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .hamburger-btn { display: flex; }
  #sidebar {
    transform: translateX(-100%);
    z-index: 101;
    box-shadow: none;
    transition: transform .28s cubic-bezier(.4,0,.2,1), var(--theme-transition);
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.25);
  }
  .sidebar-mode-switcher { display: flex; }
  .main-content { margin-left: 0; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }

  /* topbar responsivo: direita nunca encolhe, esquerda cede espaço */
  .topbar-right { flex-shrink: 0; gap: 4px; }
  .topbar-left  { flex: 1; min-width: 0; overflow: hidden; gap: 8px; }
  .logo         { min-width: 0; gap: 8px; }
  .logo img     { width: 38px !important; height: 38px !important; flex-shrink: 0; }
  .logo span    { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .mode-switcher { display: none; }
  #topbar { padding: 0 12px; }
  .logo span { font-size: .82rem; }
  /* theme toggle menor no mobile pequeno */
  .theme-btn { width: 44px; height: 24px; }
  .theme-btn-knob { width: 18px; height: 18px; }
  [data-theme="light"] .theme-btn-knob { transform: translateX(20px); }
}

/* ══════════════════════════════════════════════════════
   PAGE HEADER COMPONENT
   Substitui flex justify-between nos cabeçalhos de página
══════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   FILTER ROW COMPONENT
   Linha de filtros que empilha verticalmente no mobile
══════════════════════════════════════════════════════ */
.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-row .form-group { margin: 0; }
.filter-btns {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-bottom: 2px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════
   TABLE → CARDS (adicione class="mobile-cards" na <table>)
   No mobile, cada <tr> vira um card; <td data-label="...">
   exibe o label como prefixo via ::before
══════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Alvos de toque maiores */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; padding: 7px 14px; }
  .btn-icon { width: 40px !important; height: 40px !important; }

  /* Cabeçalho de página empilha */
  .page-header { flex-direction: column; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; justify-content: center; text-align: center; }

  /* Filtros empilham verticalmente */
  .filter-row { flex-direction: column; }
  .filter-row > .form-group {
    width: 100%;
    flex: unset !important;
    min-width: unset !important;
    max-width: unset !important;
  }
  .filter-row > .filter-btns { width: 100%; }
  .filter-row > .filter-btns .btn { flex: 1; justify-content: center; }

  /* Tabela em modo card */
  table.mobile-cards thead { display: none; }
  table.mobile-cards,
  table.mobile-cards tbody { display: block; width: 100%; }
  table.mobile-cards tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--surface);
  }
  table.mobile-cards tr:hover td { background: transparent !important; }
  table.mobile-cards td {
    display: flex;
    padding: 3px 0;
    border: none !important;
    font-size: .875rem;
    color: var(--text);
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
  }
  table.mobile-cards td[data-label]::before {
    content: attr(data-label);
    font-size: .68rem;
    font-weight: 700;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .5px;
    min-width: 72px;
    flex-shrink: 0;
    padding-top: 3px;
  }
  table.mobile-cards td[data-hide="mobile"] { display: none !important; }
  table.mobile-cards td[data-label="Ações"] {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border) !important;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }
  table.mobile-cards td[data-label="Ações"]::before { display: none; }

  /* Modal ocupa mais largura no mobile */
  .modal { border-radius: 12px; padding: 20px 16px; }

  /* Conteúdo principal com padding menor */
  .main-content { padding: 14px; }
}

@media (max-width: 400px) {
  .main-content { padding: 10px; }
  .card { padding: 12px; }
}
