/* Modern, clean, light-theme styling for AC Control System */
:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --border: #e2e8f0;
  --border-focus: #38bdf8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  line-height: 1.5;
  min-height: 100vh;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* Header */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

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

.brand-icon {
  font-size: 26px;
  background: var(--primary-light);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.brand-titles h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.brand-titles .subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
  background: none;
}

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

.nav-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Zmanim Banner */
.zmanim-banner {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.zmanim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid #bae6fd;
  padding-bottom: 8px;
}

.hebrew-date {
  font-size: 15px;
  font-weight: 700;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-tag {
  font-size: 12px;
  color: #0284c7;
  background: #ffffff;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid #bae6fd;
}

.zmanim-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.zman-item {
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  border: 1px solid #e0f2fe;
  display: flex;
  flex-direction: column;
}

.zman-name {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.zman-time {
  font-size: 16px;
  font-weight: 700;
  color: #0369a1;
}

/* Quick Bar / System Mode */
.quick-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

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

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
}

.mode-cool {
  background: #e0f2fe;
  color: #0284c7;
}

.mode-heat {
  background: #ffedd5;
  color: #ea580c;
}

.btn-switch-mode {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.15s;
}

.btn-switch-mode:hover {
  background: var(--bg-main);
  border-color: var(--text-muted);
}

.batch-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
}

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

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

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

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

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-main);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* AC Units Grid */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

/* AC Unit Card */
.unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

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

.unit-card.is-on {
  border-color: #bae6fd;
  background: #ffffff;
}

.unit-card.is-off {
  background: #fafafa;
  opacity: 0.9;
}

.unit-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.unit-title-area {
  display: flex;
  flex-direction: column;
}

.unit-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.unit-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-edit-nick {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px;
  font-size: 14px;
  transition: color 0.15s;
}

.btn-edit-nick:hover {
  color: var(--primary);
}

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

.badge-on {
  background: var(--success-light);
  color: #065f46;
}

.badge-off {
  background: #f1f5f9;
  color: var(--text-muted);
}

/* Unit Temperatures */
.unit-temps {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.temp-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.temp-label {
  font-size: 11px;
  color: var(--text-muted);
}

.temp-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
}

.temp-val.target {
  color: var(--primary);
}

/* Unit Controls */
.unit-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-power {
  flex: 1;
}

.temp-adjuster {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-temp-step {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
}

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

/* Responsive Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 0;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  margin-bottom: 0;
  background: #ffffff;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
}

.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  flex-shrink: 0;
  margin-top: 0;
}

/* Day Selector Pills */
.day-pills-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.day-pill {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  transition: all 0.15s;
  user-select: none;
}

.day-pill:hover {
  background: var(--bg-main);
  border-color: var(--primary);
}

.day-pill.selected {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.day-pill.is-shabbat.selected {
  background: #ea580c;
  border-color: #ea580c;
}

.chip-select-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}

.chip-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chip-btn.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Action Builder Rows */
.action-builder-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-main);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

/* Weekly 7-Day Calendar Grid */
.weekly-calendar-container {
  overflow-x: auto;
  margin-bottom: 30px;
  padding-bottom: 8px;
}

.weekly-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 12px;
  min-width: 1050px;
}

.day-column {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-height: 480px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}

.day-column.is-today {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px #bae6fd;
}

.day-column.is-shabbat {
  background: #fffbf5;
  border-color: #fed7aa;
}

.day-column.is-holiday {
  background: #fdf4ff;
  border-color: #f0abfc;
}

.day-column-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.day-column.is-shabbat .day-column-header {
  background: #ffedd5;
  color: #9a3412;
}

.day-column.is-holiday .day-column-header {
  background: #fae8ff;
  color: #86198f;
}

