/* ==========================================================================
   Sistema de Chamados de Manutenção — Design System (sem dependências)
   Tema corporativo escuro/claro. Preserva a identidade: slate + azul/índigo.
   ========================================================================== */

:root {
  --brand-from: #2563eb;
  --brand-to:   #6366f1;

  /* Tema ESCURO (padrão) */
  --bg:         #020617; /* slate-950 */
  --bg-soft:    #0f172a; /* slate-900 */
  --surface:    #0f172a;
  --surface-2:  #1e293b; /* slate-800 */
  --surface-3:  #334155; /* slate-700 */
  --border:     #1e293b;
  --border-2:   #334155;
  --text:       #f1f5f9; /* slate-100 */
  --text-soft:  #94a3b8; /* slate-400 */
  --text-mute:  #64748b; /* slate-500 */
  --input-bg:   #1e293b;
  --input-border:#334155;
  --shadow:     0 10px 30px rgba(0,0,0,.45);
}

[data-theme="light"] {
  --bg:         #f1f5f9;
  --bg-soft:    #ffffff;
  --surface:    #ffffff;
  --surface-2:  #f8fafc;
  --surface-3:  #e2e8f0;
  --border:     #e2e8f0;
  --border-2:   #cbd5e1;
  --text:       #0f172a;
  --text-soft:  #475569;
  --text-mute:  #64748b;
  --input-bg:   #ffffff;
  --input-border:#cbd5e1;
  --shadow:     0 10px 30px rgba(15,23,42,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body { max-width: 100%; overflow-x: hidden; }
img { max-width: 100%; }
/* tamanho padrão de ícones inline; regras específicas (.btn svg etc.) sobrepõem */
svg { width: 1em; height: 1em; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background .2s, color .2s;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* ------- utilitários mínimos ------- */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; }
.grid { display: grid; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; } .text-lg { font-size: 17px; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.muted { color: var(--text-soft); }
.mute2 { color: var(--text-mute); }
.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}
.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* ------- marca ------- */
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 6px 18px rgba(37,99,235,.35);
  flex-shrink: 0;
}
.brand-mark.lg { width: 64px; height: 64px; border-radius: 16px; }
.brand-mark svg { width: 60%; height: 60%; }

/* ------- botões ------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1rem; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 13px; cursor: pointer; transition: all .15s;
  background: var(--surface-2); color: var(--text); border-color: var(--border-2);
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(37,99,235,.3);
}
.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text-soft); }
.btn-danger { background: rgba(239,68,68,.12); color: #fca5a5; border-color: rgba(239,68,68,.3); }
.btn-sm { padding: .4rem .7rem; font-size: 12px; }
.btn-icon { padding: .55rem; border-radius: 10px; }

/* ------- cartões ------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow);
}
.card-pad { padding: 1.25rem; }

/* ------- formulários ------- */
.label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: .35rem; }
.input, .select, .textarea {
  width: 100%; padding: .65rem .8rem; border-radius: 10px;
  background: var(--input-bg); border: 1px solid var(--input-border);
  color: var(--text); font-size: 14px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-from); box-shadow: 0 0 0 3px rgba(37,99,235,.25);
}
.textarea { resize: vertical; min-height: 90px; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-mute); }
.input-icon .input { padding-left: 2.2rem; }
.field { margin-bottom: 1rem; }

