/* ==========================================================================
   WMZ 水質検査・塩素管理システム - Stylesheet
   ========================================================================== */

:root {
  /* Theme Colors: Oceanic Clean Palette */
  --primary: #0284c7;         /* Ocean Blue */
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --primary-glow: rgba(2, 132, 199, 0.25);
  
  --secondary: #0d9488;       /* Aqua Teal */
  --secondary-light: #ccfbf1;
  
  --dragon-primary: #ea580c;  /* Orange/Dragon Accent */
  --dragon-light: #ffedd5;
  --dragon-border: #fed7aa;

  --safe-green: #10b981;      /* Emerald (Within Range) */
  --safe-light: #d1fae5;
  --safe-border: #6ee7b7;

  --warn-orange: #f59e0b;     /* Amber (Warning) */
  --warn-light: #fef3c7;
  
  --danger-red: #ef4444;      /* Red (Out of Range) */
  --danger-light: #fee2e2;

  --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%);
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-glass: rgba(255, 255, 255, 0.85);

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #94a3b8;

  --border-light: #e2e8f0;
  --border-focus: #38bdf8;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 10px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 35px -5px rgba(2, 132, 199, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-sans: 'Outfit', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 60px;
}

.app-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.app-header {
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  padding: 12px 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.05em;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

/* Tabs (表切り替えスイッチ) */
.tab-switch, .main-tab-switch {
  display: inline-flex;
  background: #e2e8f0;
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.7);
}

.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Date Navigator & Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.date-selector-wrap {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 3px 6px;
  gap: 4px;
}

.date-nav-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

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

.date-nav-btn:active {
  transform: scale(0.92);
}

.date-display-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  position: relative;
}

.date-display-box:hover {
  background: #e2e8f0;
}

.hidden-date-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.date-today-btn {
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border-light);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--primary);
  transition: all 0.15s;
}

