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

:root {
  --primary: #1a6b52;
  --primary-light: #e8f5f0;
  --primary-dark: #0d4a38;
  --primary-mid: #2d9471;
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --surface: #ffffff;
  --surface-alt: #f8fafb;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --success: #10b981;
  --success-light: #ecfdf5;
  --info: #3b82f6;
  --info-light: #eff6ff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: linear-gradient(135deg, #f0f7f4 0%, #f8fafb 50%, #f0f4f8 100%);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Header ===== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.app-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-title-icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.store-selector select {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 32px 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* ===== Main Nav Tabs ===== */
.main-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 20px;
}

.main-nav-tab {
  font-family: 'Noto Sans JP', sans-serif;
  padding: 12px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.main-nav-tab:hover { color: var(--text-secondary); }

.main-nav-tab.active {
  color: var(--primary);
  font-weight: 600;
}

.main-nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.main-nav-tab.locked {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lock-icon { font-size: 12px; }

/* ===== Main Container ===== */
.main-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* ===== View Pages ===== */
.view-page { display: none; }
.view-page.active { display: block; }

/* ===== Calendar ===== */
.calendar-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

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

.calendar-nav {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.15s;
}

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

.calendar-month { font-size: 15px; font-weight: 600; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.calendar-dow { font-size: 11px; font-weight: 500; color: var(--text-muted); padding: 4px 0; }

.calendar-day {
  font-size: 13px; padding: 6px 0; border-radius: 8px;
  cursor: pointer; transition: all 0.15s; position: relative;
}
.calendar-day:hover { background: var(--primary-light); }
.calendar-day.other-month { color: var(--text-muted); opacity: 0.4; }
.calendar-day.today { font-weight: 600; color: var(--primary); }
.calendar-day.today::after {
  content: ''; position: absolute; bottom: 2px; left: 50%;
  transform: translateX(-50%); width: 4px; height: 4px;
  background: var(--primary); border-radius: 50%;
}
.calendar-day.selected { background: var(--primary); color: white; font-weight: 600; }
.calendar-day.selected::after { background: white; }
.calendar-day.has-data::before {
  content: ''; position: absolute; top: 3px; right: 6px;
  width: 5px; height: 5px; background: var(--accent); border-radius: 50%;
}

.selected-date-display {
  margin-top: 10px; padding: 8px 12px; background: var(--primary-light);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  color: var(--primary-dark); text-align: center;
}

/* ===== Project Tabs ===== */
.project-tabs {
  display: flex; gap: 6px; margin-bottom: 16px;
  overflow-x: auto; padding: 2px; -webkit-overflow-scrolling: touch;
}
.project-tabs::-webkit-scrollbar { display: none; }

.project-tab {
  font-family: 'Noto Sans JP', sans-serif;
  padding: 8px 18px; border: 1px solid var(--border);
  border-radius: 24px; background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; white-space: nowrap; transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.project-tab:hover { border-color: var(--primary); color: var(--primary); }
.project-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.project-tab.add-tab { border-style: dashed; color: var(--text-muted); background: transparent; box-shadow: none; }
.project-tab.add-tab:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Counter Cards ===== */
.counter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 16px;
}

.counter-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: all 0.15s;
  user-select: none; -webkit-user-select: none;
}
.counter-card:active { transform: scale(0.97); }

.counter-card-tap {
  padding: 20px 16px 12px; cursor: pointer; text-align: center;
  transition: background 0.15s; position: relative;
}
.counter-card-tap:active { background: var(--primary-light); }

.counter-card-name {
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  margin-bottom: 8px; line-height: 1.3; min-height: 32px;
  display: flex; align-items: center; justify-content: center;
}

.counter-card-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 36px; font-weight: 600; color: var(--text);
  line-height: 1; margin-bottom: 4px; transition: color 0.2s;
}
.counter-card-tap:active .counter-card-value { color: var(--primary); }

.counter-card-hint {
  font-size: 10px; color: var(--text-muted);
  opacity: 0; transition: opacity 0.2s;
}
.counter-card:hover .counter-card-hint { opacity: 1; }

.counter-card-controls { display: flex; border-top: 1px solid var(--border-light); }

.counter-btn {
  flex: 1; padding: 8px 0; border: none; background: transparent;
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; color: var(--text-secondary);
}
.counter-btn:first-child { border-right: 1px solid var(--border-light); }
.counter-btn.minus:hover { background: var(--danger-light); color: var(--danger); }
.counter-btn.plus:hover { background: var(--primary-light); color: var(--primary); }

.ripple {
  position: absolute; border-radius: 50%;
  background: rgba(26,107,82,0.15); transform: scale(0);
  animation: ripple-anim 0.5s ease-out; pointer-events: none;
}
@keyframes ripple-anim { to { transform: scale(3); opacity: 0; } }

.toast-plus {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%,-50%) scale(0.8);
  font-family: 'JetBrains Mono', monospace;
  font-size: 48px; font-weight: 700; color: var(--primary);
  opacity: 0; pointer-events: none; z-index: 200;
}
.toast-plus.show { animation: toast-pop 0.5s ease-out; }
@keyframes toast-pop {
  0% { opacity: 0.8; transform: translate(-50%,-50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%,-70%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%,-90%) scale(0.9); }
}

