:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  padding: 30px 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 30px;
}

header h1 {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

main section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

main section h2 {
  font-size: 1.25rem;
  margin-bottom: 20px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

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

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

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

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

.btn-secondary:hover {
  background: #475569;
}

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

.btn-export:hover {
  background: #16a34a;
}

.btn-danger {
  background: var(--danger);
  color: white;
  padding: 6px 12px;
  font-size: 0.875rem;
}

.btn-danger:hover {
  background: #dc2626;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: var(--bg);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
}

.card-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.trip-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

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

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

.trip-item-info {
  flex: 1;
}

.trip-item-destination {
  font-weight: 500;
}

.trip-item-distance {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.trip-item-claim {
  font-weight: 600;
  color: var(--success);
}

.month-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.month-selector select {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
}

.settings-bar {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.setting-item input {
  width: 70px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.main-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 24px;
}

.left-panel, .right-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.calendar-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.calendar-header h3 {
  font-size: 1.1rem;
  color: var(--text);
}

.calendar-nav {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.calendar-nav:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 8px;
}

.calendar-weekdays span {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 8px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
}

.calendar-day:hover {
  background: var(--bg);
}

.calendar-day.other-month {
  color: var(--text-muted);
  opacity: 0.4;
}

.calendar-day.today {
  border-color: var(--primary);
  font-weight: 700;
}

.calendar-day.selected {
  background: var(--primary);
  color: white;
}

.calendar-day.has-trips::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 5px;
  height: 5px;
  background: var(--success);
  border-radius: 50%;
}

.calendar-day.selected.has-trips::after {
  background: white;
}

.day-trips-count {
  font-size: 0.65rem;
  color: var(--success);
}

.calendar-day.selected .day-trips-count {
  color: white;
}

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

.daily-header h2 {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.date-badge {
  background: var(--primary);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

.card.mini {
  padding: 12px;
}

.card.mini .card-value {
  font-size: 1.1rem;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.export-buttons {
  display: flex;
  gap: 12px;
}

.trips-table-container {
  overflow-x: auto;
}

.trips-table {
  width: 100%;
  border-collapse: collapse;
}

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

.trips-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
}

.trips-table tbody tr:hover {
  background: var(--bg);
}

.trips-table .claim-cell {
  color: var(--success);
  font-weight: 600;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-edit {
  background: var(--warning);
  color: white;
  padding: 6px 12px;
  font-size: 0.875rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-edit:hover {
  background: #d97706;
}

footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.warning {
  background: var(--warning);
}

@media (max-width: 800px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  
  .left-panel {
    order: 2;
  }
  
  .right-panel {
    order: 1;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 12px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  main section {
    padding: 16px;
  }

  .summary-cards,
  .report-summary {
    grid-template-columns: 1fr;
  }

  .month-selector {
    flex-direction: column;
  }

  .export-buttons {
    flex-direction: column;
  }

  .trips-table {
    font-size: 0.875rem;
  }

  .trips-table th,
  .trips-table td {
    padding: 8px;
  }
  
  .calendar-day {
    font-size: 0.75rem;
  }
}

.store-manager {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-header h2 {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.store-form {
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.form-row .btn {
  align-self: flex-end;
}

.import-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.import-option {
  display: flex;
  align-items: center;
  gap: 10px;
}

.import-hint {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.store-list {
  max-height: 200px;
  overflow-y: auto;
}

.store-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

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

.store-info {
  flex: 1;
}

.store-code {
  font-weight: 600;
  color: var(--primary);
}

.store-name {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.store-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.btn-delete-store {
  background: var(--danger);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}

.planned-trips {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.planned-trips h3 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.planned-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.planned-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.875rem;
}

.planned-item-info {
  flex: 1;
}

.planned-item-name {
  font-weight: 500;
}

.planned-item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.planned-item input {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.875rem;
  text-align: center;
}

.planned-item input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-add-trip {
  background: var(--success);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-add-trip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
