:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --secondary: #059669;
  --secondary-light: #D1FAE5;
  --accent: #D97706;
  --accent-light: #FEF3C7;
  --error: #DC2626;
  --error-light: #FEE2E2;
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --text: #1E293B;
  --text-secondary: #64748B;
  --text-light: #94A3B8;
  --border: #E2E8F0;
  --sidebar-bg: #0F172A;
  --sidebar-text: #CBD5E1;
  --sidebar-active: #2563EB;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);

  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Noto Sans JP', 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), #6366F1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}

.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #F8FAFC;
  letter-spacing: 0.5px;
}

.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--text-light);
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section { margin-bottom: 20px; }

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-light);
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #F8FAFC; }

.nav-item.active {
  background: var(--sidebar-active);
  color: #FFFFFF;
  font-weight: 500;
}

.nav-item .nav-icon { width: 20px; text-align: center; font-size: 16px; }

.nav-badge {
  margin-left: auto;
  background: var(--error);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.user-name { font-size: 13px; color: #F8FAFC; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text-light); }

/* ── Main Content ── */
.main-content {
  margin-left: 260px;
  padding: 0;
  min-height: 100vh;
}

/* ── Top Bar ── */
.topbar {
  background: var(--surface);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.topbar-filter {
  flex-shrink: 0;
}

.topbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

/* ── Page Container ── */
.page { padding: 24px 32px; display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Period Selector ── */
.period-selector {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-md);
}

.period-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: var(--transition);
  font-family: inherit;
}

.period-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

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

.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--secondary-light); color: var(--secondary); }
.stat-icon.amber { background: var(--accent-light); color: var(--accent); }
.stat-icon.red { background: var(--error-light); color: var(--error); }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-change {
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.data-table td.number .stat-change {
  justify-content: flex-end;
}

.stat-change.positive { color: var(--secondary); }
.stat-change.negative { color: var(--error); }

/* ── Charts area ── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* ── Chart with Y-Axis (Dashboard) ── */
.chart-with-axis {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.chart-with-axis .y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 8px 24px 0;
  min-width: 50px;
}

.chart-with-axis .y-axis .y-axis-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: right;
  line-height: 1;
}

.chart-with-axis .bar-chart {
  flex: 1;
}

/* ── Bar Chart (CSS) ── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 220px;
  padding: 0 4px;
}

.bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bar {
  width: 100%;
  max-width: 40px;
  border-radius: 4px 4px 0 0;
  transition: all 0.6s ease;
  position: relative;
  cursor: pointer;
}

.bar:hover { opacity: 0.8; }

.bar-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
}

.bar-value {
  font-size: 9px;
  color: var(--text-secondary);
  text-align: center;
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.bar:hover .bar-value { opacity: 1; }

/* ── Dual Axis Chart Container ── */
.dual-axis-chart-container {
  width: 100%;
}

.dual-chart-wrapper {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.dual-chart-wrapper .y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 24px;
  min-width: 55px;
  position: relative;
}

.dual-chart-wrapper .y-axis-left {
  padding-right: 8px;
  text-align: right;
}

.dual-chart-wrapper .y-axis-right {
  padding-left: 8px;
  text-align: left;
}

.dual-chart-wrapper .y-axis-label {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1;
}

.dual-chart-wrapper .y-axis-title {
  font-size: 9px;
  color: var(--text-light);
  text-align: center;
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
}

.dual-chart-wrapper .chart-area {
  flex: 1;
  position: relative;
  min-width: 0;
}

/* ── Grouped Bar Chart ── */
.grouped-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 0;
}

.grouped-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.grouped-bars {
  display: flex;
  gap: 1px;
  align-items: flex-end;
  width: 100%;
  justify-content: center;
}

.gbar {
  width: 45%;
  max-width: 18px;
  border-radius: 2px 2px 0 0;
  transition: all 0.6s ease;
  cursor: pointer;
}

.gbar:hover { opacity: 0.8; }

.gbar.entry-bar { background: linear-gradient(180deg, var(--primary), #3B82F6); }
.gbar.exit-bar { background: linear-gradient(180deg, #6366F1, #8B5CF6); }

/* ── SVG Chart Points ── */
.chart-point {
  cursor: pointer;
  transition: r 0.2s ease, fill 0.2s ease;
  pointer-events: all;
}

.chart-point:hover {
  r: 1.5;
  fill: #fff;
  stroke: var(--primary);
  stroke-width: 0.5px;
}

/* ── Chart Tooltip ── */
.chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  display: none;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* ── SVG Line Overlay ── */
.line-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 24px);
  pointer-events: none;
}

/* ── Alert List ── */
.alert-list { display: flex; flex-direction: column; gap: 8px; }

.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg);
  transition: var(--transition);
}

