/* Night Shift — Focus on Energy branding (see focus_branding.md in smarty).
   Layout mirrors the retired Retool app; colors/typography follow the 2026
   brand guide: Inter, General Blue primary, straight edges, no shadows. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --foe-general-blue: #034ea2;
  --foe-general-green: #00ab4e;
  --foe-business: #0072bc;
  --foe-business-2: #e0f3fd;
  --foe-umbrella-2: #b7e4ea;
  --foe-umbrella-3: #11696e;
  --foe-residential-2: #deecc6;
  --foe-residential-4: #06532a;
  --foe-body-text: #3c3c3c;
  --border: #e0e0e0;
  --row-hover: #f5f7f9;
  --row-selected: #e5f3ea;
  --font-family: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--foe-body-text);
  background: #fff;
  font-size: 14px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 3px solid var(--foe-general-blue);
}
.app-header .logo { height: 40px; }
.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--foe-general-blue);
  margin: 0;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
}
.tab {
  border: none;
  background: none;
  font-family: var(--font-family);
  font-size: 15px;
  color: #6b7280;
  padding: 8px 14px;
  cursor: pointer;
}
.tab.active {
  background: var(--foe-residential-2);
  color: var(--foe-residential-4);
  font-weight: 600;
}

main { padding: 16px 24px 48px; }
.panel { display: none; }
.panel.active { display: block; }

/* Search */
.search-row { margin-bottom: 12px; }
#task-search {
  width: 100%;
  max-width: 820px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-family);
  font-size: 14px;
}
#task-search:focus { outline: 2px solid var(--foe-business); border-color: transparent; }

/* Card + toolbar */
.card { border: 1px solid var(--border); background: #fff; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.tool {
  border: none;
  background: none;
  font-family: var(--font-family);
  font-size: 13px;
  color: #4b5563;
  padding: 6px 10px;
  cursor: pointer;
}
.tool:hover { background: var(--foe-business-2); color: var(--foe-general-blue); }
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.filter-row.hidden { display: none; }

/* Tables */
.table-wrap { overflow-x: auto; max-height: 65vh; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  position: sticky;
  top: 0;
  background: #fff;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
}
th.num, td.num { text-align: right; }
tbody tr:hover { background: var(--row-hover); }
tbody tr.selected { background: var(--row-selected); }
.table-footer {
  padding: 8px 14px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  border-top: 1px solid var(--border);
}

/* Daily stats layout */
.daily-layout { display: flex; gap: 32px; align-items: flex-start; }
.daily-main { flex: 0 1 720px; }
.daily-controls {
  display: flex;
  align-items: center;
  gap: 140px;
  margin-bottom: 12px;
}
.daily-controls select {
  min-width: 320px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  font-family: var(--font-family);
}
.stat-card { padding-top: 24px; min-width: 240px; }
.stat-title { font-weight: 600; font-size: 14px; }
.stat-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.stat-value { font-size: 32px; font-weight: 700; color: #111; }
.stat-delta {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
}
.stat-delta.up { color: var(--foe-residential-4); background: var(--foe-residential-2); }
.stat-delta.down { color: #8d3a1e; background: #fcd58f; }
.stat-sub { color: #9ca3af; font-size: 12px; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  z-index: 50;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: #fff;
  width: 100%;
  max-width: 880px;
  padding: 24px 28px;
}
.modal h2 {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--foe-general-blue);
}
.section-heading {
  font-size: 15px;
  font-weight: 700;
  margin: 20px 0 8px;
}
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 500; }
.field input, .field select, .field textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  font-family: var(--font-family);
  font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--foe-business);
  border-color: transparent;
}
.field textarea {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 13px;
  background: #1f2428;
  color: #e6edf3;
  min-height: 140px;
}
.tooltip-hint {
  font-size: 12px;
  color: #6b7280;
  background: #f9fafb;
  border: 1px solid var(--border);
  padding: 6px 10px;
  min-height: 16px;
}
.tooltip-hint:empty { display: none; }
.field.arg { display: none; }
.field.arg.visible { display: flex; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}
.foe-btn-primary {
  background: var(--foe-business);
  color: #fff;
  padding: 13px 24px;
  border: none;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
}
.foe-btn-secondary {
  background: var(--foe-umbrella-2);
  color: var(--foe-general-blue);
  padding: 13px 24px;
  border: none;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--foe-general-blue);
  color: #fff;
  padding: 12px 20px;
  font-size: 14px;
  z-index: 100;
}
.toast.error { background: #8d3a1e; }
.toast.hidden { display: none; }
.hidden { display: none; }