.date-today-btn:hover {
  background: var(--primary-light);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* ==========================================================================
   Info Bar: Environmental & Global Status (Optimized for 8-inch Tablets)
   ========================================================================== */
.info-bar-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 1180px) {
  .info-bar-container {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

@media (max-width: 600px) {
  .info-bar-container {
    grid-template-columns: 1fr;
  }
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0; /* Prevents flex/grid overflow */
}

.info-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.info-card-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-card-header-left i,
.info-card-header > i {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

.card-action-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.card-action-icon-btn:hover {
  background: #e2e8f0;
  color: var(--primary);
}

.card-action-icon-btn svg {
  width: 14px;
  height: 14px;
}

/* Staff Badges */
.staff-badges {
  display: flex;
  gap: 6px;
}

.staff-badge {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
}

.staff-badge:hover {
  background: var(--primary-light);
  border-color: var(--border-focus);
}

.badge-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 4px;
  white-space: nowrap;
}

.badge-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-arrow {
  width: 12px;
  height: 12px;
  color: var(--text-sub);
  flex-shrink: 0;
}

/* Weather & Temperature - Perfect Fit for 8-inch Screens */
.weather-inputs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
}

.weather-selector {
  display: flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: var(--radius-sm);
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.weather-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 4px;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.weather-opt i {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.weather-opt.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.temp-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}

.temp-input-wrap:hover {
  background: var(--primary-light);
  border-color: var(--border-focus);
}

.temp-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.temp-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

.temp-unit {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Drain Pattern */
.pattern-selector {
  display: flex;
  gap: 6px;
}

.pattern-opt {
  flex: 1;
  padding: 6px 4px;
  border: 1.5px solid var(--border-light);
  background: #f8fafc;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  white-space: nowrap;
}

.pattern-opt:hover {
  background: #f1f5f9;
}

.pattern-opt.pattern-opt-a.active {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0369a1;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.pattern-opt.pattern-opt-b.active {
  background: #fef3c7;
  border-color: #d97706;
  color: #b45309;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

.pattern-opt.pattern-opt-c.active {
  background: #f3e8ff;
  border-color: #7c3aed;
  color: #6d28d9;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
}

/* Standards Guide & Status */
.standard-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.standard-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-badge.safe {
  background: var(--safe-light);
  color: #065f46;
  border: 1px solid var(--safe-border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.88rem;
}

.range-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.live-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  transition: all 0.25s ease;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7);
  animation: pulse-blue 2s infinite;
  transition: all 0.25s ease;
}

@keyframes pulse-blue {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(2, 132, 199, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

@keyframes pulse-yellow {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.8); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(234, 179, 8, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(234, 179, 8, 0); }
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.live-status-indicator.saving {
  background: #fef9c3;
  border-color: #fde047;
}

.live-status-indicator.saving .pulse-dot {
  background: #eab308;
  animation: pulse-yellow 0.8s infinite;
}

.live-status-indicator.saving .status-text {
  color: #854d0e;
  font-weight: 700;
}

.live-status-indicator.saved {
  background: #dcfce7;
  border-color: #86efac;
}

.live-status-indicator.saved .pulse-dot {
  background: #16a34a;
  animation: pulse-green 1.2s infinite;
}

.live-status-indicator.saved .status-text {
  color: #166534;
  font-weight: 700;
}

.status-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* ==========================================================================
   Main Content Views
   ========================================================================== */
.table-view {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.table-view.active {
  display: flex;
}

/* ============================================== */
/* 2. Handover Banner Card (備考・引き継ぎ・連絡)      */
/* ============================================== */
.handover-banner-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.handover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
}

.handover-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.handover-title i {
  color: #8b5cf6;
}

.handover-status-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.handover-status-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.handover-confirm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.handover-confirm-btn.unconfirmed {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.1);
}

.handover-confirm-btn.unconfirmed:hover {
  background: #fecaca;
  transform: translateY(-1px);
}

.handover-confirm-btn.confirmed {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
  box-shadow: 0 1px 2px rgba(22, 101, 52, 0.1);
}

.handover-confirm-btn.confirmed:hover {
  background: #bbf7d0;
  transform: translateY(-1px);
}

.handover-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 900px) {
  .handover-content-grid {
    grid-template-columns: 1fr;
  }
}

.handover-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.handover-box.prev-day-box {
  background: #fdf4ff;
  border-color: #f0abfc;
}

.handover-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.handover-box-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.handover-box-tag.prev-tag {
  background: #fae8ff;
  color: #a21caf;
  border: 1px solid #f0abfc;
}

.handover-box-tag.today-tag {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.handover-box-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: #86198f;
  font-family: var(--font-mono);
}

.handover-box-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.prev-handover-display {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 54px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 4px;
  border: 1px solid rgba(240, 171, 252, 0.5);
}

.prev-handover-display.empty {
  color: var(--text-muted);
  font-style: italic;
}

.handover-textarea {
  width: 100%;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.45;
  resize: vertical;
  background: var(--surface);
  color: var(--text-main);
  transition: all 0.15s;
}

.handover-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* ============================================== */
/* 3. Drain Pattern Banner Card (排水パターン)      */
/* ============================================== */
.drain-pattern-banner-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.pattern-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pattern-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-main);
}

.pattern-banner-title i {
  color: #059669;
}

.pattern-banner-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pattern-selector-banner {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 4px;
}

.section-title-with-autosave {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* View Control Bar (測定記録 ウィンドウ) */
.view-control-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.view-control-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.view-control-bottom-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding-top: 8px;
  border-top: 1px dashed var(--border-light);
}

.section-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.section-badge i {
  color: var(--primary);
}

.section-badge.b-badge i {
  color: #06b6d4;
}

.view-mode-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.mode-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.quick-stats-pills {
  display: flex;
  gap: 8px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-pill.alert {
  background: var(--danger-light);
  color: var(--danger-red);
}

/* Attraction Group Wrappers */
.attraction-group-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-title h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.group-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.group-tag.primary {
  background: var(--primary-light);
  color: var(--primary);
}

.group-tag.dragon {
  background: var(--dragon-light);
  color: var(--dragon-primary);
}

.group-meta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

/* Attraction Cards Grid */
.attraction-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.attraction-cards-grid.upper-grid {
  grid-template-columns: 1fr 0.9fr 1.3fr;
}

.attraction-cards-grid.dragon-grid {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

@media (max-width: 1280px) {
  .attraction-cards-grid.upper-grid {
    grid-template-columns: 1fr 1fr;
  }
  .card-double-span {
    grid-column: span 2;
  }
  .attraction-cards-grid.dragon-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .attraction-cards-grid.upper-grid,
  .attraction-cards-grid.dragon-grid {
    grid-template-columns: 1fr;
  }
  .card-double-span {
    grid-column: span 1;
  }
}

.attraction-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.card-head {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
}

.card-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon.dragon-icon {
  background: var(--dragon-light);
  color: var(--dragon-primary);
}

.card-icon.aux-icon {
  background: #f3e8ff;
  color: #9333ea;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

/* Card Area Badge & Drain Target Pill */
.card-area-badge-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.area-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.2;
  display: inline-block;
  white-space: nowrap;
}

.area-badge.area-a {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.area-badge.area-b {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.area-badge.area-c {
  background: #f3e8ff;
  color: #6d28d9;
  border: 1px solid #e9d5ff;
}

/* Drain Target Pill (本日排水) */
.drain-target-pill {
  display: none;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 4px;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* When the card is the target for today's drainage pattern */
.attraction-card.card-area-a.drain-target-active {
  border: 2px solid #0284c7;
  box-shadow: 0 4px 18px rgba(2, 132, 199, 0.22);
}

.attraction-card.card-area-a.drain-target-active .card-head {
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border-bottom-color: #bae6fd;
}

.attraction-card.card-area-a.drain-target-active .drain-target-pill {
  display: inline-flex;
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.35);
}

.attraction-card.card-area-b.drain-target-active {
  border: 2px solid #d97706;
  box-shadow: 0 4px 18px rgba(217, 119, 6, 0.22);
}

.attraction-card.card-area-b.drain-target-active .card-head {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border-bottom-color: #fde68a;
}

.attraction-card.card-area-b.drain-target-active .drain-target-pill {
  display: inline-flex;
  background: #d97706;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.35);
}

.attraction-card.card-area-c.drain-target-active {
  border: 2px solid #7c3aed;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.22);
}

.attraction-card.card-area-c.drain-target-active .card-head {
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
  border-bottom-color: #e9d5ff;
}

.attraction-card.card-area-c.drain-target-active .drain-target-pill {
  display: inline-flex;
  background: #7c3aed;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(124, 58, 237, 0.35);
}

/* Read-Only Night Timer Badge (Configured only in Settings modal) */
.night-timer-readonly-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.night-badge-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: #475569;
  font-size: 0.74rem;
  white-space: nowrap;
}

.night-badge-title svg,
.night-badge-title i {
  width: 13px;
  height: 13px;
  color: #6366f1;
}

.night-badge-values {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.nb-on strong {
  font-weight: 800;
  color: #0284c7;
}

.nb-off strong {
  font-weight: 800;
  color: #d97706;
}

.nb-sep {
  color: #cbd5e1;
  font-weight: 400;
  margin: 0 1px;
}

.card-timer-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Data Table Styles (Inside Cards) - Rigid Line Alignment
   ========================================================================== */
.table-scroll-container {
  overflow-x: auto;
  width: 100%;
  flex: 1;
}

.fixed-layout-table {
  table-layout: fixed;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: center;
}

.data-table thead th {
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 700;
  padding: 6px 2px;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  white-space: nowrap;
  height: 38px;
  vertical-align: middle;
}

.data-table thead th:last-child {
  border-right: none;
}

.th-time {
  position: sticky;
  left: 0;
  z-index: 10;
  background: #e2e8f0 !important;
  color: var(--text-main) !important;
  font-family: var(--font-mono);
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.08);
}
.th-conc { font-family: var(--font-mono); }
.th-liter { background: #f0fdf4; color: #166534; }
.th-timer-wrap { display: flex; flex-direction: column; line-height: 1.1; }
.th-timer-sub { font-size: 0.68rem; color: var(--text-sub); }
.th-timer-dual { font-size: 0.72rem; }
.th-subhead-group { background: #e0f2fe !important; color: var(--primary-hover) !important; font-size: 0.75rem; }

/* Rigid Row Height Alignment: 38px across all tables */
.data-table tbody tr {
  height: 38px;
  max-height: 38px;
}

.data-table tbody td {
  padding: 2px 2px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  height: 38px;
  max-height: 38px;
  vertical-align: middle;
  box-sizing: border-box;
}

.data-table tbody td:last-child {
  border-right: none;
}

.data-table tbody tr:hover td {
  background-color: #f8fafc;
}

/* Table Cells Interactive: Sticky Time Column (時刻列固定) */
.td-time-label {
  position: sticky;
  left: 0;
  z-index: 5;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.8rem;
  background: #f8fafc !important;
  text-align: center;
  white-space: nowrap;
  letter-spacing: -0.02em;
  padding: 0 2px !important;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.data-table tbody tr:hover td.td-time-label {
  background: #edf2f7 !important;
}

/* Start Time Badge (08時の「Start」小文字・コンパクト表記) */
.time-start-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: #0369a1;
  letter-spacing: -0.02em;
  display: inline-block;
  line-height: 1;
  background: #e0f2fe;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid #bae6fd;
}

/* Chlorine Concentration Cell (Tappable for Keypad) */
.cell-conc {
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 6px;
  margin: 0;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
  user-select: none;
}

.cell-conc:hover {
  background: #e0f2fe;
  transform: scale(1.04);
}

.cell-conc.empty {
  color: #cbd5e1;
}

.cell-conc.safe {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.cell-conc.low {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #f87171;
}

.cell-conc.high {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #c084fc;
}

/* Chlorine Liter Cell (Tappable for Dial) */
.cell-liter {
  cursor: pointer;
  background: #f0fdf4;
  color: #15803d;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 6px;
  margin: 0;
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 32px;
}

.cell-liter:hover {
  background: #dcfce7;
  border: 1px solid #86efac;
  transform: scale(1.02);
}

.cell-liter.empty {
  color: #94a3b8;
  background: transparent;
}

.cell-liter .unit {
  font-size: 0.68rem;
  color: #16a34a;
}

/* Timer ON/OFF mini inputs (1.5x widened for high visibility & easy tapping) */
.timer-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 2px;
  width: 100%;
}

.timer-box {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  min-width: 46px;
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: all 0.12s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.timer-box:hover {
  border-color: var(--border-focus);
  background: #fff;
  color: var(--primary);
  transform: scale(1.02);
}

.timer-box.empty {
  color: #cbd5e1;
}

.timer-slash {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
  user-select: none;
}

/* Table Footer (Drain Meter) */
.data-table tfoot {
  background: #f8fafc;
  border-top: 2px solid var(--border-light);
}

.data-table tfoot td {
  padding: 6px 8px;
  height: 40px;
}

.tf-label {
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  font-size: 0.8rem;
}

.tf-val-cell {
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  transition: all 0.15s;
}

.tf-val-cell:hover {
  background: var(--primary-light);
  border-color: var(--border-focus);
}

.tf-val-cell .sub-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.tf-val-cell .val-text.placeholder {
  color: #cbd5e1;
  font-weight: 500;
  font-size: 0.82rem;
}

.tf-val-cell .unit-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 2px;
}

/* ==========================================================================
   Auxiliary Card (Tube Pressure & Remarks)
   ========================================================================== */
.card-auxiliary {
  grid-column: span 1;
}

.aux-content-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pressure-title, .remarks-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pressure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.pressure-item {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.pressure-item:hover {
  background: #f3e8ff;
  border-color: #d8b4fe;
}

.press-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.press-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: #7e22ce;
}

.press-unit {
  font-size: 0.7rem;
  color: var(--text-sub);
  margin-left: 2px;
}

.remarks-textarea {
  width: 100%;
  height: 110px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  resize: vertical;
  color: var(--text-main);
  background: #fafafa;
  transition: all 0.15s;
}

.remarks-textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* ==========================================================================
   Table B Styles
   ========================================================================== */
.b-grid-container {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1100px) {
  .b-grid-container {
    grid-template-columns: 1fr;
  }
}

.b-main-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.b-side-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.refill-body-row {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .refill-body-row {
    grid-template-columns: 1fr;
  }
}

.b-table thead th {
  font-size: 0.78rem;
  padding: 5px 2px;
}

.th-area-group {
  padding: 4px 2px !important;
  vertical-align: middle;
  transition: all 0.2s ease;
}

.th-b-title {
  font-weight: 800;
  font-size: 0.78rem;
  margin-bottom: 2px;
  line-height: 1.2;
}

.area-badge-sm {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  display: inline-block;
  line-height: 1.2;
}

.th-area-group.drain-target-active.th-area-a {
  background: #e0f2fe;
  color: #0369a1;
  border-top: 3px solid #0284c7;
}

.th-area-group.drain-target-active.th-area-b {
  background: #fef3c7;
  color: #b45309;
  border-top: 3px solid #d97706;
}

.th-area-group.drain-target-active.th-area-c {
  background: #f3e8ff;
  color: #6d28d9;
  border-top: 3px solid #7c3aed;
}

.th-temp {
  background: #f0fdf4;
  color: #166534;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 2px;
  text-align: center;
  border-right: 1px solid var(--border-light);
}

.cell-temp {
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.84rem;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  padding: 3px 2px;
  text-align: center;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.cell-temp small {
  font-size: 0.68rem;
  font-weight: 600;
  color: #0284c7;
}

.cell-temp:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  transform: scale(1.02);
}

.cell-temp.empty {
  color: var(--text-muted);
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  font-weight: 500;
}

.cell-drain-check {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.check-icon-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-light);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.check-icon-box.checked {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Routine Check Card */
.routine-body, .refill-body, .manual-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.check-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.check-item-row:hover {
  background: #e0f2fe;
  border-color: var(--border-focus);
}

.custom-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  transition: all 0.15s;
}

.custom-checkbox.checked {
  background: var(--safe-green);
  border-color: var(--safe-green);
  color: #fff;
}

.custom-checkbox.checked::after {
  content: '✓';
  font-weight: 900;
  font-size: 14px;
}

.check-item-text {
  display: flex;
  flex-direction: column;
}

.check-item-text strong {
  font-size: 0.92rem;
  color: var(--text-main);
}

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

.mist-setting-box {
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  padding: 12px;
  border-radius: var(--radius-sm);
}

.mist-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0d9488;
  margin-bottom: 8px;
}

.mist-options {
  display: flex;
  gap: 10px;
}

.mist-opt {
  flex: 1;
  background: #fff;
  border: 1px solid #99f6e4;
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mist-weather-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0f766e;
}

.mist-weather-badge.rainy {
  color: #0284c7;
}

.mist-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
}

/* Cannon Mini Table */
.cannon-grid-scroll {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.cannon-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: center;
}

.cannon-mini-table th {
  background: #f1f5f9;
  padding: 6px;
  font-weight: 700;
  color: var(--text-muted);
  position: sticky;
  top: 0;
}

.cannon-mini-table td {
  padding: 6px;
  border-top: 1px solid #f1f5f9;
}

.refill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.refill-item {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.refill-item:hover {
  background: var(--primary-light);
}

.refill-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.refill-val {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1rem;
  color: var(--primary);
}

/* Manual Accordion */
.manual-accordion-item {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.manual-acc-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.manual-acc-content {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==========================================================================
   MODAL: Common Styles
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.18s ease-out;
}

.modal-overlay.active {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 10000 !important;
  pointer-events: auto !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: #f1f5f9;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

/* Keypad Modal Sheet (Compact for Tablets & Mobile) */
.keypad-modal-sheet {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 400px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-sheet-heading {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Keypad 1〜10 Steps Bar */
.keypad-steps-bar {
  display: none; /* Turned to flex when type === 'chlorine' */
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
}

.step-item-btn {
  flex: 1;
  height: 28px;
  min-width: 0;
  padding: 0;
  border: 1px solid transparent;
  background: #ffffff;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.step-item-btn:hover {
  background: #e0f2fe;
  color: var(--primary);
  border-color: #bae6fd;
}

.step-item-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
  transform: scale(1.05);
  font-weight: 800;
}

/* Screen Display (Horizontal Layout) */
.keypad-display-screen {
  background: #0f172a;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(15, 23, 42, 0.15);
}

.keypad-screen-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.keypad-target-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 6px 10px;
  border-radius: 8px;
  flex: 1;
  min-width: 0;
}

.keypad-item-num-badge {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: #0f172a;
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 0.82rem;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.35);
  flex-shrink: 0;
}

.keypad-target-icon {
  color: #38bdf8;
  display: flex;
  align-items: center;
}

.keypad-target-icon svg {
  width: 18px;
  height: 18px;
}

.keypad-target-text-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.keypad-target-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

.keypad-target-badge {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.keypad-val-wrap {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
  padding-left: 4px;
}

.keypad-val {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 0.02em;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  line-height: 1;
}

.keypad-unit {
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8;
}

.keypad-status-bar {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.status-verdict {
  font-size: 0.78rem;
  font-weight: 700;
  color: #4ade80; /* 適正: 緑 */
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-verdict.warn-low {
  color: #f87171; /* 赤色警告: 0.40以下 */
}

.status-verdict.warn-high {
  color: #c084fc; /* 紫色警告: 2.00以上 */
}

/* Presets Bar */
.keypad-presets {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 0;
}

.preset-btn {
  flex: 1;
  padding: 5px 2px;
  border: 1px solid var(--border-light);
  background: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}

.preset-btn:hover {
  background: var(--primary-light);
  border-color: var(--border-focus);
  color: var(--primary);
}

/* Numeric 4x4 Grid - Slim Height */
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.key-btn {
  height: 42px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.key-btn:active {
  transform: scale(0.95);
  background: #e2e8f0;
}

.key-btn.action-key {
  font-size: 0.95rem;
}

.key-btn.action-key.backspace {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.key-btn.action-key.clear {
  background: #f1f5f9;
  color: var(--text-muted);
}

.key-btn.action-key.step-up, .key-btn.action-key.step-down {
  font-size: 0.78rem;
  background: #f0f9ff;
  color: var(--primary);
  border-color: #bae6fd;
  gap: 2px;
}

.key-btn.key-btn-zero {
  grid-column: span 2;
}

.keypad-footer-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.keypad-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto; /* 右寄せ */
}

.nav-step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  background: #f8fafc;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.nav-step-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.keypad-submit-btn-right {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, #0284c7 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px var(--primary-glow);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.keypad-submit-btn-right:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px var(--primary-glow);
}

.keypad-submit-btn-right:active {
  transform: translateY(0);
}

/* Footer: Single Submit (Temp / Single Input Mode) */
.keypad-footer-single-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.btn-half {
  flex: 1;
}

.keypad-submit-single-btn {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35) !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.keypad-submit-single-btn:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 100%) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   MODAL 2: Horizontal Residual Chlorine Slider Modal (残量L 左右スライダーUI)
   ========================================================================== */
.slider-modal-sheet {
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.slider-sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-sheet-icon {
  color: #10b981;
  width: 22px;
  height: 22px;
}

/* Screen Display Header */
.slider-display-screen {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.08);
}

.slider-screen-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.slider-target-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.slider-target-icon {
  color: #059669;
  display: flex;
  align-items: center;
}

.slider-target-icon svg {
  width: 20px;
  height: 20px;
}

.slider-target-text-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.slider-target-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: #047857;
}

.slider-target-badge {
  font-size: 0.95rem;
  font-weight: 800;
  color: #064e3b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slider-val-wrap {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.slider-val-num {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 900;
  color: #047857;
  line-height: 1;
}

.slider-val-unit {
  font-size: 0.9rem;
  font-weight: 800;
  color: #065f46;
}

/* Slider Body */
.slider-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Slider Ruler Box */
.slider-ruler-container {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 16px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.03);
}

/* Large Center Value Readout */
.slider-val-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.slider-preview-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.slider-preview-num-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.slider-preview-val {
  font-family: var(--font-mono);
  font-size: 3.0rem;
  font-weight: 900;
  color: #059669;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.slider-preview-unit {
  font-size: 1.1rem;
  font-weight: 800;
  color: #047857;
}

/* Track & Range Input */
.slider-track-wrap {
  position: relative;
  width: 100%;
  padding: 10px 0 22px;
  user-select: none;
}

/* Range Slider Styling */
.slider-range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: all 0.15s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.slider-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.1);
  cursor: grab;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.slider-range-input:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.6), 0 0 0 2px #34d399;
}

.slider-range-input::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.1);
  cursor: grab;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

/* Ruler Scale Ticks under slider */
.slider-scale-ticks {
  position: relative;
  width: 100%;
  height: 24px;
  margin-top: 8px;
  pointer-events: none;
}

.tick-group {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.tick-line {
  width: 2px;
  height: 8px;
  background: #94a3b8;
  border-radius: 1px;
}

.tick-line.major {
  height: 10px;
  width: 2px;
  background: #475569;
}

.tick-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  line-height: 1;
}

/* Slider Drag Direction Hint */
.slider-drag-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 0;
  border-top: 1px dashed var(--border-light);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.hint-dir {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.hint-dir.left {
  color: #dc2626;
}

.hint-dir.right {
  color: #059669;
}

.hint-step {
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.68rem;
  color: var(--text-main);
  font-weight: 800;
}

/* Step Buttons */
.slider-step-controls {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  width: 100%;
}

.slider-step-btn {
  padding: 8px 2px;
  border: 1px solid var(--border-light);
  background: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
}

.slider-step-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.slider-step-btn:active {
  transform: scale(0.95);
}

.slider-step-btn.slider-step-primary {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
  font-weight: 900;
}

.slider-step-btn.slider-step-primary:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

/* Presets Bar */
.slider-presets {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  width: 100%;
}

.slider-pre-btn {
  padding: 7px 2px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
  white-space: nowrap;
}

.slider-pre-btn small {
  font-size: 0.65rem;
}

.slider-pre-btn:hover {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.slider-pre-btn.active {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.35);
}

/* Footer Submit Button */
.slider-footer {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.slider-submit-btn {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35) !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
}

.slider-submit-btn:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 100%) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   MODAL 2-B1 & 2-B2: ON & OFF Timer Rotary Dial Modals (Ultra-Compact Mobile)
   ========================================================================== */
.timer-dial-sheet {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.timer-sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.95rem;
}

.timer-sheet-title-wrap.on-theme {
  color: #15803d;
}

.timer-sheet-title-wrap.off-theme {
  color: #1d4ed8;
}

.timer-type-badge {
  font-size: 0.68rem;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 5px;
  letter-spacing: 0.04em;
}

.timer-type-badge.on {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.timer-type-badge.off {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

/* Screen Display Header */
.timer-display-screen.on-screen {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 5px 10px;
}

.timer-display-screen.off-screen {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 5px 10px;
}

.timer-target-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-target-icon.on-icon {
  color: #16a34a;
}

.timer-target-icon.off-icon {
  color: #2563eb;
}

.timer-target-icon svg {
  width: 15px;
  height: 15px;
}

.timer-target-text-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.timer-target-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
}

.timer-target-badge {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
}

.timer-dial-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Two-column Row: Left = Time Display & Step Controls, Right = Compact Rotary Dial */
.timer-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #f8fafc;
  border: 1.5px solid var(--border-light);
  border-radius: 16px;
  padding: 10px 12px;
}

.timer-left-display-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.timer-col-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
}

.timer-big-val-box {
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timer-big-val-box.on-val-box {
  background: #ffffff;
  border: 1.5px solid #86efac;
  box-shadow: 0 1px 4px rgba(22, 163, 74, 0.08);
}

.timer-big-val-box.off-val-box {
  background: #ffffff;
  border: 1.5px solid #93c5fd;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.08);
}

.timer-big-val-box.night-val-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.timer-main-num-group {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.timer-big-num {
  font-family: var(--font-mono);
  font-size: 2.05rem;
  font-weight: 900;
  line-height: 1;
}

.on-val-box .timer-big-num {
  color: #15803d;
}

.off-val-box .timer-big-num {
  color: #1d4ed8;
}

.night-val-box .timer-big-num {
  color: #fbbf24;
}

.timer-big-unit {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-muted);
}

.timer-big-min-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.1;
  width: fit-content;
}

.timer-big-min-badge.on-min-badge {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.timer-big-min-badge.off-min-badge {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.timer-big-min-badge.night-min-badge {
  background: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  border: 1px solid #6366f1;
}

.timer-big-min-badge svg {
  width: 10px;
  height: 10px;
}

/* Step Buttons in Left Column - Compact Thumb-Friendly */
.timer-step-pair {
  display: flex;
  gap: 4px;
  width: 100%;
}

.timer-step-quad {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  width: 100%;
}

.timer-step-btn-sq {
  min-height: 32px;
  padding: 4px 4px;
  border: 1px solid var(--border-light);
  background: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.timer-step-btn-sq small {
  font-size: 0.62rem;
  opacity: 0.85;
}

.timer-step-btn-sq.on-btn:hover {
  background: #f0fdf4;
  color: #15803d;
  border-color: #86efac;
}

.timer-step-btn-sq.on-btn:active {
  background: #dcfce7;
  transform: scale(0.96);
}

.timer-step-btn-sq.off-btn:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.timer-step-btn-sq.off-btn:active {
  background: #dbeafe;
  transform: scale(0.96);
}

/* Right Column: Ultra-Compact Rotary Dial for Right-Thumb Control */
.timer-right-dial-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 2px;
}

.timer-rotary-compact {
  position: relative;
  width: 112px;
  height: 112px;
  min-width: 112px;
  min-height: 112px;
  max-width: 112px;
  max-height: 112px;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

/* Expanded Hit Area (判定範囲の拡大) for Right Thumb */
.timer-rotary-compact::before {
  content: '';
  position: absolute;
  top: -12px;
  left: -12px;
  right: -12px;
  bottom: -12px;
  border-radius: 50%;
  pointer-events: auto;
  z-index: 1;
}

.timer-rotary-compact:active {
  cursor: grabbing;
}

.timer-rotary-compact.on-dial {
  background: linear-gradient(145deg, #f0fdf4 0%, #dcfce7 100%);
  border: 3px solid #86efac;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.15), inset 0 1px 3px rgba(255, 255, 255, 0.9);
}

.timer-rotary-compact.off-dial {
  background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 100%);
  border: 3px solid #bfdbfe;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15), inset 0 1px 3px rgba(255, 255, 255, 0.9);
}

.timer-rotary-compact.night-dial {
  background: radial-gradient(circle at center, #1e1b4b 25%, #0f172a 100%) !important;
  border: 3px solid rgba(129, 140, 248, 0.5) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), inset 0 0 12px rgba(99, 102, 241, 0.25) !important;
}

.timer-dial-ticks,
.night-dial-ticks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  border-radius: 50% !important;
  aspect-ratio: 1 / 1 !important;
  pointer-events: none;
  box-sizing: border-box;
}

.dial-tick,
.night-tick {
  position: absolute;
  font-size: 0.58rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
  pointer-events: none;
}

.dial-tick {
  color: #94a3b8;
}

.night-tick {
  color: #a5b4fc;
}

.tick-0 { top: 3px; left: 50%; transform: translateX(-50%); }
.tick-30 { right: 4px; top: 50%; transform: translateY(-50%); }
.tick-60 { bottom: 3px; left: 50%; transform: translateX(-50%); }
.tick-90 { left: 4px; top: 50%; transform: translateY(-50%); }

.timer-dial-ring,
.night-dial-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  border-radius: 50% !important;
  aspect-ratio: 1 / 1 !important;
  pointer-events: none;
  box-sizing: border-box;
}

.timer-dial-knob,
.night-dial-knob {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  border-radius: 50% !important;
  aspect-ratio: 1 / 1 !important;
  transform: rotate(0deg);
  transition: transform 0.05s ease-out;
  pointer-events: none;
  box-sizing: border-box;
}

.timer-knob-pointer.on-pointer {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.8), inset 0 1px 3px #fff;
  border: 2px solid #fff;
}

.timer-knob-pointer.off-pointer {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.8), inset 0 1px 3px #fff;
  border: 2px solid #fff;
}

.night-knob-pointer {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.9), inset 0 1px 2px #fff;
  border: 2px solid #ffffff;
  pointer-events: none;
  z-index: 3;
}

