/* ================= BASE & THEME ================= */
:root {
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #0f172a;
  --ink-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 10px 20px rgba(0, 0, 0, .06);
  --brand: #0b1535;
  --brand-2: #12214d;
  --accent: #2563eb;
  --pill-pending: #b45309;
  --pill-paid: #047857;
  --pill-ship: #3730a3;
  --pill-done: #0369a1;
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #f5f7fb, #eef2f7);
  color: var(--ink);
}

/* ================= LAYOUT ================= */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  background: linear-gradient(180deg, var(--brand), #0a1330 60%);
  color: #e5e7eb;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .04);
}

.main {
  flex: 1;
  padding: 28px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-top: 14px;
}

.block-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.block-head h2 {
  margin: 0
}

.block-head-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between
}

h1 {
  margin: 0 0 6px
}

.subtitle {
  color: var(--ink-muted);
  margin: 0 0 10px
}

/* ================= BRAND ================= */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-weight: 800;
  font-size: 18px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 120% at 0% 0%, #6366f1 0%, #8b5cf6 100%);
  box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
}

/* ================= SIDEBAR v2 ================= */
.nav-actions {
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
}

.nav-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  color: #cbd5e1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.nav-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.menu {
  display: grid;
  gap: 6px;
}

.menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #cbd5e1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  position: relative;
  transition: transform .15s ease, background .15s ease, color .2s;
}

.menu a:hover {
  background: rgba(255, 255, 255, .06);
  transform: translateX(2px);
  color: #e6eef7;
}

.menu a.active {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), 0 4px 10px rgba(0, 0, 0, .12);
}

.menu a.active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  border-radius: 6px;
  background: linear-gradient(180deg, #60a5fa, #818cf8);
}

.nav-ico {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: #a7b5c8;
  flex: 0 0 20px;
}

.nav-ico svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu a:hover .nav-ico {
  color: #dbe7f9;
}

.menu a.active .nav-ico {
  color: #fff;
}

.nav-label {
  white-space: nowrap;
}

.nav-badge {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  color: #0b1535;
  background: #f3f4f6;
}

/* recolher */
body.sb-collapsed .sidebar {
  width: 88px;
}

body.sb-collapsed .brand span {
  display: none;
}

body.sb-collapsed .menu a {
  justify-content: center;
}

body.sb-collapsed .menu a .nav-label,
body.sb-collapsed .menu a .nav-badge {
  display: none;
}

/* ================= GRID / FORMS ================= */
.row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.col-12 {
  grid-column: span 12
}

.col-9 {
  grid-column: span 9
}

.col-8 {
  grid-column: span 8
}

.col-6 {
  grid-column: span 6
}

.col-4 {
  grid-column: span 4
}

.col-3 {
  grid-column: span 3
}

.col-2 {
  grid-column: span 2
}

@media(max-width:980px) {

  .col-9,
  .col-8,
  .col-6,
  .col-4,
  .col-3,
  .col-2 {
    grid-column: span 12
  }
}

label {
  display: block;
  margin: 8px 0 6px;
  color: #6b7280;
  font-weight: 600
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 12px;
  outline: none;
  width: 100%;
}

::placeholder {
  color: #94a3b8
}

/* ================= TOOLBAR & BUTTONS ================= */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 10px
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap
}

.input-lite {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  width: min(480px, 100%);
}

.btn {
  background: #eef2f7;
  color: #0f172a;
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer
}

.btn:hover {
  filter: brightness(.97)
}

.btn-outline {
  background: #fff
}

.btn-outline.active {
  border-color: #2563eb;
  color: #2563eb;
  background: #eef2ff
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb
}

.btn.sm {
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 10px
}

/* ================= TABLES ================= */
.table-wrap {
  padding: 10px 18px 18px
}

.table-clean {
  width: 100%;
  border-collapse: collapse
}

.table-clean thead th {
  color: #94a3b8;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--border);
  padding: 12px 8px;
  text-align: left;
}

.table-clean tbody td {
  padding: 14px 8px;
  border-bottom: 1px solid #f1f4f9;
  color: var(--ink)
}

.table-clean tbody tr:hover td {
  background: #f8fbff
}

.table-clean tbody tr:last-child td {
  border-bottom: 0
}

.right {
  text-align: right
}

/* ================= PILLS ================= */
.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent
}

.pill.pending {
  background: #fff7ed;
  border-color: #fed7aa;
  color: var(--pill-pending)
}

.pill.paid {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: var(--pill-paid)
}

.pill.shipped {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: var(--pill-ship)
}

.pill.done {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: var(--pill-done)
}

/* ================= MODAL ================= */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .5);
  z-index: 1000;
  padding: 16px
}

.modal.show {
  display: flex
}

.modal-card {
  background: #fff;
  color: #0f172a;
  width: min(900px, 100%);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .20)
}

.modal.sheet {
  align-items: flex-end
}

.modal.sheet .modal-card {
  width: 100%;
  max-width: none;
  border-radius: 16px 16px 0 0
}

body.modal-open {
  overflow: hidden
}

.modal input,
.modal select,
.modal textarea {
  background: #fff !important;
  color: #0f172a !important;
  border: 1px solid var(--border) !important
}

.modal-head,
.modal-foot {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eef2f7
}

.modal-foot {
  border-top: 1px solid #eef2f7;
  border-bottom: 0
}

.modal-body {
  padding: 16px
}

.btn-close {
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: #64748b
}

/* ================= KPIS (SVG + sublinhado) ================= */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 12px 0 22px
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  position: relative
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #6b7280;
  font-weight: 600
}

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

.kpi-note {
  color: #16a34a;
  font-size: 13px;
  margin-top: 4px
}

.kpi::after {
  content: "";
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: -1px;
  height: 4px;
  background: var(--kpi-accent, #6366f1);
  border-radius: 0 0 14px 14px
}

.kpi-ico {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--kpi-tint, #eef2ff);
  color: var(--kpi-icon, #3730a3)
}

.kpi-ico svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round
}

.kpi--blue {
  --kpi-accent: #60a5fa;
  --kpi-tint: rgba(96, 165, 250, .25);
  --kpi-icon: #2563eb
}

.kpi--green {
  --kpi-accent: #86efac;
  --kpi-tint: rgba(134, 239, 172, .25);
  --kpi-icon: #16a34a
}

.kpi--amber {
  --kpi-accent: #fde68a;
  --kpi-tint: rgba(253, 230, 138, .35);
  --kpi-icon: #b45309
}

.kpi--violet {
  --kpi-accent: #c4b5fd;
  --kpi-tint: rgba(196, 181, 253, .30);
  --kpi-icon: #7c3aed
}