/* Minimal styling for the auth step. Replace/extend in later UI steps. */
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 0; color: #1a1a1a; background: #f4f5f7; }
.topbar { display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 1rem; background: #14532d; color: #fff; }
.topbar .brand { font-weight: 600; }
.topbar-right { display: flex; gap: 0.75rem; align-items: center; }
.topbar-right a { color: #d1fae5; text-decoration: none; }
.topbar-right a.active { color: #fff; font-weight: 700; text-decoration: underline; }
.topbar-right .who { opacity: 0.9; }
/* Portal header: SS logo (left) | SmartGreen + title (centre) | controls (right).
   topbar is flex+align-items:center; the centre group flex:1 fills the middle so
   the title is centred and the controls hug the right edge. */
.brand-logo { display: inline-flex; align-items: center; flex: 0 0 auto; }
.brand-logo img { width: auto; max-width: 200px; display: block; }
.brand-logo-left img { height: 64px; }                 /* SunService — prominent */
.brand-group { flex: 1 1 auto; min-width: 0; display: flex; align-items: center;
  justify-content: center; gap: 0.6rem; }
.brand-group .brand-logo img { height: 40px; }         /* SmartGreen — beside title */
.topbar-right { flex: 0 0 auto; }                      /* controls at the far right */
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; gap: 0.5rem; }
  .brand-logo-left img { height: 44px; }
  .brand-group { flex-basis: 100%; order: 3; }         /* title row wraps below logos */
  .brand-group .brand-logo img { height: 30px; }
}
form.inline { display: inline; margin: 0; }
.content { display: flex; justify-content: center; padding: 2rem 1rem; }
.card { background: #fff; border-radius: 8px; padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1); width: 100%; max-width: 360px; }
.card h1 { margin-top: 0; font-size: 1.25rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 0.2rem; }
.stack input { padding: 0.5rem; border: 1px solid #cbd5e1; border-radius: 4px; }
button { padding: 0.5rem 0.9rem; border: 0; border-radius: 4px;
  background: #14532d; color: #fff; cursor: pointer; }
.error { color: #b91c1c; }
.success { color: #15803d; }
.notice { color: #92400e; }
/* Embedded Grafana kiosk dashboard — full-bleed, no card. */
.content:has(.dash-page) { display: block; max-width: none; padding: 1rem; }
.dash-page h1 { margin-top: 0; font-size: 1.25rem; }
.dash-page .notice { margin: 0.25rem 0 0.75rem; }
.gf-frame { display: block; margin: 0; }
.gf-frame iframe {
    display: block;
    width: 100%;
    height: calc(100vh - 150px);
    min-height: 480px;
    border: 0;
    border-radius: 4px;
}
/* Customer device web-UI buttons (open the /device proxy in a new tab). */
.device-section { margin: 1rem 0 0.5rem; }
.device-section h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.device-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.device-btn { display: inline-block; padding: 0.5rem 1rem; border-radius: 4px;
  background: #14532d; color: #fff; text-decoration: none; font-size: 0.95rem; }
.device-btn:hover { background: #1a6b3a; }
/* Greyed device button (admin report): the site has no row of that kind.
   Non-clickable, same footprint as an active button (never a dead link). */
.device-cell { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.device-btn.is-disabled { background: #9ca3af; cursor: not-allowed; pointer-events: none; }

/* Customer multi-site picker (tabs that switch the embedded uid). */
.site-tabs { display: flex; gap: 0.5rem; margin: 0 0 0.75rem; flex-wrap: wrap; }
.site-tabs a { padding: 0.3rem 0.7rem; border: 1px solid #cbd5e1; border-radius: 4px;
  text-decoration: none; color: #14532d; background: #fff; font-size: 0.9rem; }
.site-tabs a.active { background: #14532d; color: #fff; border-color: #14532d; }
/* Admin breadcrumb (admin pages only). */
.breadcrumb { margin: 0 0 0.9rem; font-size: 0.85rem; }
.breadcrumb a { color: #14532d; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #9ca3af; margin: 0 0.4rem; }
.breadcrumb .current { color: #6b7280; }

/* Admin area — wider than the 360px auth card. */
.content:has(.admin-wide) { display: block; max-width: none; }
.card.admin-wide { max-width: 1100px; margin: 0 auto; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.admin-menu { list-style: none; padding: 0; line-height: 2; }
.admin-menu.muted, .muted { color: #6b7280; }
a.btn, .btn { display: inline-block; padding: 0.45rem 0.8rem; background: #14532d;
  color: #fff; text-decoration: none; border-radius: 4px; }
table.grid { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9rem; }
table.grid th, table.grid td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid #e5e7eb; }
table.grid th { background: #f1f5f9; }
table.grid tr.row-disabled td { color: #9ca3af; }
td.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
td.actions form.inline button, td.actions a { font-size: 0.85rem; }
button.danger { background: #b91c1c; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }
.stack textarea { padding: 0.5rem; border: 1px solid #cbd5e1; border-radius: 4px; font-family: inherit; }
.stack select { padding: 0.5rem; border: 1px solid #cbd5e1; border-radius: 4px; }
.stack label.checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
.stack label.checkbox input { width: auto; }

/* Schedule-import (admin, step 6b) — status pills + page layout. Utility classes
   over the existing palette; no new framework. */
.pill { display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; line-height: 1.45; white-space: nowrap; }
.pill-done    { background: #dcfce7; color: #15803d; }  /* success   */
.pill-ready   { background: #e0f2fe; color: #075985; }  /* info/ready */
.pill-wait    { background: #fef9c3; color: #854d0e; }  /* warning   */
.pill-missing { background: #fee2e2; color: #b91c1c; }  /* danger    */
.pill-na      { background: #f1f5f9; color: #6b7280; }  /* tertiary  */
.si-sub { color: #6b7280; font-size: 0.92rem; margin: 0 0 0.6rem; }
.si-chip { margin-left: 0.4rem; }
.si-alarm { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca;
  border-radius: 6px; padding: 0.6rem 0.8rem; margin: 0.5rem 0 0.8rem; }
/* 6d.1 — escalated EOD alarm after the Sofia cutoff. Solid danger red (#b91c1c)
   + white text for a "big red" treatment; slow flat opacity blink, no glow. */
.si-alarm-escalated { background: #b91c1c; color: #fff; border-color: #b91c1c;
  font-size: 1.05rem; font-weight: 700; padding: 0.9rem 1rem;
  animation: si-blink 1s ease-in-out infinite; }
.si-alarm-time { font-weight: 400; font-size: 0.85rem; opacity: 0.9; }
@keyframes si-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  .si-alarm-escalated { animation: none; }  /* solid red, no blink */
}
.si-legend { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap;
  font-size: 0.8rem; margin: 0.5rem 0 1rem; }
/* Per-row DAM enable/disable toggle (admin write). Reuses the pill palette. */
.dam-toggle-form { display: inline; margin-left: 0.5rem; }
.dam-toggle { font-size: 0.72rem; font-weight: 600; padding: 0.05rem 0.5rem;
  border-radius: 999px; border: 1px solid; cursor: pointer; }
.dam-toggle.on  { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.dam-toggle.off { background: #f1f5f9; color: #6b7280; border-color: #e5e7eb; }
/* Site <-> dashboard linking admin. */
.sd-add { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 0.5rem 0 1rem; }
.sd-add input[type="text"], .sd-add input:not([type]), .sd-add select { padding: 0.35rem 0.4rem;
  border: 1px solid #cbd5e1; border-radius: 4px; }
.sd-edit { display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; margin: 0; }
.sd-edit input { padding: 0.25rem 0.35rem; border: 1px solid #cbd5e1; border-radius: 4px; }
.sd-sort { width: 3.5rem; }
.card-inset { border: 1px solid #e5e7eb; border-radius: 8px; padding: 0.6rem 1rem;
  margin: 0.5rem 0 1rem; }
.si-dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem;
  margin: 0.5rem 0; font-size: 0.9rem; }
.si-dl dt { color: #6b7280; }
.si-dl dd { margin: 0; }
.si-actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; align-items: flex-start; }
.si-actions form { margin: 0; }
/* DAM import cockpit (step 6c). */
.si-upload { display: flex; gap: 0.5rem; align-items: center; margin: 0.5rem 0; flex-wrap: wrap; }
.si-selected { font-size: 0.9rem; margin: 0.4rem 0; }
.si-selected code { background: #f1f5f9; padding: 0.1rem 0.35rem; border-radius: 4px; }
.si-warn { color: #854d0e; background: #fef9c3; border: 1px solid #fde68a;
  border-radius: 6px; padding: 0.4rem 0.6rem; margin: 0.4rem 0; font-size: 0.85rem; }
.si-ok { margin: 0.5rem 0; font-size: 0.9rem; }
.si-shape { display: flex; align-items: flex-end; gap: 0.5rem; margin: 0.6rem 0;
  flex-wrap: wrap; }
.si-shape-lbl { font-size: 0.75rem; color: #6b7280; align-self: center; }
.spark { display: inline-flex; align-items: flex-end; gap: 1px; height: 40px;
  padding: 2px 4px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 4px; }
.spark i { width: 4px; display: inline-block; background: #15803d; }
.spark-bess i.chg  { background: #b91c1c; }   /* charge  (negative) */
.spark-bess i.dis  { background: #15803d; }   /* discharge (positive) */
.spark-bess i.zero { background: #cbd5e1; height: 1px !important; }