.timer-knob-center-hub {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  max-width: 40px;
  max-height: 40px;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}

.timer-knob-center-hub.on-hub {
  background: #ffffff;
  color: #16a34a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.timer-knob-center-hub.off-hub {
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.timer-knob-center-hub.night-hub {
  background: #1e1b4b !important;
  color: #fbbf24 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5) !important;
  border: 1.5px solid rgba(251, 191, 36, 0.4) !important;
}

.timer-knob-center-hub svg {
  width: 16px;
  height: 16px;
}

.rotary-sub-hint {
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ==========================================================================
   よく使う時間 (Presets) Buttons — Compact Unified Horizontal Design
   ========================================================================== */
.timer-quick-section {
  width: 100%;
}

.timer-quick-title {
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.timer-quick-title svg {
  width: 12px;
  height: 12px;
}

/* Presets Grid: Compact Horizontal Layout */
.timer-presets-grid.on-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.timer-presets-grid.off-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

/* Unified Compact Preset Button for ON and OFF */
.timer-pre-btn {
  min-height: 32px;
  height: 32px;
  padding: 2px 2px;
  border: 1.5px solid var(--border-light);
  background: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: all 0.12s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.timer-pre-btn .pre-sec {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.timer-pre-btn .pre-unit {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
}

.timer-pre-btn .pre-min {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  margin-left: 1px;
}

.timer-pre-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.timer-pre-btn:active {
  transform: scale(0.95);
}

/* Active State in ON Modal */
.timer-on-theme .timer-pre-btn.active {
  background: #16a34a;
  border-color: #15803d;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

.timer-on-theme .timer-pre-btn.active .pre-sec,
.timer-on-theme .timer-pre-btn.active .pre-unit {
  color: #ffffff;
}

.timer-on-theme .timer-pre-btn.active .pre-min {
  color: #dcfce7;
}

/* Active State in OFF Modal */
.timer-off-theme .timer-pre-btn.active {
  background: #2563eb;
  border-color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.timer-off-theme .timer-pre-btn.active .pre-sec,
.timer-off-theme .timer-pre-btn.active .pre-unit {
  color: #ffffff;
}

.timer-off-theme .timer-pre-btn.active .pre-min {
  color: #bfdbfe;
}

/* Footer: Cancel on left, Confirm on right (bottom-right thumb priority) */
.timer-dial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.btn-cancel-compact {
  flex: 1;
  min-height: 38px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
}

.btn-submit-right {
  flex: 1.8;
  min-height: 42px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 900;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.on-submit-btn {
  background: #16a34a;
  border-color: #15803d;
}

.on-submit-btn:hover {
  background: #15803d;
}

.off-submit-btn {
  background: #2563eb;
  border-color: #1d4ed8;
}

.off-submit-btn:hover {
  background: #1d4ed8;
}

/* Mobile Ergonomics (Bottom Sheet & Right Thumb reach) */
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .timer-dial-sheet {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 12px 14px max(16px, env(safe-area-inset-bottom));
    animation: slideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .timer-compact-row {
    padding: 6px 8px;
    gap: 8px;
  }

  .timer-rotary-compact,
  .timer-rotary-compact.night-dial {
    width: 106px;
    height: 106px;
    min-width: 106px;
    min-height: 106px;
    max-width: 106px;
    max-height: 106px;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
  }

  .timer-big-num {
    font-size: 1.75rem;
  }

  .timer-presets-grid.on-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
  }

  .timer-presets-grid.off-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
  }

  .timer-pre-btn {
    min-height: 30px;
    height: 30px;
  }

  .timer-pre-btn .pre-sec {
    font-size: 0.78rem;
  }
}

/* ==========================================================================
   MODAL 2-C: Night Timer Dial Modal (夜間タイマー専用モーダル)
   ========================================================================== */
.night-timer-modal-sheet {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99, 102, 241, 0.2);
  width: 100%;
  max-width: 420px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.night-sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.night-sheet-icon {
  color: #fbbf24;
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.5));
}

.night-sheet-sub {
  display: block;
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
}

/* Night Display Screen */
.night-display-screen {
  background: #1e1b4b;
  border: 1px solid rgba(129, 140, 248, 0.3);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(30, 27, 75, 0.4);
}

.night-screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.night-target-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 10px;
  border-radius: 8px;
  flex: 1;
  min-width: 0;
}

.night-target-icon {
  color: #fbbf24;
  display: flex;
  align-items: center;
}

.night-target-text-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.night-target-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: #a5b4fc;
}

.night-target-badge {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Field Tabs (ON / OFF Switcher) */
.night-field-tabs {
  display: flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.6);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.night-tab-btn {
  border: none;
  background: transparent;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: #94a3b8;
  transition: all 0.12s ease;
}

.night-tab-btn .tab-label {
  font-size: 0.62rem;
  font-weight: 700;
}

.night-tab-btn .tab-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 800;
}

.night-tab-btn.active {
  background: #6366f1;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

/* Value Display Group */
.night-val-display-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
}

.night-val-main-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.night-val-type-pill {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
  border: 1px solid #6366f1;
  padding: 2px 6px;
  border-radius: 4px;
}

.night-val-num {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 900;
  color: #fbbf24;
  line-height: 1;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}

.night-val-unit {
  font-size: 0.95rem;
  font-weight: 700;
  color: #a5b4fc;
}

.night-val-min-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 4px 8px;
  border-radius: 6px;
}

/* Night Body & Presets */
.night-dial-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.night-quick-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.night-quick-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.night-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.night-pre-btn {
  padding: 6px 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  color: #f1f5f9;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.12s;
}

.night-pre-btn .pre-sec {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.night-pre-btn .pre-min {
  font-size: 0.65rem;
  color: #94a3b8;
}

.night-pre-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: #818cf8;
}

.night-pre-btn.active {
  background: #6366f1;
  border-color: #a5b4fc;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Night Step Controls */
.night-step-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.night-step-btn {
  padding: 7px 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
}

.night-step-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
}

.night-help-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  color: #c7d2fe;
}

