:root{
  --teal:#0fa4a9;
  --bg:#f5f7f8;
  --card:#ffffff;
  --text:#0b1220;
  --muted:#5a677a;
  --line:#e6ebef;
  --shadow:0 1px 3px rgba(0,0,0,.10);
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

.topbar{
  background:var(--teal);
  color:#fff;
  padding:14px 18px;
  display:flex;
  justify-content:space-between;
  align-items:baseline;
}
.topbar__title{font-weight:700; font-size:18px}
.topbar__hint{opacity:.9; font-size:13px}

.wrap{max-width:1100px; margin:18px auto; padding:0 14px}

.board{
  background:var(--card);
  border-radius:10px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.board__head{
  padding:14px 16px;
  border-bottom:1px solid var(--line);
}
.board__headTitle{font-size:16px; font-weight:700}
.board__subTitle{font-size:12px; color:var(--muted); margin-top:4px}

.manager{ border-bottom:1px solid var(--line); }
.manager:last-child{border-bottom:none}

.manager__summary{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  cursor:pointer;
  user-select:none;
}
.manager__left{
  display:flex;
  gap:8px;
  min-width:0;
  align-items:center;
}
.chev{
  width:18px;
  display:inline-block;
  color:var(--muted);
  font-weight:700;
}
.manager__title{
  font-weight:700;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.manager__states{
  font-weight:500;
  color:var(--muted);
  margin-left:8px;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.manager__right{
  color:var(--muted);
  font-size:12px;
  flex:0 0 auto;
  display:flex;
  align-items:center;
}
.pill{
  padding:4px 8px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
}

.manager__details{ display:none; padding:0 16px 14px 16px; }
.manager--open .manager__details{display:block}

.stateRow{
  display:grid;
  grid-template-columns: 240px 1fr 90px;
  gap:8px;
  align-items:start;
  padding:10px 0;
  border-top:1px dashed var(--line);
}
.stateRow:first-child{border-top:none}

.stateName{font-weight:700; padding-top:6px}

.light{
  width:44px;
  height:28px;
  border-radius:999px;
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-weight:900;
  flex:0 0 auto;
}
.light--green{background:#e9f7ef}
.light--yellow{background:#fff7e6}
.light--red{background:#fdecec}

.opoList{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.opoLine{
  display:flex;
  gap:8px;
  align-items:center;
  min-width:0;
}

.opoLine label{
  font-size:12px;
  color:var(--muted);
  width:60px;
}

.opoLine input{
  width:100%;
  padding:6px 8px;
  border:1px solid var(--line);
  border-radius:8px;
  font-size:14px;
}

.ts{
  text-align:right;
  color:var(--muted);
  font-size:12px;
  font-variant-numeric: tabular-nums;
  padding-top:8px;
}

@media (max-width:640px){
  .stateRow{
    grid-template-columns: 1fr;
  }
  .ts{ text-align:left; padding-top:0; }
}

/* STATUS KEY LEGEND */
.legend{
  margin-top:10px;
  display:flex;
  flex-wrap:wrap;
  gap:10px 14px;
  align-items:center;
  padding:6px 8px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
}
.legend__title{
  font-size:12px;
  color:var(--muted);
  font-weight:700;
}
.legend__item{
  font-size:12px;
  color:var(--text);
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}
.legend__dot{
  width:10px;
  height:10px;
  border-radius:999px;
  border:1px solid var(--line);
  display:inline-block;
}
.legend__dot--green{ background:#e9f7ef; }
.legend__dot--yellow{ background:#fff7e6; }
.legend__dot--red{ background:#fdecec; }

/* TRAFFIC + NOTES */
.camLinks{
  margin-top:6px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.camLinks a{
  font-size:12px;
  color:var(--teal);
  text-decoration:none;
  border:1px solid var(--line);
  background:#fff;
  padding:4px 8px;
  border-radius:999px;
}
.camLinks a:hover{ text-decoration:underline; }

.notesPanel{
  margin-top:14px;
  border-top:1px solid var(--line);
  padding-top:14px;
}
.notesTitle{
  font-weight:800;
  margin-bottom:6px;
}
.notesHint{
  color:var(--muted);
  font-size:12px;
  margin-bottom:10px;
}
.noteItem{
  border:1px solid var(--line);
  background:#fff;
  border-radius:10px;
  padding:10px;
  margin-bottom:10px;
}
.noteHeader{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:8px;
}
.noteHeader .tag{
  font-size:12px;
  color:var(--muted);
  border:1px solid var(--line);
  border-radius:999px;
  padding:3px 8px;
  background:#fff;
}
.noteBox{
  width:100%;
  min-height:70px;
  resize:vertical;
  padding:6px 8px;
  border:1px solid var(--line);
  border-radius:10px;
  font-size:14px;
}
.emptyNotes{
  color:var(--muted);
  font-size:13px;
  padding:10px;
  border:1px dashed var(--line);
  border-radius:10px;
  background:#fff;
}

/* ALERTS PANEL */
.alertsPanel{
  margin-top:16px;
  border-top:1px solid var(--line);
  padding-top:14px;
}
.alertsTitle{
  font-weight:900;
  margin-bottom:6px;
  display:flex;
  align-items:center;
  gap:8px;
}
.alertsHint{
  color:var(--muted);
  font-size:12px;
  margin-bottom:12px;
}
.alertsGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}
@media (max-width: 860px){
  .alertsGrid{ grid-template-columns: 1fr; }
}
.alertCard{
  border:1px solid var(--line);
  background:#fff;
  border-radius:14px;
  padding:12px;
  box-shadow:var(--shadow);
}
.alertTop{
  display:flex;
  justify-content:space-between;
  gap:8px;
  align-items:flex-start;
  margin-bottom:10px;
}
.alertWho{
  min-width:0;
}
.alertWho .big{
  font-weight:900;
  font-size:14px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.alertWho .small{
  color:var(--muted);
  font-size:12px;
  margin-top:2px;
}
.badge{
  font-size:12px;
  border:1px solid var(--line);
  border-radius:999px;
  padding:4px 10px;
  background:#fff;
  white-space:nowrap;
}
.badge--yellow{ background:#fff7e6; }
.badge--red{ background:#fdecec; }

.alertMeta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:10px;
}
.alertMeta .tag{
  font-size:12px;
  color:var(--muted);
  border:1px solid var(--line);
  border-radius:999px;
  padding:3px 8px;
  background:#fff;
}

.alertReason{
  width:100%;
  min-height:72px;
  resize:vertical;
  padding:6px 8px;
  border:1px solid var(--line);
  border-radius:12px;
  font-size:14px;
}

.allClear{
  border:1px dashed var(--line);
  background:#fff;
  border-radius:14px;
  padding:14px;
  color:var(--muted);
}

/* SIDEBAR OPO STATUS */
.sidebar{
  position: fixed;
  right: 14px;
  top: 70px;            /* below topbar */
  width: 260px;
  max-height: calc(100vh - 92px);
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  z-index: 50;
}

.sidebar__title{
  font-weight: 900;
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:6px;
}
.sidebar__hint{
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}

.sidebar__group{
  margin-top: 10px;
}
.sidebar__groupTitle{
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  margin: 10px 0 6px 0;
}

.sideItem{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 8px;
  border:1px solid var(--line);
  border-radius: 12px;
  background:#fff;
  cursor:pointer;
  margin-bottom:8px;
}
.sideItem:hover{ box-shadow: var(--shadow); }

.tinyLight{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 11px;
  flex: 0 0 auto;
}
.tinyLight--green{ background:#e9f7ef; }
.tinyLight--yellow{ background:#fff7e6; }
.tinyLight--red{ background:#fdecec; }

.sideText{
  min-width:0;
}
.sideText .line1{
  font-weight: 800;
  font-size: 11px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.sideText .line2{
  font-size: 11px;
  color: var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.sideTime{
  margin-left:auto;
  font-size:11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space:nowrap;
}

/* Make room so content doesn't hide behind sidebar */
.wrap{ padding-right: 300px; }

@media (max-width: 980px){
  .sidebar{
    position: static;
    width: auto;
    max-height: none;
    margin-top: 12px;
  }
  .wrap{ padding-right: 14px; }
}

/* Per-OPO reason box (only shown on Yellow/Red) */
.reasonBox{
  margin-left: 70px; /* aligns after label+light so it doesn't look glued to area text */
  margin-top: 6px;
  width: calc(100% - 70px);
  min-height: 62px;
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  background:#fff;
}
.reasonHint{
  margin-left: 70px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* SIDEBAR COMPACT OVERRIDES */
.sidebar{ width:260px; padding:10px; }
.sideItem{ padding:6px 8px; gap:8px; margin-bottom:6px; }
.sideText .line1{ font-size:11px; }
.sideText .line2{ font-size:10px; }
.sideTime{ font-size:10px; }
.sidebar__hint{ font-size:11px; }
.sidebar__groupTitle{ font-size:11px; margin:8px 0 5px 0; }
.wrap{ padding-right:300px; }

.tinyLight{
  width:18px; height:18px;
  font-size:14px;        /* emoji size */
  border:none;           /* cleaner */
  background:transparent;/* emoji carries color */
}

/* SIDEBAR MINI BOARD */
.sidebar{
  position: fixed;
  right: 10px;
  top: 64px;
  width: 340px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  z-index: 50;

  /* key change: no scrolling */
  max-height: none;
  overflow: visible;
}

/* Make room so content doesn't hide behind sidebar */
.wrap{ padding-right: 370px; }

@media (max-width: 980px){
  .sidebar{ position: static; width: auto; }
  .wrap{ padding-right: 14px; }
}

.sidebar__title{
  font-weight: 900;
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:4px;
  font-size: 13px;
}

.sidebar__hint{
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

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

.sideMini{
  display:flex;
  align-items:center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:#fff;
  cursor:pointer;
  min-width:0;
}

.sideMini:hover{ box-shadow: var(--shadow); }

.sideLight{
  width: 18px;
  height: 18px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 14px;  /* emoji size */
  flex: 0 0 auto;
}

.sideName{
  font-weight: 800;
  font-size: 11px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  min-width:0;
}