.add-item-card {
  border: 2px dashed var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  min-height: 130px; cursor: pointer; transition: all 0.2s;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  gap: 6px; background: transparent;
}
.add-item-card:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.daily-summary {
  background: var(--surface); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.daily-summary-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.daily-summary-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px; font-weight: 600; color: var(--primary);
}

/* ===== Dashboard ===== */
.dash-filters {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.dash-filters-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.filter-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.filter-group select,
.filter-group input {
  font-family: 'Noto Sans JP', sans-serif;
  width: 100%;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.filter-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: 'Noto Sans JP', sans-serif;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-btn:hover { background: var(--surface-alt); }

.filter-btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.filter-btn.primary:hover { background: var(--primary-dark); }

.filter-btn.export-btn {
  background: var(--info);
  color: white;
  border-color: var(--info);
}
.filter-btn.export-btn:hover { background: #2563eb; }

/* KPIs */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  text-align: center;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.kpi-value-text {
  font-size: 16px;
  font-family: 'Noto Sans JP', sans-serif;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* KPI 前期間比較バッジ */
.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.kpi-change.decrease {
  background: var(--success-light);
  color: var(--success);
}
.kpi-change.increase {
  background: var(--danger-light);
  color: var(--danger);
}
.kpi-change.neutral {
  background: var(--surface-alt);
  color: var(--text-muted);
}
.kpi-change-arrow {
  font-size: 10px;
}
.kpi-comp-period {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Chart */
.dash-chart-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.dash-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dash-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.chart-type-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface-alt);
  border-radius: 6px;
  padding: 3px;
}

.chart-type-btn {
  font-family: 'Noto Sans JP', sans-serif;
  padding: 4px 12px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

.chart-type-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.chart-type-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Data Mode Toggle */
.data-mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface-alt);
  border-radius: 6px;
  padding: 3px;
}

.data-mode-btn {
  font-family: 'Noto Sans JP', sans-serif;
  padding: 4px 12px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

.data-mode-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.data-mode-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Disabled toggle groups with tooltip hint */
.chart-type-toggle.disabled,
.data-mode-toggle.disabled {
  opacity: 0.4;
  pointer-events: none;
  position: relative;
}
.chart-type-toggle.disabled::after,
.data-mode-toggle.disabled::after {
  content: attr(data-disabled-hint);
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 400;
}

.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
}

/* Data Table */
.dash-table-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow-x: auto;
}

.dash-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-table-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dash-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dash-table th:last-child,
.dash-table td:last-child {
  text-align: right;
}

.dash-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: var(--primary-light); }

.dash-table .total-row td {
  font-weight: 700;
  background: var(--surface-alt);
  border-top: 2px solid var(--border);
}

.dash-table .num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-align: right;
}

/* ===== Auth / Login ===== */
.auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 20px;
}

.auth-lock-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.auth-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.auth-desc {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 300px;
}

.auth-input-group {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

.auth-input {
  flex: 1;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 15px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
}

.auth-input:focus { border-color: var(--primary); }

.auth-error {
  color: var(--danger);
  font-size: 12px;
  display: none;
}

/* ===== Export Toast ===== */
.export-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== Error Toast ===== */
.error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--danger);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: transform 0.3s ease;
}
.error-toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== Modals ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 300; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all 0.25s; padding: 20px;
}
.modal-overlay.show { opacity: 1; visibility: visible; }

.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 24px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg); transform: translateY(20px);
  transition: transform 0.25s;
}
.modal-overlay.show .modal { transform: translateY(0); }

.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

.modal-input {
  width: 100%; font-family: 'Noto Sans JP', sans-serif;
  font-size: 15px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none;
}
.modal-input:focus { border-color: var(--primary); }

.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