.alert-item:hover { background: var(--error-light); }

.alert-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.alert-dot.red { background: var(--error); animation: pulse 1.5s infinite; }
.alert-dot.amber { background: var(--accent); }
.alert-dot.green { background: var(--secondary); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.alert-text { font-size: 13px; color: var(--text); flex: 1; }
.alert-time { font-size: 11px; color: var(--text-light); }

/* ── Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.data-table tr:hover td { background: #F8FAFC; }

.data-table .number { font-variant-numeric: tabular-nums; text-align: right; }

/* ── Monthly Detail Table ── */
#monthlyDetailTable th {
  text-align: center;
  padding: 10px 8px;
  font-size: 12px;
}

#monthlyDetailTable .week-total-cell {
  text-align: center;
  padding: 8px 6px;
  background: var(--bg);
  vertical-align: middle;
  min-width: 90px;
  border-right: 2px solid var(--border);
}

.week-total-rev {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.week-total-cars {
  font-size: 11px;
  color: var(--text-secondary);
}

#monthlyDetailTable .detail-cell {
  text-align: center;
  padding: 6px;
  min-width: 90px;
  vertical-align: top;
}

#monthlyDetailTable .detail-cell.empty-cell {
  background: var(--bg);
}

#monthlyDetailTable .detail-cell.special-day {
  background: var(--accent-light);
}

.detail-day {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 2px;
  color: var(--text);
}

.detail-rev {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
}

.detail-cars {
  font-size: 10px;
  color: var(--text-secondary);
}

.detail-special {
  font-size: 9px;
  color: var(--accent);
  font-weight: 600;
}

.dow-total-row td {
  background: var(--bg) !important;
  border-top: 2px solid var(--border);
}

.total-cell {
  font-weight: 600;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge.green { background: var(--secondary-light); color: #065F46; }
.badge.amber { background: var(--accent-light); color: #92400E; }
.badge.red { background: var(--error-light); color: #991B1B; }
.badge.blue { background: var(--primary-light); color: #1E40AF; }

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

.calendar-header {
  text-align: center;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.calendar-day {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  min-height: 70px;
  font-size: 11px;
  transition: var(--transition);
  cursor: pointer;
}

.calendar-day:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }

.calendar-day .day-num {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text);
}

.calendar-day .day-revenue { color: var(--primary); font-weight: 600; }
.calendar-day .day-cars { color: var(--text-secondary); }

.calendar-day.special {
  background: var(--accent-light);
  border-color: var(--accent);
}

.calendar-day.empty { background: transparent; border-color: transparent; min-height: 0; }

/* ── Pricing Table ── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.pricing-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.pricing-card-header {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.pricing-card-header.weekday { background: linear-gradient(135deg, #DBEAFE, #EFF6FF); color: var(--primary-dark); }
.pricing-card-header.saturday { background: linear-gradient(135deg, #D1FAE5, #ECFDF5); color: #065F46; }
.pricing-card-header.holiday { background: linear-gradient(135deg, #FEE2E2, #FEF2F2); color: #991B1B; }

.pricing-detail { padding: 16px 20px; }

.pricing-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.pricing-row:last-child { border-bottom: none; }
.pricing-label { color: var(--text-secondary); }
.pricing-value { font-weight: 600; color: var(--text); }

/* ── Pricing Edit Table ── */
.pricing-edit-table {
  margin-top: 16px;
}

.pricing-edit-table th {
  text-align: center;
  padding: 8px 12px;
  font-size: 12px;
}

.pricing-edit-table td {
  padding: 8px 12px;
  font-size: 13px;
  vertical-align: middle;
}

.pricing-edit-table .before-val {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.form-input-sm {
  width: 70px !important;
  padding: 4px 8px !important;
  font-size: 13px !important;
  display: inline-block;
}

/* ── Radio Labels ── */
.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.radio-label:hover {
  background: var(--bg);
}

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

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

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  transition: var(--transition);
}

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

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

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

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

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

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
}

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

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  z-index: 300;
  display: none;
  animation: slideInRight 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.toast.show { display: flex; align-items: center; gap: 10px; }

@keyframes slideInRight { from { transform: translateX(100px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
}
