* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f6fa; color: #2c3e50; min-height: 100vh; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #1e2939; color: #cbd5e1; position: fixed; height: 100vh; overflow-y: auto; }
.sidebar-brand { padding: 20px 16px; font-weight: 700; font-size: 16px; color: #f59e0b; border-bottom: 1px solid #334155; }
.sidebar-section { padding: 14px 16px 4px; font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 1px; }
.sidebar a { display: block; padding: 10px 16px; color: #cbd5e1; text-decoration: none; font-size: 13px; border-left: 3px solid transparent; }
.sidebar a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar a.active { color: #f59e0b; border-left-color: #f59e0b; background: rgba(245,158,11,0.1); }
.main { margin-left: 240px; flex: 1; padding: 32px; max-width: 1200px; }

/* Typography */
h1 { font-size: 24px; margin-bottom: 16px; color: #1e293b; }
h2 { font-size: 18px; margin: 24px 0 12px; color: #334155; }
h3 { font-size: 15px; margin: 12px 0 8px; color: #475569; }

/* Cards */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px; margin: 12px 0; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #e2e8f0; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin: 16px 0; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 18px; text-align: center; }
.stat-label { font-size: 11px; color: #64748b; text-transform: uppercase; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: #1e293b; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
th { background: #f8fafc; color: #64748b; font-size: 11px; text-transform: uppercase; font-weight: 600; }
tr:hover { background: #f8fafc; }
td a { color: #f59e0b; text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: #64748b; margin-bottom: 5px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; background: #fff; border: 1px solid #cbd5e1; color: #1e293b;
  padding: 8px 12px; border-radius: 6px; font-size: 13px; font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.1); }
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }

/* Buttons */
.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; background: #f59e0b; color: #fff; transition: all 0.15s; }
.btn:hover { background: #d97706; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-secondary { background: #64748b; }
.btn-secondary:hover { background: #475569; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; }
.btn-success:hover { background: #15803d; }
.btn-outline { background: transparent; border: 1px solid #cbd5e1; color: #475569; }

/* Status badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-lead { background: #fef3c7; color: #d97706; }
.badge-brief { background: #dbeafe; color: #2563eb; }
.badge-design { background: #e0e7ff; color: #6366f1; }
.badge-design_approved { background: #ccfbf1; color: #0f766e; }
.badge-quoted { background: #fde68a; color: #b45309; }
.badge-closed { background: #d1fae5; color: #059669; }
.badge-rejected { background: #fee2e2; color: #dc2626; }
.badge-active { background: #d1fae5; color: #059669; }
.badge-disconnected { background: #fee2e2; color: #dc2626; }
.badge-connected { background: #d1fae5; color: #059669; }
.badge-qr_ready { background: #fef3c7; color: #d97706; }
.badge-connecting { background: #dbeafe; color: #2563eb; }

/* Concept gallery */
.concept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px,1fr)); gap: 14px; margin: 16px 0; }
.concept-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.concept-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.concept-card .concept-info { padding: 12px; font-size: 12px; }
.concept-card .concept-actions { padding: 8px 12px; border-top: 1px solid #e2e8f0; display: flex; gap: 6px; flex-wrap: wrap; }

/* Alerts */
.alert { padding: 12px; border-radius: 6px; margin: 10px 0; font-size: 13px; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #047857; border: 1px solid #6ee7b7; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warn { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

.empty { color: #94a3b8; font-style: italic; padding: 16px 0; text-align: center; }
.info { color: #64748b; font-size: 13px; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid #e2e8f0; margin-bottom: 20px; gap: 0; }
.tabs a { padding: 10px 16px; color: #64748b; text-decoration: none; border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500; }
.tabs a:hover { color: #1e293b; }
.tabs a.active { color: #f59e0b; border-bottom-color: #f59e0b; }

/* QR display */
.qr-display { text-align: center; margin: 20px 0; }
.qr-display img { max-width: 280px; padding: 8px; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; }

/* Activity log */
.activity { padding: 8px 12px; border-left: 3px solid #cbd5e1; margin: 6px 0; background: #f8fafc; font-size: 12px; }
.activity .actor { font-weight: 600; color: #475569; }
.activity .time { color: #94a3b8; font-size: 11px; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
}

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #f59e0b, #d97706); }
.login-box { background: #fff; border-radius: 12px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.login-box h2 { text-align: center; color: #1e293b; margin-bottom: 24px; }
.btn-full { width: 100%; padding: 12px; font-size: 14px; }
