:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  font-size: 14px;
}

/* LOGIN */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}
.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  width: 360px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.login-box h1 { font-size: 22px; margin-bottom: 6px; color: var(--gray-900); }
.login-box p { color: var(--gray-600); margin-bottom: 28px; font-size: 13px; }

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

.sidebar {
  width: 220px;
  background: #1e293b;
  color: white;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 16px 16px 14px;
  border-bottom: 1px solid #334155;
}
.sidebar-logo {
  display: block;
  max-width: 100%;
  max-height: 60px;
  object-fit: contain;
  margin-bottom: 8px;
}
.sidebar-header span { font-size: 13px; color: #94a3b8; }

.nav { padding: 12px 0; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  color: #94a3b8;
  transition: all 0.15s;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: #334155; color: white; }
.nav-item.active { background: #1e40af; color: white; border-left-color: #60a5fa; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #334155;
  font-size: 13px;
  color: #64748b;
}
.sidebar-footer strong { display: block; color: #94a3b8; margin-bottom: 4px; }

.main { flex: 1; overflow-x: hidden; }

.topbar {
  background: white;
  padding: 14px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 18px; font-weight: 600; }

.content { padding: 24px; }

/* CARDS / STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--gray-200);
}
.stat-card .label { font-size: 12px; color: var(--gray-600); margin-bottom: 8px; }
.stat-card .value { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.stat-card .sub { font-size: 12px; color: var(--gray-600); margin-top: 4px; }

/* CARD */
.card {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* BADGES */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-in_production { background: #fef3c7; color: #92400e; }
.badge-ready { background: #d1fae5; color: #065f46; }
.badge-installing { background: #e0e7ff; color: #3730a3; }
.badge-closed { background: #f3f4f6; color: #374151; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* FORMS */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--gray-700); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #dbeafe; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group.full { grid-column: 1 / -1; }

/* BUTTONS */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
.modal-header h2 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* SEARCH / FILTERS */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters input,
.filters select {
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: white;
}
.filters input:focus, .filters select:focus { border-color: var(--primary); }

/* ALERTS */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* PAYMENT METHODS */
.method-cash { color: #059669; font-weight: 500; }
.method-card_terminal { color: #2563eb; font-weight: 500; }
.method-card_transfer { color: #7c3aed; font-weight: 500; }
.method-bank_account { color: #d97706; font-weight: 500; }

/* UTILS */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-600); font-size: 12px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 600; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.gap-10 { display: flex; gap: 10px; flex-wrap: wrap; }

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--gray-600);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; }
  .app { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