.night-help-box i {
  width: 16px;
  height: 16px;
  color: #fbbf24;
  flex-shrink: 0;
}

.night-modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-night-submit {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4) !important;
  font-size: 0.92rem !important;
  font-weight: 800 !important;
}

.btn-night-submit:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%) !important;
  transform: translateY(-1px);
}

.btn-staff-reg-pill {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0284c7;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-staff-reg-pill:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.btn-staff-reg-pill i, .btn-staff-reg-pill svg {
  width: 13px;
  height: 13px;
}

/* ==========================================================================
   MODAL 3-A & 3-B: Staff Selection & Staff Master Modals
   ========================================================================== */
.staff-modal-sheet {
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.staff-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.staff-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}

.staff-title-wrap h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.staff-sub-desc {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* 3-A: Staff Select Target Bar */
.staff-select-target-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 12px;
  gap: 8px;
}

.target-bar-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.target-toggle {
  display: flex;
  gap: 8px;
  flex: 1;
}

.target-btn {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid var(--border-light);
  background: #fff;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.target-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.target-current-name {
  font-weight: 800;
}

/* Staff List Header */
.staff-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 4px;
}

.staff-list-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-main);
}

.staff-note-text {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--warn-orange);
}

.staff-count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: #e2e8f0;
  color: var(--text-main);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Staff Select Grid */
