/* ============================================================
  Meezan Load Balancer - Professional Dashboard Styles
  ============================================================ */

:root {
  --bg: #0f1923;
  --bg-card: #1a2634;
  --bg-card-alt: #1e2d3d;
  --bg-input: #253545;
  --border: #2a3a4a;
  --text: #e0e6ed;
  --text-muted: #7a8a9a;
  --text-dim: #5a6a7a;
  --accent: #00b4d8;
  --accent-dim: rgba(0,180,216,0.15);
  --green: #00e676;
  --green-dim: rgba(0,230,118,0.15);
  --red: #ff5252;
  --red-dim: rgba(255,82,82,0.15);
  --orange: #ff9800;
  --orange-dim: rgba(255,152,0,0.15);
  --blue: #448aff;
  --blue-dim: rgba(68,138,255,0.15);
  --purple: #b388ff;
  --purple-dim: rgba(179,136,255,0.15);
  --peak-color: #ff6b35;
  --offpeak-color: #00e676;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ---- Header ---- */
.header {
  background: linear-gradient(135deg, #0d1b2a 0%, #1b2838 50%, #0d1b2a 100%);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.header-left h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.header-left h1 span { color: var(--accent); }
.header-left .subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.header-center { text-align: center; }
.live-clock { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.live-date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.live-clock .seconds { font-size: 18px; color: var(--text-muted); }

.header-right { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.disconnected { background: var(--red); box-shadow: 0 0 6px var(--red); }
.device-count { background: var(--accent-dim); color: var(--accent); padding: 4px 12px; border-radius: 20px; font-weight: 600; }

/* ---- Peak/Off-Peak Banner ---- */
.peak-banner {
  padding: 10px 24px;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.peak-banner.offpeak { background: var(--green-dim); color: var(--offpeak-color); }
.peak-banner.peak { background: rgba(255,107,53,0.12); color: var(--peak-color); }
.peak-banner .peak-icon { font-size: 18px; }
.peak-banner .peak-time { color: var(--text-muted); font-weight: 400; }

/* ---- App Status ---- */
.app-status {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 760px);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  z-index: 3500;
  box-shadow: var(--shadow);
  pointer-events: auto;
  padding-right: 38px;
}
.app-status.info { background: var(--blue-dim); color: var(--blue); border-color: var(--blue); }
.app-status.success { background: var(--green-dim); color: var(--green); border-color: var(--green); }
.app-status.error { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.app-status-close {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}
.app-status-close:hover {
  opacity: 1;
}

/* ---- In-App Dialog ---- */
.app-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 16px;
}
.app-dialog {
  width: min(520px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.app-dialog-header {
  background: linear-gradient(135deg, #1e2d3d, #253545);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}
.app-dialog-header h3 {
  font-size: 15px;
  font-weight: 700;
}
.app-dialog-body {
  padding: 14px 16px;
  color: var(--text);
  white-space: pre-line;
  line-height: 1.45;
}
.app-dialog-body input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
}
.app-dialog-body input:focus {
  outline: none;
  border-color: var(--accent);
}
.app-dialog-actions {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- Layout ---- */
.container { max-width: 1440px; margin: 0 auto; padding: 20px 16px; }
.no-devices {
  text-align: center; padding: 80px 20px; color: var(--text-dim); font-size: 16px;
  background: var(--bg-card); border-radius: var(--radius); border: 1px dashed var(--border);
}

/* ---- Section Titles ---- */
.section-title {
  font-size: 15px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.section-title .badge {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  font-weight: 600; text-transform: none; letter-spacing: 0;
}
.badge.mode-auto { background: var(--green-dim); color: var(--green); }
.badge.mode-manual { background: var(--orange-dim); color: var(--orange); }

/* ---- Device Section ---- */
.device-section {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  margin-bottom: 20px; overflow: hidden;
}
.device-header {
  background: linear-gradient(135deg, #1e2d3d, #253545);
  padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
}
.device-header h2 { font-size: 16px; font-weight: 700; }
.device-header h2 span { color: var(--accent); font-weight: 400; }
.device-info { font-size: 12px; color: var(--text-muted); display: flex; gap: 12px; }
.device-info .info-tag { background: var(--bg); padding: 3px 10px; border-radius: 4px; }
.device-body { padding: 20px; }

/* ---- Message Box ---- */
.msg-box {
  background: var(--green-dim); border-left: 3px solid var(--green);
  padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--green);
}

/* ---- System Info Tags ---- */
.system-info { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.system-info .tag {
  background: var(--bg); padding: 6px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--border);
}
.system-info .tag.mode-tag { color: var(--accent); border-color: var(--accent); }
.system-info .tag.meter-tag { color: var(--green); border-color: var(--green); }
.system-info .tag.warn { color: var(--orange); border-color: var(--orange); }
.system-info .tag.ok { color: var(--green); border-color: var(--green); }

/* ---- Meters Grid ---- */
.meters-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

/* ---- Meter Card ---- */
.meter-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  transition: border-color 0.3s;
}
.meter-card.on { border-color: var(--green); }
.meter-card.standby { border-color: var(--orange); }

.meter-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.meter-card-header h3 { font-size: 15px; font-weight: 700; }
.meter-card-header .meter-label { font-size: 11px; color: var(--text-muted); display: block; margin-top: 2px; }

/* ---- Status Badge ---- */
.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.status-badge.on { background: var(--green-dim); color: var(--green); }
.status-badge.off { background: rgba(100,120,140,0.2); color: var(--text-dim); }
.status-badge.standby { background: var(--orange-dim); color: var(--orange); }

/* ---- Energy Display ---- */
.energy-display {
  font-size: 36px; font-weight: 800; text-align: center;
  background: var(--bg-card); padding: 18px; border-radius: var(--radius-sm);
  margin-bottom: 14px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
}
.energy-display .unit { font-size: 14px; color: var(--text-muted); font-weight: 400; }

/* ---- Readings Grid ---- */
.readings { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.reading {
  background: var(--bg-card); padding: 8px 10px; border-radius: var(--radius-sm);
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid transparent;
}
.reading .label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.reading .value { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.reading .value.voltage { color: var(--green); }
.reading .value.watt { color: var(--blue); }
.reading .value.ampere { color: var(--red); }
.reading .value.units { color: var(--orange); }
.reading .value.pf { color: var(--purple); }

/* ---- Meter Settings ---- */
.meter-settings {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.meter-settings-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 10px;
}
.meter-settings label {
  font-size: 10px; color: var(--text-muted); display: block; margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.meter-settings input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  background: var(--bg-input); color: var(--text);
  transition: border-color 0.2s;
}
.meter-settings input:focus { outline: none; border-color: var(--accent); }
.meter-settings-btns { display: flex; gap: 6px; }
.meter-settings-btns .btn { flex: 1; }

.meter-card-actions {
  margin-top: 10px;
  display: flex;
}
.meter-card-actions .btn {
  width: 100%;
}

/* ---- Controls ---- */
.controls {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* ---- Buttons ---- */
.btn {
  padding: 8px 16px; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px; font-weight: 700; color: white;
  transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.5px;
}
.btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.green, .btn.auto { background: var(--green); color: #000; }
.btn.blue, .btn.meter { background: var(--blue); }
.btn.red, .btn.off { background: var(--red); }
.btn.orange, .btn.restart { background: var(--orange); color: #000; }
.btn.accent { 
  background: var(--accent); 
  color: #fff; 
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
}
.btn.accent:hover { 
  background: #00caef; 
  box-shadow: 0 6px 18px rgba(0, 180, 216, 0.4);
}
.btn.muted { background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border); }
.btn.save { background: var(--green); color: #000; }
.btn.reset { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); }
.btn.sm { padding: 4px 10px; font-size: 11px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.last-update { font-size: 11px; color: var(--text-dim); margin-top: 12px; text-align: right; }

/* ---- Panels (Schedule, Config) ---- */
.panel {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  margin-bottom: 20px; overflow: hidden;
}
.panel-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, #1e2d3d, #253545);
}
.panel-header h3 { font-size: 15px; font-weight: 700; }
.panel-body { padding: 20px; }

/* ---- Schedule Status ---- */
.schedule-status-bar {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.status-card {
  background: var(--bg-card); 
  border: 1px solid var(--border); 
  border-radius: var(--radius);
  padding: 18px 20px; 
  flex: 1; 
  min-width: 220px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.status-card:hover { transform: translateY(-2px); }
.status-card .status-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
.status-card .status-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.status-card .status-value.green { color: var(--green); }
.status-card .status-value.orange { color: var(--orange); }
.status-card .status-value.red { color: var(--red); }
.status-card .status-value.accent { color: var(--accent); }

/* ---- Mode Tabs ---- */
.mode-tabs { display: flex; gap: 0; margin-bottom: 20px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.mode-tab {
  flex: 1; padding: 10px 16px; text-align: center; cursor: pointer;
  font-size: 13px; font-weight: 600; background: var(--bg);
  color: var(--text-muted); transition: all 0.2s; border: none;
}
.mode-tab:hover { background: var(--bg-input); }
.mode-tab.active { background: var(--accent); color: #000; }

/* ---- Config Grid ---- */
.config-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.config-item { }
.config-item label {
  font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.config-item select, .config-item input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  background: var(--bg-input); color: var(--text);
}
.config-item select:focus, .config-item input:focus { outline: none; border-color: var(--accent); }

/* ---- Peak Windows Table ---- */
.peak-windows-table {
  width: 100%; border-collapse: collapse; margin-bottom: 16px;
  font-size: 13px;
}
.peak-windows-table th {
  background: var(--bg); padding: 8px 12px; text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.peak-windows-table td {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.peak-windows-table tr.active-row { background: var(--accent-dim); }
.peak-windows-table input {
  width: 100%; padding: 5px 8px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 12px;
  background: var(--bg-input); color: var(--text);
}
.peak-windows-table input:focus { outline: none; border-color: var(--accent); }

/* ---- Schedule Entries ---- */
.schedule-entry-form {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 16px;
}
.schedule-entry-form-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px; align-items: end;
}
/* Dashboard Layout Fix for Sticky Footer */
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex !important;
  flex-direction: column !important;
  background: var(--bg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  overflow-x: hidden;
}

.header, .peak-banner { flex-shrink: 0; }

.main-body {
  flex: 1 0 auto;
  width: 100%;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px;
  width: 100%;
  box-sizing: border-box;
}

.footer-wrapper {
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
}
.schedule-entries-list { display: flex; flex-direction: column; gap: 6px; }
.schedule-entry {
  background: var(--bg); border: 1px solid var(--border); padding: 10px 14px;
  border-radius: var(--radius-sm); display: flex; justify-content: space-between; align-items: center;
}
.schedule-entry .entry-time { font-weight: 700; font-size: 15px; color: var(--accent); }
.schedule-entry .entry-meter { color: var(--text-muted); font-size: 13px; }
.schedule-entry.active-entry { border-color: var(--green); background: var(--green-dim); }
.schedule-entry.active-entry .entry-time { color: var(--green); }

.empty-state { padding: 20px; text-align: center; color: var(--text-dim); font-size: 13px; }

/* ---- History ---- */
.history-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-toolbar select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 12px;
}
.history-toolbar input[type="datetime-local"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 12px;
}
.history-toolbar input[type="datetime-local"]:focus,
.history-toolbar select:focus {
  outline: none;
  border-color: var(--accent);
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.history-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.history-item.info { border-left-color: var(--blue); }
.history-item.success { border-left-color: var(--green); }
.history-item.warn { border-left-color: var(--orange); }
.history-item.error { border-left-color: var(--red); }
.history-item.command { border-left-color: var(--accent); }
.history-item.response { border-left-color: var(--purple); }
.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.history-meta-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.history-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.history-msg {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}
.history-line {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}
.history-sections {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.history-section {
  border: 1px solid rgba(0,180,216,0.3);
  border-radius: 6px;
  padding: 10px;
  background: rgba(0,180,216,0.05);
}
.history-section-title {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,180,216,0.15);
}
.history-kv-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.history-kv-row {
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr;
  gap: 10px;
  font-size: 12px;
  align-items: flex-start;
}
.history-k {
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-v {
  color: var(--text);
  word-break: break-word;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* ---- Divider ---- */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---- Advanced History Page & Highlights ---- */
.is-history-page .history-list {
  max-height: none;
  overflow: visible;
}
.history-item.highlight-session {
  border-left-color: var(--purple);
  background: linear-gradient(to right, var(--purple-dim), transparent);
  border-left-width: 6px;
}
.history-item.highlight-success {
  border-left-color: var(--green);
  background: linear-gradient(to right, var(--green-dim), transparent);
  border-left-width: 6px;
}
.history-item.highlight-error {
  border-left-color: var(--red);
  background: linear-gradient(to right, var(--red-dim), transparent);
  border-left-width: 6px;
}

/* Source specific chips */
.history-meta-chip.s-esp { color: var(--purple); border-color: var(--purple); }
.history-meta-chip.s-session { color: var(--green); border-color: var(--green); font-weight: 700; }
.history-meta-chip.s-server { color: var(--blue); border-color: var(--blue); }
.history-meta-chip.s-api { color: var(--orange); border-color: var(--orange); }
.history-meta-chip.s-sync { color: var(--accent); border-color: var(--accent); }

/* Step specific chips */
.history-meta-chip.st-meter_session_closed { background: var(--purple); color: #fff; border-color: var(--purple); }
.history-meta-chip.st-command_success { background: var(--green); color: #000; border-color: var(--green); }
.history-meta-chip.st-command_timeout { background: var(--red); color: #fff; border-color: var(--red); }

.history-time-stamp {
  font-family: monospace;
  background: var(--bg-card-alt);
  padding: 1px 6px;
  border-radius: 4px;
}

code {
  font-family: 'Consolas', 'Monaco', monospace;
  background: var(--bg-card-alt);
  color: var(--accent);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Changed value highlight in audit logs */
.history-v.is-changed {
  color: var(--orange);
  font-weight: 700;
  background: var(--orange-dim);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,152,0,0.3);
}

/* History Page Responsive */
@media (max-width: 900px) {
  body.is-history-page {
    height: auto;
    overflow-y: auto;
  }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .header { flex-direction: column; text-align: center; }
  .meters-grid { grid-template-columns: 1fr; }
  .config-grid { grid-template-columns: 1fr; }
  .schedule-entry-form-grid { grid-template-columns: 1fr 1fr; }
  .meter-settings-grid { grid-template-columns: 1fr; }
  .peak-windows-table { font-size: 11px; }
  .peak-windows-table th, .peak-windows-table td { padding: 6px 8px; }
  .history-toolbar { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .history-toolbar input[type="datetime-local"] { width: 100%; }
}
@media (max-width: 480px) {
  .readings { grid-template-columns: 1fr; }
  .schedule-entry-form-grid { grid-template-columns: 1fr; }
  .schedule-status-bar { flex-direction: column; }
  .header-center .live-clock { font-size: 22px; }
  .meter-card-actions .btn,
  .controls .btn {
    width: 100%;
  }
}

/* ---- Footer Branding ---- */
.footer {
  width: 100%;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  letter-spacing: 0.5px;
  line-height: 1.8;
  margin-top: auto;
}
.footer p { margin: 0; width: 100%; text-align: center; }
.footer span { color: var(--accent); font-weight: 600; }

/* ---- Compact History (Dashboard) ---- */
.history-row.compact {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  gap: 10px;
  transition: background 0.2s;
}
.history-row.compact:hover { background: rgba(255,255,255,0.02); }
.history-row.compact .history-time { font-family: monospace; opacity: 0.7; min-width: 75px; flex-shrink: 0; }
.history-row.compact .history-msg { 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  flex: 1; 
  color: var(--text);
}
