:root {
  --primary: #6C63FF;
  --primary-dark: #5A52D5;
  --secondary: #FF6B9D;
  --bg: #f5f5f8;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── LOGIN ─── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-container { width: 100%; max-width: 400px; }
.login-card { background: var(--card); border-radius: var(--radius); padding: 32px 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { max-height: 60px; margin-bottom: 12px; }
.login-logo h1 { font-size: 28px; font-weight: 700; }
.login-logo h1 span { color: var(--primary); }
.login-sub { color: var(--text-light); font-size: 14px; margin-top: 4px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.login-form input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; transition: border-color .2s; }
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,0.1); }
.login-footer { text-align: center; margin-top: 20px; }
.login-footer a { color: var(--primary); font-size: 13px; text-decoration: none; }

/* ─── FLASH ─── */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; font-weight: 500; }
.flash.success { background: #d1fae5; color: #065f46; }
.flash.error { background: #fee2e2; color: #991b1b; }

/* ─── FORM ─── */
.form { max-width: 800px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
  transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
@media (max-width: 600px) { .form-row { flex-direction: column; gap: 0; } }

/* ─── NAV ─── */
.top-nav {
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 56px; position: sticky; top: 0; z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 16px; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-brand { font-size: 22px; font-weight: 800; text-decoration: none; color: var(--text); }
.nav-brand span { color: var(--primary); }
.nav-links { display: flex; gap: 4px; }
.nav-link { color: var(--text-light); text-decoration: none; font-size: 13px; font-weight: 500; padding: 6px 10px; border-radius: 6px; transition: all .2s; }
.nav-link:hover, .nav-link.active { color: var(--primary); background: rgba(108,99,255,0.08); }
.nav-user { font-size: 13px; color: var(--text-light); }
.nav-logout { color: var(--danger); font-size: 13px; text-decoration: none; }
@media (max-width: 600px) {
  .nav-links { overflow-x: auto; }
  .nav-user { display: none; }
  .nav-link { font-size: 12px; padding: 6px 8px; }
}

/* ─── MAIN ─── */
.main-content { padding: 16px; max-width: 1200px; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 8px; }
.page-header h1 { font-size: 22px; font-weight: 700; }

/* ─── BUTTONS ─── */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; border: none; cursor: pointer; text-decoration: none; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f3f4f6; color: var(--text); }
.btn-secondary:hover { background: #e5e7eb; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.btn-group { display: flex; gap: 4px; }

/* ─── CARDS ─── */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-header h3 { font-size: 16px; }
.card-filters { margin-bottom: 12px; }
.filter-form select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* ─── STATS ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); }
.stat-number { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ─── TABLE ─── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 10px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); border-bottom: 2px solid var(--border); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table tbody tr:hover { background: #f9fafb; }
.table .empty { text-align: center; color: var(--text-light); padding: 30px; }
.qty-cell { text-align: center; }
.totals-row td { font-weight: 700; background: #f0fdf4; }

/* ─── BADGE ─── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge.pendiente { background: #fef3c7; color: #92400e; }
.badge.en-proceso { background: #dbeafe; color: #1e40af; }
.badge.completado { background: #d1fae5; color: #065f46; }
.badge.enviado { background: #e0e7ff; color: #3730a3; }

/* ─── ORDER DETAIL ─── */
.order-info { background: var(--card); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.info-grid div { font-size: 14px; }
.order-totals-box { background: var(--card); border-radius: var(--radius); padding: 16px 20px; margin-top: 16px; box-shadow: var(--shadow); max-width: 320px; }
.total-line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.total-final { border-top: 2px solid var(--border); padding-top: 8px; margin-top: 4px; font-size: 18px; font-weight: 700; color: var(--primary); }

/* ─── DESIGNS ─── */
.design-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.design-thumb-lg { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
.design-thumb.empty { width: 48px; height: 48px; background: var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.current-photo { margin-bottom: 8px; }
.current-photo p { font-size: 12px; color: var(--text-light); }

/* ─── ORDER FORM ─── */
.design-card { border: 1.5px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fff; transition: all .2s; }
.design-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(108,99,255,0.15); }
.design-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.design-header { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 3px; }
.product-qty { text-align: center; }
.product-qty input { width: 100%; padding: 4px 2px; text-align: center; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.product-qty label { display: block; font-size: 7.5px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-summary { background: #f0fdf4; border-radius: 8px; padding: 12px 16px; margin: 12px 0; }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; }

/* ─── PORTAL ─── */
.portal-nav .nav-badge { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--border); font-weight: 600; }
.portal-user { font-weight: 600; color: var(--text); }

/* ─── HOME ─── */
.home-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; text-align: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; }
.home-hero h1 { font-size: 42px; font-weight: 800; margin-bottom: 4px; }
.home-hero h1 span { color: #ffd700; }
.home-sub { font-size: 16px; opacity: 0.9; margin-bottom: 32px; }
.home-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.home-buttons .btn { font-size: 15px; padding: 12px 24px; min-width: 180px; }
.home-buttons .btn-primary { background: #fff; color: var(--primary); }
.home-buttons .btn-secondary { background: rgba(255,255,255,0.15); color: #fff; }
.home-buttons .btn-secondary:hover { background: rgba(255,255,255,0.25); }
.home-footer { position: fixed; bottom: 16px; font-size: 12px; opacity: 0.7; }

/* ─── HELPERS ─── */
.text-sm { font-size: 12px; color: var(--text-light); }
code { font-family: monospace; font-size: 12px; background: #f3f4f6; padding: 2px 6px; border-radius: 4px; }

/* ─── PRINT ─── */
@media print {
  body { background: #fff; }
  .top-nav, .page-header .header-actions, .btn, .no-print { display: none !important; }
  .main-content { margin: 0; padding: 16px; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .order-totals-box { border: 2px solid #333; }
}