/* ------- badges (status e urgência) ------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 999px; font-size: 11px; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }

/* status */
.st-Aberto                 { background: rgba(59,130,246,.15);  color: #93c5fd; border-color: rgba(59,130,246,.3); }
.st-Em-análise             { background: rgba(139,92,246,.15);  color: #c4b5fd; border-color: rgba(139,92,246,.3); }
.st-Aguardando-atendimento { background: rgba(234,179,8,.15);   color: #fde047; border-color: rgba(234,179,8,.3); }
.st-Em-andamento           { background: rgba(6,182,212,.15);   color: #67e8f9; border-color: rgba(6,182,212,.3); }
.st-Aguardando-fornecedor  { background: rgba(249,115,22,.15);  color: #fdba74; border-color: rgba(249,115,22,.3); }
.st-Concluído              { background: rgba(34,197,94,.15);   color: #86efac; border-color: rgba(34,197,94,.3); }
.st-Cancelado              { background: rgba(100,116,139,.18); color: #cbd5e1; border-color: rgba(100,116,139,.35); }

/* urgência */
.ur-Baixa   { background: rgba(100,116,139,.18); color: #cbd5e1; border-color: rgba(100,116,139,.35); }
.ur-Média   { background: rgba(59,130,246,.15);  color: #93c5fd; border-color: rgba(59,130,246,.3); }
.ur-Alta    { background: rgba(249,115,22,.15);  color: #fdba74; border-color: rgba(249,115,22,.3); }
.ur-Crítica { background: rgba(239,68,68,.15);   color: #fca5a5; border-color: rgba(239,68,68,.35); }

.pill { display:inline-flex; align-items:center; padding:.15rem .55rem; border-radius:999px; font-size:11px; font-weight:700;
  background: rgba(37,99,235,.15); color:#93c5fd; border:1px solid rgba(37,99,235,.3); }
.pill-amber { background: rgba(245,158,11,.15); color:#fbbf24; border-color: rgba(245,158,11,.3); }

/* ------- header ------- */
.appheader {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg-soft); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
[data-theme="light"] .appheader { background: #0f172a; }
[data-theme="light"] .appheader .brand-title,
[data-theme="light"] .appheader .brand-sub { color: #e2e8f0; }
.appheader .brand-title { color: var(--text); }
.appheader .row { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.tabs { display: flex; gap: .25rem; background: var(--surface-2); padding: .3rem; border-radius: 12px; }
[data-theme="light"] .tabs { background: rgba(255,255,255,.08); }
.tab {
  display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .85rem; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--text-soft); cursor: pointer; border: none; background: transparent;
}
[data-theme="light"] .tab { color: #cbd5e1; }
.tab svg { width: 16px; height: 16px; }
.tab.active { background: linear-gradient(135deg, var(--brand-from), var(--brand-to)); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.35); }

.usermenu { position: relative; }
.usermenu .avatar {
  width: 34px; height: 34px; border-radius: 9px; font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px rgba(37,99,235,.35);
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: 250px; z-index: 50;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); padding: .5rem;
}
.dropdown .item { display: flex; align-items: center; gap: .5rem; padding: .55rem .6rem; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--text); }
.dropdown .item:hover { background: var(--surface-3); }
.dropdown .item.danger { color: #fca5a5; }
.dropdown .head { padding: .5rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .35rem; }

/* ------- grid de métricas ------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.metric { padding: 1.1rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.metric .v { font-size: 28px; font-weight: 800; }
.metric .l { font-size: 12px; color: var(--text-soft); margin-top: .2rem; }
.metric .ico { width: 40px; height: 40px; border-radius: 10px; display:flex; align-items:center; justify-content:center; }
.metric .ico svg { width: 20px; height: 20px; }

/* ------- tabelas ------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; padding: .7rem .85rem; background: var(--surface-2); color: var(--text-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; border-bottom: 1px solid var(--border); }
table.tbl td { padding: .7rem .85rem; border-bottom: 1px solid var(--border); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: var(--surface-2); }
.row-actions { display: flex; gap: .4rem; }

/* ------- modal ------- */
.overlay { position: fixed; inset: 0; background: rgba(2,6,23,.7); backdrop-filter: blur(3px); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 2.5rem 1rem; overflow-y: auto; }
.modal { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: var(--shadow); }
.modal.lg { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--border); }
.modal-body { padding: 1.3rem; }
.modal-foot { padding: 1rem 1.3rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; }
.x-btn { border: none; background: transparent; color: var(--text-mute); cursor: pointer; padding: .35rem; border-radius: 8px; }
.x-btn:hover { background: var(--surface-2); color: var(--text); }

/* ------- alertas ------- */
.alert { display: flex; gap: .5rem; padding: .7rem .85rem; border-radius: 10px; font-size: 13px; }
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.alert-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.alert-warn { background: rgba(234,179,8,.1); border: 1px solid rgba(234,179,8,.3); color: #fde047; }
.alert-info { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }

/* ------- admin layout ------- */
.admin-wrap { display: grid; grid-template-columns: 230px 1fr; gap: 1.25rem; align-items: start; }
.sidebar { position: sticky; top: 92px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: .6rem; }
.sidebar .navbtn { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .7rem; border-radius: 10px; border: none; background: transparent; color: var(--text-soft); font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.sidebar .navbtn svg { width: 17px; height: 17px; }
.sidebar .navbtn:hover { background: var(--surface-2); color: var(--text); }
.sidebar .navbtn.active { background: linear-gradient(135deg, var(--brand-from), var(--brand-to)); color: #fff; }

/* ------- chamado card ------- */
.ticket-card { padding: 1rem 1.1rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color .15s, transform .1s; }
.ticket-card:hover { border-color: var(--brand-from); transform: translateY(-1px); }
.ticket-card.hl { border-color: var(--brand-from); box-shadow: 0 0 0 3px rgba(37,99,235,.25); }
.proto { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; font-size: 13px; }

/* ------- barra de progresso simples (charts) ------- */
.bar-row { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: .6rem; margin-bottom: .5rem; font-size: 12px; }
.bar-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-from), var(--brand-to)); }

/* ------- login ------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--bg); }
.login-box { width: 100%; max-width: 420px; }

/* ------- import preview ------- */
.import-summary { display: grid; grid-template-columns: repeat(4,1fr); gap: .6rem; margin: 1rem 0; }
.import-summary .b { padding: .7rem; border-radius: 10px; text-align: center; border: 1px solid var(--border); background: var(--surface-2); }
.import-summary .b .n { font-size: 20px; font-weight: 800; }
.import-summary .b .t { font-size: 11px; color: var(--text-soft); }

/* spinner */
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }

/* toast */
#toast-wrap { position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; }
.toast { padding: .7rem 1rem; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); min-width: 240px; }
.toast.ok { border-color: rgba(34,197,94,.4); }
.toast.err { border-color: rgba(239,68,68,.4); }

@media (max-width: 860px) {
  .admin-wrap { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; flex-wrap: wrap; }
  .sidebar .navbtn { width: auto; }
  .tabs .tab span { display: none; }
}

/* ==========================================================================
   ATUALIZAÇÕES v2 — logo, cabeçalho, urgência em botões, card novo, mobile
   ========================================================================== */

/* ------- logo ------- */
.brand-logo { height: 34px; width: auto; max-width: 200px; display: block; }
.login-logo { height: 60px; width: auto; max-width: 260px; display: block; }
[data-theme="light"] .login-logo { filter: none; }

/* ------- cabeçalho alinhado ------- */
.appheader .row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: auto; min-height: 68px; padding: .55rem 0; }
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.header-actions { display: flex; align-items: center; gap: .6rem; }
.user-btn { padding: .3rem .55rem .3rem .35rem; gap: .5rem; }
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-name { font-size: 12px; font-weight: 700; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-sub { font-size: 10px; color: var(--text-soft); }
.user-sub.is-admin { color: #fbbf24; font-weight: 700; }
[data-theme="light"] .appheader { background: #0f172a; }
[data-theme="light"] .appheader .user-name { color: #f1f5f9; }

/* ------- títulos de página ------- */
.page-title { font-size: 20px; margin-bottom: .4rem; }
.form-narrow { max-width: 720px; margin: 0 auto; }

/* ------- status novo: Pendente ------- */
.st-Pendente { background: rgba(59,130,246,.15); color: #93c5fd; border-color: rgba(59,130,246,.3); }

/* ------- urgência em botões (criar chamado) ------- */
.urg-group { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.urg-btn {
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  padding: .7rem .35rem; border-radius: 12px; border: 1.5px solid var(--border-2);
  background: var(--surface-2); color: var(--text); cursor: pointer; transition: transform .1s, background .12s, border-color .12s;
}
.urg-btn:hover { transform: translateY(-1px); }
.urg-btn .urg-name { font-weight: 700; font-size: 13px; }
.urg-btn .urg-prazo { font-size: 10.5px; color: var(--text-soft); }
.urg-baixa   { border-color: rgba(22,163,74,.45); }
.urg-media   { border-color: rgba(37,99,235,.45); }
.urg-alta    { border-color: rgba(234,88,12,.45); }
.urg-critica { border-color: rgba(220,38,38,.45); }
.urg-btn.active { color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.urg-btn.active .urg-prazo { color: rgba(255,255,255,.85); }
.urg-baixa.active   { background: #16a34a; }
.urg-media.active   { background: #2563eb; }
.urg-alta.active    { background: #ea580c; }
.urg-critica.active { background: #dc2626; }

/* ------- card de chamado (novo, compacto) ------- */
.ticket-card { display: flex; gap: .9rem; align-items: stretch; padding: .85rem; }
.tk-thumb { width: 68px; height: 68px; border-radius: 10px; background-size: cover; background-position: center; background-color: var(--surface-2); flex-shrink: 0; }
.tk-thumb-ico { display: flex; align-items: center; justify-content: center; color: var(--text-mute); }
.tk-thumb-ico svg { width: 28px; height: 28px; }
.tk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.tk-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tk-desc { font-size: 13px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tk-meta { display: flex; gap: .75rem; flex-wrap: wrap; font-size: 11.5px; color: var(--text-soft); margin-top: auto; }
.tk-meta-item { display: inline-flex; align-items: center; gap: .3rem; }
.tk-meta-item svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ==========================================================================
   RESPONSIVO — mobile 100%
   ========================================================================== */
@media (max-width: 860px) {
  .container { padding: 0 .8rem; }
  .admin-wrap { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; flex-wrap: wrap; gap: .3rem; }
  .sidebar .navbtn { width: auto; }
  .tabs .tab span { display: none; }
  .tabs .tab { padding: .5rem .6rem; }
}

@media (max-width: 640px) {
  /* (regras de cabeçalho movidas para o bloco v4 no fim do arquivo) */
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric .v { font-size: 22px; }
  .form-narrow, .form-narrow > * { max-width: 100%; }
  .grid { grid-template-columns: 1fr !important; }   /* formulários em 1 coluna */
  .urg-group { grid-template-columns: repeat(2, 1fr); }
  .overlay { padding: 1rem .6rem; }
  .modal, .modal.lg { max-width: 100%; }
  .modal-body { padding: 1rem; }
  .import-summary { grid-template-columns: repeat(2, 1fr); }
  .tk-thumb { width: 54px; height: 54px; }
  .tk-meta { gap: .5rem .7rem; }
  .page-title { font-size: 18px; }
  table.tbl th, table.tbl td { padding: .55rem .6rem; }
  .btn { padding: .55rem .8rem; }
  .metric .ico { display: none; }
}

@media (max-width: 380px) {
  .metrics { grid-template-columns: 1fr; }
  .urg-group { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   v3 — Paletas de cor, cabeçalho mobile centralizado, menu menor, olho
   ========================================================================== */

/* ------- Paletas (trocam a cor de destaque; claro/escuro continua no data-theme) ------- */
[data-palette="indigo"] { --brand-from: #2563eb; --brand-to: #6366f1; }
[data-palette="green"]  { --brand-from: #65a30d; --brand-to: #a3e635; }
[data-palette="sky"]    { --brand-from: #0284c7; --brand-to: #38bdf8; }
/* compatibilidade com nomes antigos */
[data-palette="blue"]   { --brand-from: #1d4ed8; --brand-to: #3b82f6; }
[data-palette="slate"]  { --brand-from: #0369a1; --brand-to: #0ea5e9; }

/* garante que elementos de destaque sigam a paleta */
.btn-primary { background: linear-gradient(135deg, var(--brand-from), var(--brand-to)); border: none; }
.tab.active { color: #fff; background: linear-gradient(135deg, var(--brand-from), var(--brand-to)); }
.avatar { background: linear-gradient(135deg, var(--brand-from), var(--brand-to)); }
.pill { background: color-mix(in srgb, var(--brand-to) 20%, transparent); color: var(--brand-to); border: 1px solid color-mix(in srgb, var(--brand-to) 35%, transparent); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-to); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-to) 22%, transparent); outline: none; }
.proto { color: var(--brand-to); }
.navbtn.active { color: #fff; background: linear-gradient(135deg, var(--brand-from), var(--brand-to)); }

/* ------- botão "olho" no campo de senha ------- */
.input-icon { position: relative; }
.input-icon.has-eye .input { padding-right: 2.6rem; }
.eye-btn { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: var(--text-soft); cursor: pointer; padding: .25rem; display: flex; align-items: center; }
.eye-btn:hover { color: var(--text); }
.eye-btn svg { width: 18px; height: 18px; }

/* ------- dica sob campos ------- */
.hint { display: block; font-size: 11px; color: var(--text-mute); margin-top: .3rem; line-height: 1.4; }

/* ------- popover de paletas + menu menor ------- */
.appearance { position: relative; display: flex; align-items: center; gap: .3rem; }

/* menu do usuário: mais compacto */
.dropdown { min-width: 200px; padding: .35rem; border-radius: 12px; }
.dropdown .head { padding: .5rem .6rem; margin-bottom: .2rem; }
.dropdown .item { display: flex; align-items: center; gap: .55rem; width: 100%; padding: .55rem .6rem; font-size: 13px; border-radius: 8px; background: transparent; border: 0; color: var(--text); cursor: pointer; text-align: left; }
.dropdown .item svg { width: 16px; height: 16px; }
.dropdown .item:hover { background: var(--surface-2); }
.dropdown .item.danger { color: #f87171; }
.dropdown .item.danger:hover { background: rgba(248,113,113,.12); }

/* ==========================================================================
   v4 — Paletas no menu do perfil, texto escuro no verde, cabeçalho mobile
   ========================================================================== */

/* Verde-limão precisa de texto escuro para contraste (igual ao site de referência) */
[data-palette="green"] .btn-primary,
[data-palette="green"] .tab.active,
[data-palette="green"] .navbtn.active,
[data-palette="green"] .avatar { color: #14210a; }
[data-palette="green"] .pill { color: #3f6212; }
[data-theme="dark"][data-palette="green"] .pill { color: #bef264; }

/* Seletor de paletas dentro do dropdown do perfil */
.dd-sep { height: 1px; background: var(--border); margin: .35rem .2rem; }
.dd-section { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-mute); padding: .1rem .6rem .3rem; }
.pal-row { display: flex; gap: .35rem; padding: 0 .4rem .2rem; }
.pal-swatch {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: .45rem .2rem; border-radius: 10px; border: 1.5px solid var(--border-2);
  background: transparent; color: var(--text-soft); cursor: pointer; font-size: 10.5px; font-weight: 600;
}
.pal-swatch span { width: 100%; height: 16px; border-radius: 6px; display: block; }
.pal-swatch:hover { border-color: var(--text-mute); }
.pal-swatch.active { border-color: var(--brand-to); color: var(--text); background: color-mix(in srgb, var(--brand-to) 12%, transparent); }

/* ==========================================================================
   v6 — CABEÇALHO (desktop + mobile): 3 zonas
        ESQUERDA: abas (Criar/Consultar/Admin) + luz
        CENTRO:   logo + "Sistema de Chamados"
        DIREITA:  perfil
   ========================================================================== */

/* header sempre escuro (identidade), controles legíveis em ambos os temas */
.appheader { position: sticky; top: 0; z-index: 40; background: #0f172a; border-bottom: 1px solid rgba(255,255,255,.08); }
.appheader .hrow { display: flex; align-items: center; gap: 1rem; min-height: 64px; padding: .5rem 0; }
.hleft   { display: flex; align-items: center; gap: .6rem; flex: 1 1 0; min-width: 0; justify-content: flex-start; }
.hleft .brand-logo { height: 30px; width: auto; display: block; flex-shrink: 0; }
.hcenter { display: flex; align-items: center; gap: .55rem; flex: 0 0 auto; justify-content: center; }
.hright  { display: flex; align-items: center; gap: .5rem; flex: 1 1 0; min-width: 0; justify-content: flex-end; }

.hcenter .brand-logo { height: 30px; width: auto; display: block; }
.htitle { font-weight: 800; font-size: 16px; letter-spacing: .2px; color: #f1f5f9; white-space: nowrap; }

/* tabs e controles no header escuro */
.appheader .tabs { background: rgba(255,255,255,.07); padding: .28rem; border-radius: 12px; gap: .2rem; }
.appheader .tab { color: #cbd5e1; }
.appheader .tab:hover { color: #fff; }
.appheader .tab.active { color: #fff; }
[data-palette="green"] .appheader .tab.active { color: #14210a; }
.appheader .btn-icon { color: #cbd5e1; background: rgba(255,255,255,.06); border-color: transparent; }
.appheader .btn-icon:hover { color: #fff; background: rgba(255,255,255,.12); }
.appheader .user-name { color: #f1f5f9; }
.appheader .user-sub { color: #94a3b8; }
.appheader .user-btn { background: rgba(255,255,255,.06); border-color: transparent; }
.appheader .user-btn:hover { background: rgba(255,255,255,.12); }

/* menu do perfil: compacto e à prova de corte no mobile */
.usermenu .dropdown { width: 232px; max-width: calc(100vw - 16px); right: 0; left: auto; padding: .3rem; }
.usermenu .dropdown .head { padding: .45rem .55rem; }
.usermenu .dropdown .item { padding: .5rem .55rem; font-size: 12.5px; }
.pal-row { gap: .3rem; padding: 0 .35rem .2rem; }
.pal-swatch { padding: .4rem .15rem; font-size: 10px; }
.pal-swatch span { height: 14px; }
.dd-section { padding: .1rem .55rem .25rem; }

/* ------- MOBILE ------- */
@media (max-width: 700px) {
  .appheader .hrow { gap: .4rem; min-height: 56px; }
  .hleft { gap: .3rem; }
  .hleft .brand-logo { display: none; }      /* no celular a logo não aparece */
  .appheader .tabs { padding: .22rem; }
  .tabs .tab span { display: none; }        /* só ícones à esquerda = limpo */
  .tabs .tab { padding: .5rem; }
  .hcenter .brand-logo { height: 24px; }
  .htitle { font-size: 13px; }
  .user-meta { display: none; }             /* direita: só o avatar */
  .user-btn { padding: .3rem; }
}
@media (max-width: 430px) {
  .htitle { font-size: 13px; }               /* título continua no centro no celular */
  .appheader .hrow { gap: .3rem; }
}
@media (max-width: 340px) {
  .container { padding: 0 .5rem; }
  .htitle { font-size: 12px; }
  .tabs .tab { padding: .45rem; }
}

/* ==========================================================================
   v7 — Dashboard redesenhado
   ========================================================================== */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.dash-title { font-size: 20px; font-weight: 800; }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.kpi { display: flex; align-items: center; gap: .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.kpi-ico { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-ico svg { width: 22px; height: 22px; }
.kpi-v { font-size: 26px; font-weight: 800; line-height: 1.1; }
.kpi-l { font-size: 12.5px; color: var(--text-soft); margin-top: .1rem; }
.kpi-sub { font-size: 10.5px; color: var(--text-mute); margin-top: .2rem; }

/* linhas do dashboard */
.dash-row { display: flex; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.dash-row > .card { min-width: 260px; }

/* donut */
.dash-donut { width: 260px; display: flex; flex-direction: column; align-items: center; }
.donut { width: 170px; height: 170px; margin: .3rem 0; }
.donut-num { font-size: 26px; font-weight: 800; fill: var(--text); }
.donut-cap { font-size: 10px; fill: var(--text-mute); text-transform: uppercase; letter-spacing: .05em; }
.donut-legend { display: flex; gap: 1.2rem; font-size: 12px; color: var(--text-soft); margin-top: .4rem; }
.donut-legend b { color: var(--text); }

/* barras coloridas */
.bar-row2 { display: grid; grid-template-columns: 120px 1fr 32px; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.bar-label { font-size: 12px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track2 { height: 10px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.bar-fill2 { height: 100%; border-radius: 6px; transition: width .5s ease; }
.bar-val { font-size: 13px; font-weight: 700; text-align: right; }

/* gráfico 7 dias */
.chart7 { position: relative; height: 190px; margin-top: .5rem; }
.chart7-grid { position: absolute; inset: 0 0 22px 0; }
.grid-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--border); }
.grid-line span { position: absolute; left: 0; top: -8px; font-size: 9px; color: var(--text-mute); background: var(--surface); padding-right: 4px; }
.chart7-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: .4rem; padding-left: 20px; }
.chart7-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.chart7-pair { display: flex; gap: 4px; align-items: flex-end; height: calc(100% - 22px); width: 100%; justify-content: center; }
.chart7-bar { width: 14px; border-radius: 5px 5px 0 0; position: relative; min-height: 2px; transition: height .5s ease; }
.chart7-bar span { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 700; color: var(--text-soft); }
.chart7-x { font-size: 10px; color: var(--text-mute); margin-top: .3rem; height: 18px; }
.chart7-legend { display: flex; gap: 1.2rem; margin-top: .6rem; font-size: 12px; color: var(--text-soft); }
.chart7-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }

@media (max-width: 640px) {
  .dash-donut { width: 100%; }
  .bar-row2 { grid-template-columns: 84px 1fr 26px; gap: .4rem; }
  .chart7-bar { width: 10px; }
  .kpi-v { font-size: 22px; }
}

/* ==========================================================================
   v8 — Seletor de período + toolbar do dashboard
   ========================================================================== */
.dash-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.period-bar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.period-custom { display: inline-flex; align-items: center; gap: .35rem; }
.period-custom.hidden { display: none; }
.select-sm, .input-sm { padding: .4rem .6rem; font-size: 13px; border-radius: 9px; }
.input-sm[type="date"] { min-width: 0; }

@media (max-width: 640px) {
  .dash-tools { width: 100%; }
  .period-bar { width: 100%; }
  .period-bar .select-sm { flex: 1; }
  .period-custom { width: 100%; }
  .period-custom .input-sm { flex: 1; }
}

/* ==========================================================================
   v9 — Lista de lojas (checkboxes) no cadastro de usuário
   ========================================================================== */
.chk-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .35rem .8rem;
  max-height: 180px; overflow-y: auto; padding: .6rem .7rem;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 10px;
}
.chk { display: flex; align-items: center; gap: .5rem; font-size: 13px; color: var(--text-soft); cursor: pointer; }
.chk input { width: 15px; height: 15px; accent-color: var(--brand-to); flex-shrink: 0; cursor: pointer; }

/* ==========================================================================
   v12 — Anexo de fotos (câmera / galeria) com prévia
   ========================================================================== */
.photo-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.photo-btn { flex: 1; min-width: 130px; justify-content: center; padding: .8rem 1rem; font-weight: 600;
  border: 1.5px dashed var(--border-2); background: var(--surface-2); }
.photo-btn:hover { border-color: var(--brand-to); color: var(--text); }
.photo-btn svg { width: 18px; height: 18px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .6rem; margin-top: .7rem; }
.photo-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-2); background: var(--surface-2); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: rgba(15,23,42,.75); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.photo-x svg { width: 13px; height: 13px; }
.photo-x:hover { background: #dc2626; }

@media (max-width: 640px) {
  .photo-btn { min-width: 0; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}
