:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #475569;
  --shadow: rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #e2e8f0;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #cbd5e1;
  --shadow: rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* Login Screen */
.login-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}

.login-logo {
  width: 80px; height: 80px; background: var(--accent); border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 40px;
  color: white; font-weight: bold; margin-bottom: 20px;
}

.pin-display {
  display: flex; gap: 12px; margin: 24px 0;
}

.pin-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border);
  transition: all 0.2s;
}

.pin-dot.filled { background: var(--accent); border-color: var(--accent); }

.pin-error { color: var(--danger); margin-top: 8px; font-size: 14px; min-height: 20px; }

.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 280px;
}

.numpad-btn {
  width: 70px; height: 70px; border-radius: 50%; border: none;
  background: var(--bg-secondary); color: var(--text-primary); font-size: 24px;
  cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center;
}

.numpad-btn:hover { background: var(--bg-card); }
.numpad-btn:active { transform: scale(0.95); }

.numpad-btn.wide { grid-column: span 2; width: auto; border-radius: 35px; }

/* Header */
.header {
  background: var(--bg-secondary); padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border);
}

.header h1 { font-size: 18px; font-weight: 600; }

.header-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: none;
  background: transparent; color: var(--text-primary); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}

.icon-btn:hover { background: var(--bg-card); }

/* Navigation */
.nav-bar {
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 8px 0;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
}

.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px 12px; border: none; background: transparent;
  color: var(--text-secondary); cursor: pointer; font-size: 12px;
}

.nav-item.active { color: var(--accent); }

.nav-icon { font-size: 20px; }

/* Content */
.content {
  flex: 1; padding: 16px; padding-bottom: 80px; overflow-y: auto;
}

/* Cards */
.card {
  background: var(--bg-card); border-radius: 12px; padding: 16px;
  margin-bottom: 12px; border: 1px solid var(--border);
}

.card-title { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }

.card-value { font-size: 28px; font-weight: 700; }

/* Dashboard Grid */
.dashboard-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px;
}

/* Forms */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text-primary); font-size: 16px; outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
}

.form-textarea { min-height: 80px; resize: vertical; }

/* Buttons */
.btn {
  padding: 12px 24px; border-radius: 8px; border: none; font-size: 16px;
  font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-card); }

.btn-danger { background: var(--danger); color: white; }

.btn-success { background: var(--success); color: white; }

.btn-block { width: 100%; }

/* Quick Select */
.quick-select {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px;
}

.quick-chip {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-secondary); color: var(--text-primary); font-size: 13px;
  cursor: pointer; transition: all 0.2s;
}

.quick-chip:hover { border-color: var(--accent); }
.quick-chip.active { background: var(--accent); color: white; border-color: var(--accent); }

/* Autocomplete */
.autocomplete-container { position: relative; }

.autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0; max-height: 200px;
  overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; margin-top: 4px; z-index: 50; display: none;
}

.autocomplete-list.show { display: block; }

.autocomplete-item {
  padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border);
}

.autocomplete-item:hover { background: var(--bg-secondary); }

/* Lists */
.list-item {
  background: var(--bg-card); border-radius: 12px; padding: 16px;
  margin-bottom: 10px; border: 1px solid var(--border); cursor: pointer;
  transition: all 0.2s;
}

.list-item:hover { border-color: var(--accent); }

.list-item-header {
  display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px;
}

.list-item-title { font-weight: 600; font-size: 15px; }

.list-item-subtitle { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

.list-item-meta {
  display: flex; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--text-secondary);
}

.badge {
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
}

.badge-normal { background: #dbeafe; color: #1e40af; }
.badge-weekend { background: #fef3c7; color: #92400e; }
.badge-holiday { background: #fce7f3; color: #9d174d; }

/* Search */
.search-bar {
  display: flex; gap: 8px; margin-bottom: 16px;
}

.search-input {
  flex: 1; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text-primary); font-size: 15px; outline: none;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
}

.modal-content {
  background: var(--bg-card); border-radius: 16px; width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto; border: 1px solid var(--border);
}

.modal-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}

.modal-body { padding: 16px; }

.modal-footer {
  padding: 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* Settings */
.settings-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}

.settings-item:last-child { border-bottom: none; }

/* Toggle Switch */
.toggle {
  width: 48px; height: 26px; border-radius: 13px; background: var(--bg-secondary);
  position: relative; cursor: pointer; transition: background 0.3s;
  border: 1px solid var(--border);
}

.toggle.on { background: var(--accent); }

.toggle-knob {
  width: 22px; height: 22px; border-radius: 50%; background: white;
  position: absolute; top: 1px; left: 1px; transition: transform 0.3s;
}

.toggle.on .toggle-knob { transform: translateX(22px); }

/* Reports */
.report-section { margin-bottom: 24px; }

.report-section h3 {
  font-size: 16px; margin-bottom: 12px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
}

.report-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}

.report-table th, .report-table td {
  padding: 10px; text-align: left; border-bottom: 1px solid var(--border);
}

.report-table th { color: var(--text-secondary); font-weight: 500; }

/* Offline Indicator */
.offline-banner {
  background: var(--warning); color: #000; text-align: center;
  padding: 6px; font-size: 13px; font-weight: 500;
}

/* Empty State */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text-secondary);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Time Input styling */
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0);
}

/* Receipt photo preview */
.receipt-preview {
  max-width: 100%; max-height: 200px; border-radius: 8px; margin-top: 8px;
  border: 1px solid var(--border);
}

/* Responsive */
@media (min-width: 768px) {
  .content { max-width: 768px; margin: 0 auto; }
  .dashboard-grid { grid-template-columns: repeat(4, 1fr); }
}