.staff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.staff-select-card {
  background: #f8fafc;
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.staff-select-card:hover:not(.disabled) {
  background: var(--primary-light);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.staff-select-card.selected {
  background: #e0f2fe;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.staff-select-card.selected .staff-card-name {
  color: var(--primary-hover);
}

.staff-select-card.disabled {
  background: #f1f5f9;
  border-color: #e2e8f0;
  opacity: 0.6;
  cursor: not-allowed;
}

.staff-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.staff-select-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

.staff-disabled-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: #cbd5e1;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
}

.staff-check-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
}

.staff-check-icon svg {
  width: 18px;
  height: 18px;
}

.staff-empty-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 16px;
  background: #f8fafc;
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-sub);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.staff-empty-box i,
.staff-empty-box svg {
  width: 32px;
  height: 32px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.staff-empty-box p {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.staff-empty-box span {
  font-size: 0.78rem;
  color: var(--text-sub);
}

/* Staff Modal Footer */
.staff-modal-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
}

.btn-outline-danger {
  border: 1px solid #fca5a5;
  background: #fff;
  color: #dc2626;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-outline-danger:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  transition: color 0.15s;
}

.btn-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* 3-B: Staff Master Management Styles */
.staff-master-sheet {
  max-width: 480px;
}

.staff-add-section {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.staff-input-row {
  display: flex;
  gap: 8px;
}

.staff-name-input {
  flex: 1;
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
}

.staff-name-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.staff-master-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.staff-master-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 12px;
  transition: all 0.15s;
}

.staff-master-row:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.staff-master-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.staff-master-name i {
  color: var(--text-sub);
  width: 16px;
  height: 16px;
}

.staff-master-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.staff-action-btn {
  border: none;
  background: transparent;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.staff-action-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.staff-action-btn.delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

.staff-action-btn svg {
  width: 16px;
  height: 16px;
}

.staff-master-footer {
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

/* ============================================== */
/* Data File Manager Modal (月別データファイル管理) */
/* ============================================== */
.data-manager-sheet {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.data-tree-preview {
  background: #0f172a;
  color: #38bdf8;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  border: 1px solid #1e293b;
}

.data-tree-preview .tree-folder {
  color: #fbbf24;
  font-weight: 700;
}

.data-tree-preview .tree-file {
  color: #a7f3d0;
}

.data-month-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.data-month-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: all 0.15s ease;
}

.data-month-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.data-month-card.current-month {
  border-color: #7dd3fc;
  background: #f0f9ff;
}

.month-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.month-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.month-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.month-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-file-dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-file-excel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-file-excel:hover {
  background: #047857;
  transform: translateY(-1px);
}

/* ==========================================================================
   リアルタイム同期バッジ (Live Sync Status Indicator)
   ========================================================================== */
.sync-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-full);
  color: #065f46;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.sync-live-badge:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  transform: translateY(-1px);
}

.sync-dot {
  width: 9px;
  height: 9px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sync-live-badge.saving {
  background: rgba(2, 132, 199, 0.12);
  border-color: rgba(2, 132, 199, 0.35);
  color: #0369a1;
}

.sync-live-badge.saving .sync-dot {
  background: #0284c7;
  animation: pulse-blue 1s infinite;
}

.sync-live-badge.offline {
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(100, 116, 139, 0.35);
  color: #475569;
}

.sync-live-badge.offline .sync-dot {
  background: #94a3b8;
  animation: none;
}

.sync-clients-badge {
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 800;
  color: #0f172a;
}

.btn-settings-main {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
  font-weight: 700 !important;
}

.btn-settings-main:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   総合「設定・管理」ハブモーダル (Settings & Admin Hub Modal)
   ========================================================================== */
.settings-hub-sheet {
  background: #ffffff;
  width: 94%;
  max-width: 900px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-hub-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
}

.settings-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-header-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-title-wrap h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
}

.settings-header-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  display: block;
}

