:root {
  --sidebar-width: 240px;
  --green: #1e7e34;
  --green-light: #28a745;
  --green-bg: #f0faf3;
  --sidebar-bg: #1a2e1a;
  --sidebar-text: #c8e6c9;
  --sidebar-active: #28a745;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', sans-serif; background: #f4f6f9; }

/* ── LAYOUT ── */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid #2d4a2d;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo i { font-size: 28px; color: var(--green-light); }
.brand { font-size: 17px; font-weight: 700; color: #fff; line-height: 1; }
.brand-sub { font-size: 11px; color: #81c784; letter-spacing: 2px; text-transform: uppercase; }

.sidebar-menu { list-style: none; margin: 12px 0; padding: 0; flex: 1; }
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14.5px;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar-menu li a:hover { background: #243824; color: #fff; }
.sidebar-menu li.active a {
  background: #243824;
  color: #fff;
  border-left-color: var(--green-light);
  font-weight: 600;
}
.sidebar-menu li a i { font-size: 17px; min-width: 20px; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid #2d4a2d;
  font-size: 12px;
  color: #4a7a4a;
  text-align: center;
}

/* ── CONTENT ── */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin .25s ease;
}
.content.expanded { margin-left: 0; }

/* ── TOPBAR ── */
.topbar {
  background: #fff;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid #e5e9ef;
  position: sticky; top: 0; z-index: 99;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar .btn-link { color: #555; padding: 0; }
.topbar .btn-link:hover { color: var(--green); }

/* ── MAIN ── */
.main-content { padding: 28px 28px 40px; }

/* ── STAT CARDS ── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  display: flex;
  align-items: center;
  gap: 18px;
  border-left: 4px solid transparent;
}
.stat-card.green  { border-left-color: #28a745; }
.stat-card.blue   { border-left-color: #0d6efd; }
.stat-card.orange { border-left-color: #fd7e14; }
.stat-card.red    { border-left-color: #dc3545; }

.stat-icon {
  width: 54px; height: 54px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-icon.green  { background: #d4edda; color: #28a745; }
.stat-icon.blue   { background: #cfe2ff; color: #0d6efd; }
.stat-icon.orange { background: #ffe5cc; color: #fd7e14; }
.stat-icon.red    { background: #f8d7da; color: #dc3545; }

.stat-value { font-size: 26px; font-weight: 700; color: #212529; line-height: 1; }
.stat-label { font-size: 13px; color: #6c757d; margin-top: 3px; }

/* ── CARDS ── */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 600;
  font-size: 15px;
  padding: 16px 20px;
  border-radius: 12px 12px 0 0 !important;
}

/* ── TABLES ── */
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #6c757d; font-weight: 600; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fff9; }

/* ── BADGES ── */
.badge-status { font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 500; }
.badge-pago       { background: #d4edda; color: #155724; }
.badge-pendente   { background: #fff3cd; color: #856404; }
.badge-cancelado  { background: #f8d7da; color: #721c24; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 700; color: #212529; margin: 0; }
.page-title small { font-size: 13px; color: #6c757d; font-weight: 400; margin-left: 8px; }

/* ── FORM ── */
.form-label { font-weight: 500; font-size: 14px; color: #444; }
.form-control:focus, .form-select:focus {
  border-color: var(--green-light);
  box-shadow: 0 0 0 .2rem rgba(40,167,69,.15);
}
.form-control, .form-select { border-radius: 8px; }

/* ── BUTTONS ── */
.btn-green {
  background: var(--green-light);
  border-color: var(--green-light);
  color: #fff;
}
.btn-green:hover { background: var(--green); border-color: var(--green); color: #fff; }

/* ── SALE ITEMS TABLE ── */
#items-table { background: #f8f9fa; border-radius: 8px; }
#items-table tr:last-child td { border-bottom: none; }
.item-row td { padding: 10px 8px; }

/* ── ALERT ── */
.alert { border-radius: 10px; font-size: 14px; }
.alert-success { background: #d1fae5; border: none; color: #065f46; }
.alert-danger  { background: #fee2e2; border: none; color: #7f1d1d; }
.alert-warning { background: #fef3c7; border: none; color: #78350f; }

/* ── DETAIL SECTION ── */
.detail-label { font-size: 12px; text-transform: uppercase; color: #888; letter-spacing: .5px; }
.detail-value { font-size: 15px; color: #212529; font-weight: 500; }

/* ── SEARCH BAR ── */
.search-bar { position: relative; }
.search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #aaa; }
.search-bar input { padding-left: 36px; border-radius: 8px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; color: #aaa; }
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 15px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .main-content { padding: 16px; }
  .stat-value { font-size: 20px; }
}
