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

.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); width: 380px; max-width: 90vw; }
.login-box h1 { text-align: center; margin-bottom: 8px; font-size: 1.5rem; }
.login-box .subtitle { text-align: center; color: #888; margin-bottom: 24px; font-size: 0.9rem; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #1e293b; color: #fff; padding: 20px 0; flex-shrink: 0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar .user-info { padding: 0 20px 16px; border-bottom: 1px solid #334155; margin-bottom: 8px; }
.sidebar .user-info .name { font-weight: 600; font-size: 0.95rem; }
.sidebar .user-info .email { font-size: 0.75rem; color: #94a3b8; }
.sidebar .user-info .badge { display: inline-block; background: #f59e0b; color: #000; font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; margin-top: 4px; font-weight: 600; }
.sidebar nav { flex: 1; overflow-y: auto; }
.sidebar nav a { display: block; padding: 10px 20px; color: #cbd5e1; text-decoration: none; font-size: 0.9rem; transition: all 0.15s; }
.sidebar nav a:hover { background: #334155; color: #fff; }
.sidebar nav a.active { background: #3b82f6; color: #fff; }
.sidebar .sidebar-bottom { padding: 12px 20px; border-top: 1px solid #334155; }
.sidebar .sidebar-bottom a { color: #94a3b8; text-decoration: none; font-size: 0.85rem; }
.sidebar .sidebar-bottom a:hover { color: #fff; }

.main { margin-left: 240px; flex: 1; padding: 24px; min-height: 100vh; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; margin-bottom: 4px; }
.page-header p { color: #64748b; font-size: 0.85rem; }

.card { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.card h3 { margin-bottom: 12px; font-size: 1.1rem; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { background: #fff; border-radius: 8px; padding: 16px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.metric .value { font-size: 1.8rem; font-weight: 700; }
.metric .label { font-size: 0.8rem; color: #64748b; margin-top: 4px; }
.metric.danger .value { color: #ef4444; }
.metric.warning .value { color: #f59e0b; }
.metric.success .value { color: #22c55e; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 0.85rem; font-weight: 500; color: #374151; }
.form-group input, .form-group select { width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; outline: none; transition: border 0.15s; }
.form-group input:focus, .form-group select:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

.btn { display: inline-block; padding: 8px 16px; border: none; border-radius: 6px; font-size: 0.85rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: #22c55e; color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-secondary:hover { background: #4b5563; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-outline { background: transparent; border: 1px solid #d1d5db; color: #374151; }
.btn-outline:hover { background: #f9fafb; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 0.85rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table th { background: #f8fafc; text-align: left; padding: 10px 12px; font-weight: 600; color: #475569; border-bottom: 2px solid #e2e8f0; }
table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; }
table tr:hover { background: #f8fafc; }

.status-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 500; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #dcfce7; color: #166534; }
.status-completed { background: #dbeafe; color: #1e40af; }
.status-rejected { background: #fef2f2; color: #991b1b; }

.stock-ok { color: #22c55e; }
.stock-warn { color: #f59e0b; }
.stock-danger { color: #ef4444; font-weight: 600; }

.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: end; }
.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }

.order-card { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; background: #fff; }
.order-card .order-info { flex: 1; }
.order-card .order-id { font-weight: 600; color: #3b82f6; }
.order-card .order-meta { font-size: 0.8rem; color: #64748b; }
.order-card .order-actions { display: flex; gap: 6px; }

.signature-canvas { border: 2px solid #d1d5db; border-radius: 8px; cursor: crosshair; touch-action: none; }

.tabs { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 16px; }
.tabs a { padding: 8px 16px; text-decoration: none; color: #64748b; font-size: 0.9rem; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.tabs a:hover { color: #374151; }
.tabs a.active { color: #3b82f6; border-bottom-color: #3b82f6; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.inline-form { display: flex; gap: 8px; align-items: end; }
.inline-form .form-group { flex: 1; }

.section-title { font-size: 1rem; font-weight: 600; margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid #e2e8f0; }

.item-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border: 1px solid #f1f5f9; border-radius: 6px; margin-bottom: 6px; }
.item-row:hover { background: #f8fafc; }
.item-row .item-name { font-weight: 500; }
.item-row .item-actions { display: flex; gap: 4px; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 480px; max-width: 90vw; max-height: 80vh; overflow-y: auto; }
.modal h3 { margin-bottom: 16px; }

.empty-state { text-align: center; padding: 40px; color: #94a3b8; }
.empty-state .icon { font-size: 2rem; margin-bottom: 8px; }

.multiselect { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.multiselect label { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; padding: 4px 8px; border: 1px solid #e2e8f0; border-radius: 4px; cursor: pointer; }
.multiselect label:hover { background: #f8fafc; }
.multiselect input[type="checkbox"] { accent-color: #3b82f6; }

.sig-img { border: 1px solid #e2e8f0; border-radius: 4px; }

.password-section { margin-top: auto; padding: 12px 20px; border-top: 1px solid #334155; }
.password-section summary { color: #94a3b8; font-size: 0.8rem; cursor: pointer; }
.password-section input { width: 100%; padding: 6px 8px; border: 1px solid #475569; border-radius: 4px; background: #334155; color: #fff; font-size: 0.8rem; margin-top: 6px; }
.password-section .btn { margin-top: 6px; width: 100%; font-size: 0.8rem; }

@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; }
  .main { margin-left: 0; }
  .layout { flex-direction: column; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .order-card { flex-direction: column; align-items: stretch; }
}