.settings-tabs-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  padding: 4px 6px 0 6px;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
}

.settings-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 2px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-height: 48px;
  width: 100%;
  box-sizing: border-box;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.settings-tab-btn:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.settings-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--border-light);
  border-bottom-color: #ffffff;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.04);
}

.settings-tab-btn i,
.settings-tab-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .settings-tabs-nav {
    padding: 6px 12px 0 12px;
    gap: 6px;
  }
  .settings-tab-btn {
    flex-direction: row;
    gap: 7px;
    font-size: 0.86rem;
    padding: 10px 8px;
  }
  .settings-tab-btn i,
  .settings-tab-btn svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 380px) {
  .settings-tabs-nav {
    padding: 2px 2px 0 2px;
    gap: 2px;
  }
  .settings-tab-btn {
    padding: 6px 1px;
    font-size: 0.70rem;
    gap: 2px;
  }
  .settings-tab-btn i,
  .settings-tab-btn svg {
    width: 15px;
    height: 15px;
  }
}

.settings-hub-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  background: #f8fafc;
}

.settings-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.settings-panel.active {
  display: flex;
}

.settings-section-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.card-head-title i {
  color: var(--primary);
}

.settings-card-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-chip.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.status-chip.warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* DATA SAVE Form */
.data-path-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.data-path-input-group {
  display: flex;
  gap: 10px;
}