.modal-btn {
  font-family: 'Noto Sans JP', sans-serif;
  padding: 8px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all 0.15s; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary);
}
.modal-btn:hover { background: var(--surface-alt); }
.modal-btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.modal-btn.primary:hover { background: var(--primary-dark); }
.modal-btn.danger { background: var(--danger); color: white; border-color: var(--danger); }
.modal-btn.danger:hover { background: #dc2626; }

.modal-number-input {
  width: 100%; font-family: 'JetBrains Mono', monospace;
  font-size: 32px; font-weight: 600; text-align: center;
  padding: 12px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); outline: none;
}
.modal-number-input:focus { border-color: var(--primary); }

.edit-item-name { font-size: 13px; color: var(--text-secondary); text-align: center; margin-bottom: 12px; }

/* ===== Settings ===== */
.settings-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-list {
  list-style: none;
}

.settings-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}

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

.settings-list-item .item-name { font-weight: 500; }
.settings-list-item .item-meta { font-size: 12px; color: var(--text-muted); }

.settings-item-actions {
  display: flex;
  gap: 6px;
}

.settings-btn {
  font-family: 'Noto Sans JP', sans-serif;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
}
.settings-btn:hover { background: var(--surface-alt); }
.settings-btn.danger { color: var(--danger); border-color: var(--danger-light); }
.settings-btn.danger:hover { background: var(--danger-light); }
.settings-btn.restore { color: var(--primary); border-color: var(--primary-light); }
.settings-btn.restore:hover { background: var(--primary-light); }

.settings-list-item.archived {
  opacity: 0.6;
  background: var(--surface-alt);
}
.settings-list-item.archived .item-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.settings-add-btn {
  font-family: 'Noto Sans JP', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 10px;
}
.settings-add-btn:hover { border-color: var(--primary); color: var(--primary); }

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-switch.active { background: var(--primary); }
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}
.toggle-switch.active::after { transform: translateX(18px); }

/* ===== Loading ===== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 8px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .main-container { padding: 12px; }
  .counter-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .counter-card-value { font-size: 30px; }
  .filter-grid { grid-template-columns: 1fr; }
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 22px; }
  .chart-container { height: 240px; }
}

@media (min-width: 768px) {
  .counter-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== Settings Management Buttons ===== */
.settings-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  gap: 8px;
}
.settings-item-row:last-child { border-bottom: none; }

.settings-item-info {
  flex: 1;
  min-width: 0;
}
.settings-item-info .item-name {
  font-weight: 500;
  word-break: break-all;
}
.settings-item-info .item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
}

.settings-item-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.settings-reorder-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.15s;
  padding: 0;
}
.settings-reorder-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.settings-reorder-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.settings-reorder-btn:disabled:hover {
  background: var(--surface);
  color: var(--text-muted);
  border-color: var(--border);
}

.settings-action-btn {
  font-family: 'Noto Sans JP', sans-serif;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  white-space: nowrap;
}
.settings-action-btn:hover {
  background: var(--surface-alt);
}
.settings-action-btn.edit {
  color: var(--info);
  border-color: var(--info-light);
}
.settings-action-btn.edit:hover {
  background: var(--info-light);
}
.settings-action-btn.type {
  color: var(--accent);
  border-color: var(--accent-light);
}
.settings-action-btn.type:hover {
  background: var(--accent-light);
}
.settings-action-btn.danger {
  color: var(--danger);
  border-color: var(--danger-light);
}
.settings-action-btn.danger:hover {
  background: var(--danger-light);
}
.settings-action-btn.restore {
  color: var(--primary);
  border-color: var(--primary-light);
}
.settings-action-btn.restore:hover {
  background: var(--primary-light);
}
.settings-action-btn.archive {
  color: var(--text-muted);
  border-color: var(--border);
}
.settings-action-btn.archive:hover {
  background: var(--surface-alt);
}

/* Archived items */
.settings-item-row.archived {
  opacity: 0.5;
  background: var(--surface-alt);
  padding: 10px 8px;
  border-radius: 6px;
  margin: 2px 0;
}
.settings-item-row.archived .item-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Inactive store styling */
.settings-item-row.inactive {
  opacity: 0.6;
}
.settings-item-row.inactive .item-name {
  color: var(--text-muted);
}

/* ===== Project Type Modal ===== */
.project-type-options {
  margin: 16px 0;
}

.project-type-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.project-type-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.project-type-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.project-type-option input[type="radio"] {
  margin-top: 2px;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.project-type-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.project-type-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.store-checkbox-group {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  display: none;
}
.store-checkbox-group.show {
  display: block;
}

.store-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text);
}
.store-checkbox-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ===== Audit Log Table ===== */
.audit-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.audit-log-table th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.audit-log-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  word-break: break-all;
}
.audit-log-table tr:last-child td { border-bottom: none; }
.audit-log-table tr:hover td { background: var(--primary-light); }

.audit-log-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Divider within settings section */
.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.settings-subsection-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
