/* ── Reset & base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --cor: #6366f1;
  --bg: #0a0a0f;
  --bg2: #0f0f1a;
  --bg3: #16162a;
  --border: rgba(255,255,255,.08);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --sidebar-w: 240px;
  --radius: 12px;
}
html, body { height: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; font-size: .9rem; background: var(--bg); color: var(--text); }
a { color: var(--cor); text-decoration: none; }
a:hover { opacity: .8; }

/* ── Layout ───────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 200;
  transition: transform .25s;
}
.sidebar-header {
  padding: 20px 16px 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-icon { font-size: 1.4rem; }
.sidebar-name { font-weight: 700; font-size: .95rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav { list-style: none; flex: 1; padding: 12px 8px; overflow-y: auto; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--text-muted); transition: background .15s, color .15s; font-size: .875rem;
}
.sidebar-nav li a:hover, .sidebar-nav li a.active {
  background: rgba(255,255,255,.06); color: var(--text);
}
.sidebar-nav li a.active { background: color-mix(in srgb, var(--cor) 18%, transparent); color: var(--cor); font-weight: 600; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-muted); }

/* ── Main ─────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }

/* ── Topbar ───────────────────────────────────────── */
.topbar {
  height: 56px; background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-weight: 700; font-size: 1rem; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: .85rem; color: var(--text-muted); }
.topbar-user a { color: var(--cor); cursor: pointer; }
.menu-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.btn-logout {
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.25);
  color: #f87171; border-radius: 7px; padding: 5px 12px; font-size: .8rem;
  cursor: pointer; transition: background .15s;
}
.btn-logout:hover { background: rgba(239,68,68,.22); }

/* ── Content ──────────────────────────────────────── */
.content { flex: 1; padding: 24px; max-width: 1200px; width: 100%; }

/* ── Card ─────────────────────────────────────────── */
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.card h3 { font-size: .95rem; color: var(--text-muted); margin-bottom: 14px; }

/* ── Stats grid ───────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.stat-icon { font-size: 1.4rem; margin-bottom: 10px; display: block; }
.stat-card .stat-delta { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Table ────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.table th { text-align: left; padding: 8px 12px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); font-size: .8rem; }
.table td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.04); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }

/* ── Badges ───────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .72rem; font-weight: 600; text-transform: capitalize; }
.badge-pendente    { background: rgba(234,179,8,.15);  color: #eab308; }
.badge-confirmado  { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-preparando  { background: rgba(249,115,22,.15); color: #f97316; }
.badge-pronto      { background: rgba(16,185,129,.15); color: #34d399; }
.badge-entregue,
.badge-concluido   { background: rgba(34,197,94,.15);  color: #22c55e; }
.badge-cancelado,
.badge-nao_compareceu { background: rgba(239,68,68,.15); color: #f87171; }
.badge-aprovado    { background: rgba(34,197,94,.15);  color: #22c55e; }
.badge-agendado    { background: rgba(99,102,241,.15); color: #818cf8; }
.badge-ativo       { background: rgba(34,197,94,.15);  color: #22c55e; }
.badge-inativo     { background: rgba(148,163,184,.1); color: #94a3b8; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg3);
  color: var(--text); font-size: .85rem; cursor: pointer; transition: background .15s;
}
.btn:hover { background: rgba(255,255,255,.06); }
.btn-primary { background: var(--cor); border-color: var(--cor); color: #fff; font-weight: 600; }
.btn-primary:hover { opacity: .9; }
.btn-danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.3); color: #f87171; }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-sm  { padding: 6px 12px; font-size: .8rem; }
.btn-xs  { padding: 3px 8px; font-size: .75rem; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Inputs ───────────────────────────────────────── */
.input, .input-sm {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 8px 12px; font-size: .875rem; width: 100%;
  transition: border-color .15s; outline: none;
}
.input:focus, .input-sm:focus { border-color: var(--cor); }
.input-sm { width: auto; padding: 6px 10px; font-size: .8rem; }
select.input, select.input-sm { cursor: pointer; }
textarea.input { resize: vertical; }

/* ── Field ────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .78rem; color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }

/* ── Toolbar ──────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

/* ── Tabs ─────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text-muted); font-size: .85rem; cursor: pointer;
}
.tab.active { background: color-mix(in srgb, var(--cor) 18%, transparent); color: var(--cor); border-color: var(--cor); font-weight: 600; }
.tab-content { animation: fadeIn .15s; }

/* ── Modal ────────────────────────────────────────── */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 500; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.7); }
.modal-box {
  position: relative; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-header button { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }
.modal-body { padding: 20px; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Alerts ───────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: .85rem; margin-bottom: 16px; }
.alert-danger  { background: rgba(239,68,68,.12);  color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.alert-warning { background: rgba(234,179,8,.12);  color: #fbbf24; border: 1px solid rgba(234,179,8,.2); }
.alert-success { background: rgba(34,197,94,.12);  color: #4ade80; border: 1px solid rgba(34,197,94,.2); }

/* ── Login page ───────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 20px;
  padding: 36px 32px; width: 100%; max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-mark { font-size: 2.5rem; }
.login-logo h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); margin: 8px 0 4px; }
.login-logo p { color: var(--text-muted); font-size: .875rem; }
.login-form .field { margin-bottom: 16px; }
.login-footer { text-align: center; margin-top: 20px; font-size: .85rem; color: var(--text-muted); }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .dash-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Upload area ──────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 16px; text-align: center; background: var(--bg3);
  transition: border-color .2s;
}
.upload-area:hover { border-color: var(--cor); }
.upload-placeholder { font-size: .85rem; color: var(--text-muted); margin-bottom: 6px; }
.upload-preview { display: block; margin: 0 auto 8px; border-radius: 8px; object-fit: cover; }
.upload-preview-sq  { width: 80px; height: 80px; }
.upload-preview-wide { width: 100%; max-height: 100px; }

/* ── Dias de funcionamento ────────────────────────── */
.dias-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dia-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 40px; border-radius: 8px; font-size: .82rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg3); color: var(--text-muted);
  cursor: pointer; transition: all .15s; user-select: none;
}
.dia-btn.ativo { background: color-mix(in srgb, var(--cor) 20%, transparent); border-color: var(--cor); color: var(--cor); }
.dia-btn input { display: none; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