.today-indicator {
  font-size: 10px;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

.timeline-holiday-badge {
  display: block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  margin-top: 4px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-holiday-badge.badge-chag {
  background: #fdf2f8;
  color: #be185d;
  border: 1px solid #fbcfe8;
}

.timeline-holiday-badge.badge-shabbat {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.timeline-holiday-badge.badge-erev {
  background: #fefce8;
  color: #a16207;
  border: 1px solid #fef08a;
}

.timeline-holiday-badge.badge-chol-hamoed {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.day-date-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.day-column-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.day-empty-hint {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  margin: auto 0;
  padding: 20px 8px;
}

.schedule-event-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  position: relative;
  border-right: 4px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.schedule-event-card.action-on {
  border-right-color: #10b981;
  background: #f0fdf4;
}

.schedule-event-card.action-off {
  border-right-color: #ef4444;
  background: #fef2f2;
}

.schedule-event-card.action-temp {
  border-right-color: #0284c7;
  background: #f0f9ff;
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.event-time {
  font-weight: 800;
  font-size: 13px;
  color: var(--text-main);
}

.event-action-badge {
  font-weight: 700;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
}

.badge-act-on { background: #d1fae5; color: #065f46; }
.badge-act-off { background: #fee2e2; color: #991b1b; }
.badge-act-temp { background: #e0f2fe; color: #0369a1; }

.event-details {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-del-event {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 12px;
  padding: 2px;
}

.btn-del-event:hover {
  color: var(--danger);
}

.event-actions-group {
  display: flex;
  gap: 2px;
  align-items: center;
}

.btn-edit-event {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-edit-event:hover {
  color: var(--primary);
  background: #e0f2fe;
}

/* Weekly Visual 24h Timeline Bar */
.day-timeline-wrap {
  margin-bottom: 8px;
  background: #f8fafc;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
}

.day-timeline-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-timeline-bar {
  display: flex;
  height: 32px;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}

.timeline-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 11px;
  font-weight: 800;
  transition: filter 0.15s;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
}

.timeline-segment:hover {
  filter: brightness(1.1);
  z-index: 2;
}

.timeline-segment.segment-on {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  border-left: 1px solid rgba(255,255,255,0.25);
  border-right: 1px solid rgba(0,0,0,0.1);
}

.timeline-segment.segment-off {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  opacity: 0.88;
  border-left: 1px solid rgba(255,255,255,0.2);
  border-right: 1px solid rgba(0,0,0,0.1);
}

.timeline-segment.segment-empty {
  background: #f1f5f9;
  color: var(--text-light);
  font-size: 10px;
  font-weight: 500;
}

.timeline-hour-markers {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-light);
  margin-top: 3px;
  padding: 0 2px;
  font-weight: 600;
}

.day-intervals-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}

.day-interval-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.interval-chip-on {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.interval-chip-off {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.day-rules-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 6px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Dashboard View Switch Controls */
.view-switch-tabs {
  display: inline-flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 3px;
}

.view-switch-btn {
  border: none;
  background: transparent;
  padding: 5px 12px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.view-switch-btn:hover {
  color: var(--text-main);
}

.view-switch-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Dashboard Group Cards */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.group-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

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

.group-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.group-units-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.unit-mini-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.unit-mini-chip.is-on {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
  font-weight: 700;
}

/* Holiday Timeline Cards */
.holiday-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

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

.holiday-name {
  font-size: 16px;
  font-weight: 700;
  color: #0369a1;
}

.holiday-timelines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.holiday-phase-box {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.phase-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Override Dashboard Banner / Widget */
.override-active-card {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.form-input, .form-select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-main);
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  width: 100%;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* Tabs */
.tabs-nav {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab-btn {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}

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

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Table */
.data-table-container {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 14px;
}

.data-table th {
  background: var(--bg-main);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

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

.data-table tr:last-child td {
  border-bottom: none;
}

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

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s ease-out;
}

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

/* Simulator & Time-Travel Bar */
.simulator-panel {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.simulator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

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

.badge-sim-active {
  background: #f59e0b;
  color: #ffffff;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-sim-real {
  background: #10b981;
  color: #ffffff;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.simulator-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #fde68a;
}

.scenario-btn {
  background: #ffffff;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.scenario-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
}

/* Season Master Switcher */
.season-master-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.season-badge {
  font-size: 13px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.season-badge.season-winter {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* Schedule Profiles Bar */
.profile-selector-bar {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.profile-current-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.profile-select {
  font-weight: 700;
  font-size: 13px;
  min-width: 170px;
  padding: 6px 12px;
}

.badge-active-profile {
  background: #10b981;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.profile-actions-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Mode Pills & Badges for Heating / Cooling Verification */
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.mode-pill-cool {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.mode-pill-heat {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.badge-heat {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.badge-cool {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.unit-card.is-on-heat {
  border-right: 4px solid #f97316;
  border-color: #fed7aa;
}

.unit-card.is-on-cool {
  border-right: 4px solid #0284c7;
  border-color: #bae6fd;
}

.group-card.is-on-heat {
  border-right: 4px solid #f97316;
  border-color: #fed7aa;
}

.group-card.is-on-cool {
  border-right: 4px solid #0284c7;
  border-color: #bae6fd;
}

.unit-mini-chip.is-on-heat {
  background: #ffedd5;
  border-color: #fed7aa;
  color: #c2410c;
  font-weight: 700;
}

.unit-mini-chip.is-on-cool {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
  font-weight: 700;
}

#schedule-builder-modal .modal-card {
  max-width: 820px;
}

/* Responsive */
@media (max-width: 640px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .nav-links {
    width: 100%;
    justify-content: space-around;
  }
  .quick-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .batch-controls {
    justify-content: space-between;
  }
}

