:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --danger: #dc2626;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* Pages */
.page {
  min-height: 100vh;
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  background: white;
  padding: 48px 32px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
  max-width: 400px;
}

.login-container h1 {
  margin: 0 0 12px 0;
  font-size: 32px;
  color: var(--text);
}

.login-container p {
  margin: 0 0 32px 0;
  color: var(--muted);
}

/* App Page */
.app-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.header h1 {
  margin: 0;
  font-size: 28px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.controls h2 {
  margin: 0;
  font-size: 20px;
  min-width: 200px;
  text-align: center;
}

.totals {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.total-item {
  flex: 1;
  text-align: center;
}

.total-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.total-value {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
}

/* Calendar */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.day {
  background: var(--card);
  padding: 12px;
  border-radius: 10px;
  min-height: 110px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.day:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  transform: translateY(-2px);
}

.day .date {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 8px;
}

.day .meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
}

.day.has-data {
  background: #f0f9ff;
  border-color: var(--accent);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  min-width: 320px;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-content h3 {
  margin: 0 0 20px 0;
  font-size: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Buttons */
button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
  padding: 12px 32px;
  font-size: 16px;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: #e5e7eb;
  color: var(--text);
}

.btn-secondary:hover {
  background: #d1d5db;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-logout {
  background: #f3f4f6;
  color: var(--text);
  padding: 8px 16px;
}

.btn-logout:hover {
  background: #e5e7eb;
}

.btn-nav {
  background: var(--card);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  font-size: 18px;
}

.btn-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-export {
  background: #10b981;
  color: white;
  margin-left: auto;
}

.btn-export:hover {
  background: #059669;
}

@media (max-width: 700px) {
  .calendar {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .totals {
    flex-direction: column;
    gap: 12px;
  }
  
  .controls h2 {
    font-size: 16px;
    min-width: 150px;
  }
}