.path-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.input-folder-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

.setting-text-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: #f8fafc;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}

.setting-text-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.path-guide-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tree-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 夜間タイマー初期値マスタ Grid */
.night-master-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.night-master-card {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.night-master-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.night-master-inputs-row {
  display: flex;
  gap: 10px;
}

.night-input-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.night-input-box label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.night-sec-input {
  padding: 6px 8px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  background: #fff;
  outline: none;
}

.night-sec-input:focus {
  border-color: #0284c7;
}

.night-sec-select {
  padding: 6px 8px;
  border: 1.5px solid var(--border-light);
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.night-sec-select:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

/* スマホ接続パネル */
.phone-connect-content {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: center;
}

@media (max-width: 640px) {
  .phone-connect-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.qr-code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.qr-svg-wrapper {
  width: 170px;
  height: 170px;
  padding: 10px;
  background: #ffffff;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-sub-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.phone-connect-instructions h4 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-main);
}

.connect-steps-list {
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 14px;
}

.mobile-url-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.url-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.url-item-tag {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
  margin-right: 6px;
}

.btn-copy-url {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-main);
}

.btn-copy-url:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* 同期情報 Grid */
.sync-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.sync-stat-box {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-box-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 700;
}

.stat-box-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.settings-hub-footer {
  padding: 12px 20px;
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   トースト通知 (Toast Notifications)
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
  pointer-events: none;
}

.toast-item {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

.toast-item.info i {
  color: #38bdf8;
}

.toast-item.success i {
  color: #34d399;
}

.toast-item.warning i {
  color: #fbbf24;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Mobile Safe-Area Adjustments */
@supports (padding: max(0px)) {
  body {
    padding-bottom: max(60px, env(safe-area-inset-bottom) + 30px);
  }
}

/* ==========================================================================
   Print Styles: Form Matching Original Excel A4 Layout
   ========================================================================== */
@media print {
  body {
    background: #fff !important;
    padding: 0 !important;
    color: #000 !important;
    font-size: 9pt !important;
  }

  .app-container {
    max-width: 100% !important;
    padding: 0 !important;
    gap: 8px !important;
  }

  .app-header, .header-actions, .view-control-bar, .modal-overlay, .tab-switch, .action-buttons {
    display: none !important;
  }

  .info-bar-container {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    border: 1px solid #000 !important;
    padding: 4px !important;
    gap: 4px !important;
    box-shadow: none !important;
  }

  .info-card {
    border: none !important;
    box-shadow: none !important;
    padding: 2px !important;
  }

  .attraction-card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .data-table {
    border: 1px solid #000 !important;
  }

  .data-table th, .data-table td {
    border: 1px solid #000 !important;
    color: #000 !important;
    background: #fff !important;
  }
}
