/* public/assets/css/app.css — design system AFK Solution */

:root{
  --bg:#F8FAFC; --surface:#FFFFFF; --sidebar:#0F172A;
  --ink:#0F172A; --ink-2:#475569; --ink-3:#94A3B8; --line:#E2E8F0; --line-2:#F1F5F9;
  --brand:#2563EB; --brand-d:#1D4ED8; --brand-l:#EFF6FF;
  --green:#059669; --green-l:#ECFDF5;
  --amber:#D97706; --amber-l:#FFFBEB;
  --red:#DC2626;   --red-l:#FEF2F2;
  --purple:#7C3AED;--purple-l:#F5F3FF;
  --gray:#64748B;  --gray-l:#F1F5F9;
  --r:8px; --r-lg:12px;
  --sidebar-w:236px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 700; color: var(--ink); }
p { margin: 0 0 8px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.money, .tabular { font-variant-numeric: tabular-nums; }

/* ── Layout shell ─────────────────────────────────────────────── */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .2px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: var(--r);
  color: #CBD5E1;
  font-weight: 500;
  font-size: 13.5px;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; }

.sidebar-nav a:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.sidebar-nav a.active {
  background: rgba(37,99,235,.16);
  color: #fff;
  border-left-color: var(--brand);
}

.sidebar-foot {
  padding: 14px 20px;
  font-size: 11.5px;
  color: var(--ink-3);
  border-top: 1px solid rgba(255,255,255,.08);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 { font-size: 18px; }

.content {
  padding: 24px;
  flex: 1;
}

/* ── Cards ────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  padding: 20px;
}

.card + .card { margin-top: 16px; }

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}

.kpi-label {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.kpi-value { font-size: 26px; font-weight: 800; color: var(--ink); }
.kpi-sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ── Banner de total (gradiente) ─────────────────────────────── */

.banner-total {
  background: linear-gradient(135deg, var(--sidebar), var(--brand-d));
  color: #fff;
  border-radius: var(--r-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
}

.banner-total .label { font-size: 12px; opacity: .8; text-transform: uppercase; letter-spacing: .05em; }
.banner-total .value { font-size: 28px; font-weight: 800; margin-top: 4px; }

/* ── Badges ───────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-blue   { background: var(--brand-l); color: var(--brand-d); }
.badge-amber  { background: var(--amber-l); color: var(--amber); }
.badge-green  { background: var(--green-l); color: var(--green); }
.badge-red    { background: var(--red-l);   color: var(--red); }
.badge-gray   { background: var(--gray-l);  color: var(--gray); }
.badge-purple { background: var(--purple-l);color: var(--purple); }

/* ── Botões ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
}

.btn svg { width: 15px; height: 15px; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); }
.btn-outline { border-color: var(--line); background: var(--surface); color: var(--ink-2); }
.btn-outline:hover { background: var(--line-2); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Formulários ──────────────────────────────────────────────── */

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

input[type=text], input[type=email], input[type=number], input[type=date],
input[type=time], input[type=tel], input[type=password], select, textarea {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-l);
}

.checkbox-row { display: flex; align-items: center; gap: 8px; }

/* ── Tabelas ──────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-3);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 12px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13.5px;
  vertical-align: middle;
}
tr:hover td { background: var(--line-2); }
.table-wrap { overflow-x: auto; }
.text-muted { color: var(--ink-3); }
.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-3); }

/* ── Filtros / tabs de status ─────────────────────────────────── */

.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── Modal ────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(15,23,42,.25);
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 15px; }
.modal-close { cursor: pointer; color: var(--ink-3); background: none; border: none; font-size: 18px; }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Toast / feedback ─────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 20px; right: 20px;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r);
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(15,23,42,.25);
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ── Barra de progresso de pagamento ──────────────────────────── */

.progress {
  height: 8px;
  background: var(--line-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar { height: 100%; background: var(--green); }

/* ── Calendário ───────────────────────────────────────────────── */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-dow {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  text-align: center;
  padding: 6px 0;
}
.calendar-day {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 6px;
  background: var(--surface);
}
.calendar-day.empty { background: transparent; border-color: transparent; }
.calendar-day .day-num { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.calendar-day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.calendar-event {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--brand-l);
  color: var(--brand-d);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* ── Kanban (orçamentos) ──────────────────────────────────────── */

.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 280px;
  background: var(--line-2);
  border-radius: var(--r-lg);
  padding: 12px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  transition: outline .1s;
}
.kanban-col.drag-over { outline: 2px dashed var(--brand); outline-offset: -2px; }
.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
  padding: 0 4px;
}
.kanban-col-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.kanban-col-count {
  margin-left: auto;
  background: rgba(15,23,42,.08);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
}
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; flex: 1; }
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.no-drag { cursor: default; opacity: .92; }
.kanban-card .kc-numero { font-weight: 700; font-size: 12.5px; color: var(--ink); }
.kanban-card .kc-cliente { font-size: 12.5px; margin-top: 3px; color: var(--ink-2); }
.kanban-card .kc-meta { font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.kanban-card .kc-valor { font-weight: 700; font-size: 13px; margin-top: 8px; color: var(--brand-d); }
.kanban-card .kc-actions { margin-top: 8px; display: flex; gap: 6px; }
.kanban-empty { font-size: 12px; color: var(--ink-3); text-align: center; padding: 16px 4px; }

/* ── Produtos (cards) ─────────────────────────────────────────── */

.produto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.produto-card { display: flex; flex-direction: column; gap: 10px; }
.produto-card .produto-preco { font-size: 22px; font-weight: 800; color: var(--brand-d); }

/* ── Utilities ────────────────────────────────────────────────── */

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
